Skip to content

Commit

Permalink
enhanced :installer module
Browse files Browse the repository at this point in the history
  • Loading branch information
juerg committed Mar 20, 2024
1 parent 8cfc0db commit 03049c8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public DocSection section() {
demo.addItem(diBuilder.getDocItem("installer/install-demo", false));
demo.addItem(diBuilder.getDocItem("installer/install-demo-fonts", false));

final DocSection clean = new DocSection("Clean", id());
all.addSection(clean);
clean.addItem(diBuilder.getDocItem("installer/clean", false));

return section;
}

Expand Down
56 changes: 52 additions & 4 deletions src/main/resources/com/github/jlangch/venice/installer.venice
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,32 @@
(doseq [lib libs] (apply maven/download lib options))))


(defn
^{ :arglists '("(clean dir)")
:doc
"""
Remove Java libraries (except any Jansi library) and TTF font files from
the specified directory.

The removal does NOT recursively traverse the directory tree.
"""
:examples '(
"""
(do
(load-module :installer)
(installer/clean (repl/libs-dir)))
""")
:see-also '(
"installer/install-libs" ) }

clean [dir]

(when (io/exists-dir? dir)
(->> (io/list-files-glob dir "*.{jar,ttf}")
(filter #(not (jansi-lib? %)))
(docoll io/delete-file))))


(defn
^{ :arglists '("(install-demo options*)")
:doc
Expand Down Expand Up @@ -160,11 +186,17 @@

In the REPL run:

````
```
venice> (load-module :installer)
venice> (installer/install-demo)
venice> !restart
```

The installed libraries and fonts can be cleaned with:

```
(installer/clean (repl/libs-dir))
```
"""
:examples '(
"""
Expand All @@ -173,7 +205,8 @@
(installer/install-demo :dir (repl/libs-dir) :silent false))
""")
:see-also '(
"installer/install-demo-fonts" ) }
"installer/install-demo-fonts"
"installer/clean" ) }

install-demo [& options]

Expand Down Expand Up @@ -218,11 +251,17 @@

In the REPL run:

````
```
venice> (load-module :installer)
venice> (installer/install-demo-fonts)
venice> !restart
```

The installed libraries and fonts can be cleaned with:

```
(installer/clean (repl/libs-dir))
```
"""
:examples '(
"""
Expand All @@ -231,7 +270,8 @@
(installer/install-demo-fonts :dir (repl/libs-dir) :silent false))
""")
:see-also '(
"installer/install-demo" ) }
"installer/install-demo"
"installer/clean" ) }

install-demo-fonts [& options]

Expand Down Expand Up @@ -263,3 +303,11 @@
(if (str/ends-with? (core/name name) "-install")
name
(keyword (str (core/name name) "-install"))))


(defn- jansi-lib? [f]
(case (type f)
:core/string (jansi-lib? (io/file f))
:java.io.File (match? (io/file-name f) #"jansi-[0-9]+[.][0-9]+[.][0-9]+[.]jar")
false))

0 comments on commit 03049c8

Please sign in to comment.