Skip to content

Commit 47698bb

Browse files
committed
add bb install-plugin
1 parent 7236e68 commit 47698bb

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

bb.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{:paths ["src/scripts"]
22
:tasks {tag scripts/tag
33
build-plugin scripts/build-plugin
4+
install-plugin scripts/install-plugin
45
publish-plugin scripts/publish-plugin}}

docs/developing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
or
66

7-
`./gradlew buildPlugin` to build the plugin, then install it from disk in Intellij, the zip should be on `./build/distributions/*.zip`.
7+
`bb install-plugin` to build and install the plugin.
88

99
## NREPL
1010

src/scripts/scripts.clj

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
(ns scripts
22
(:require
3+
[babashka.fs :as fs]
34
[babashka.tasks :refer [shell]]
45
[clojure.string :as string]))
56

7+
(def version-regex #"pluginVersion = ([0-9]+.[0-9]+.[0-9]+.*)")
8+
69
(defn ^:private replace-in-file [file regex content]
710
(as-> (slurp file) $
811
(string/replace $ regex content)
@@ -17,7 +20,7 @@
1720

1821
(defn ^:private replace-tag [tag]
1922
(replace-in-file "gradle.properties"
20-
#"pluginVersion = [0-9]+.[0-9]+.[0-9]+.*"
23+
version-regex
2124
(format "pluginVersion = %s" tag)))
2225

2326
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
@@ -36,6 +39,17 @@
3639
(defn build-plugin []
3740
(shell "./gradlew buildPlugin"))
3841

42+
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
43+
(defn install-plugin [& [intellij-plugins-path]]
44+
(if-not intellij-plugins-path
45+
(println "Specify the Intellij plugins path\ne.g: bb install-plugin /home/greg/.local/share/JetBrains/IdeaIC2024.3")
46+
(let [version (last (re-find version-regex (slurp "gradle.properties")))]
47+
(build-plugin)
48+
(fs/unzip (format "./build/distributions/clojure-lsp-%s.zip" version)
49+
intellij-plugins-path
50+
{:replace-existing true})
51+
(println "Installed!"))))
52+
3953
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
4054
(defn publish-plugin []
4155
(shell "./gradlew clean publishPlugin"))

0 commit comments

Comments
 (0)