Merge branch 'master' into repl-deps
This commit is contained in:
commit
f9f1b25449
10 changed files with 26 additions and 51 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -38,3 +38,4 @@ target
|
|||
.DS_Store
|
||||
.portal
|
||||
default.iprof
|
||||
scratch.clj
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ A preview of the next release can be installed from
|
|||
|
||||
## Unreleased
|
||||
|
||||
- Upgrade Clojure to `1.12.0`
|
||||
- [#1720](https://github.com/babashka/babashka/issues/1720): Include `clojure.java.process`
|
||||
- [#1598](https://github.com/babashka/babashka/issues/1598): use Rosetta on CircleCI to build x64 images
|
||||
- Bump SCI
|
||||
- Bump `fs`
|
||||
|
|
|
|||
53
README.md
53
README.md
|
|
@ -40,10 +40,10 @@ As one user described it:
|
|||
## Quickstart
|
||||
|
||||
For installation options check [Installation](https://github.com/babashka/babashka#installation).
|
||||
For quick installation use:
|
||||
For quick installation using `bash`, use:
|
||||
|
||||
``` shell
|
||||
$ bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)
|
||||
bash < <(curl -s https://raw.githubusercontent.com/babashka/babashka/master/install)
|
||||
```
|
||||
|
||||
or grab a binary from [Github
|
||||
|
|
@ -53,9 +53,12 @@ anywhere on the path.
|
|||
Then you're ready to go:
|
||||
|
||||
``` shellsession
|
||||
$ ls | bb -i '(filter fs/directory? *input*)'
|
||||
("doc" "resources" "sci" "script" "src" "target" "test")
|
||||
bb took 4ms.
|
||||
time bb -e '(->> (fs/list-dir ".") (filter fs/directory?) (map fs/normalize) (map str) (take 3))'
|
||||
```
|
||||
|
||||
``` clojure
|
||||
(".build" "feature-lanterna" ".repl")
|
||||
bb -e 0,01s user 0,01s system 70% cpu 0,017 total
|
||||
```
|
||||
|
||||
## Support :heart:
|
||||
|
|
@ -120,46 +123,6 @@ by Daniel Higginbotham, who has also helped a lot of people learn Clojure with
|
|||
[Clojure for the Brave and
|
||||
True](https://www.braveclojure.com/clojure-for-the-brave-and-true/).
|
||||
|
||||
## Examples
|
||||
|
||||
Read the output from a shell command as a lazy seq of strings:
|
||||
|
||||
``` shell
|
||||
$ ls | bb -i '(take 2 *input*)'
|
||||
("CHANGES.md" "Dockerfile")
|
||||
```
|
||||
|
||||
Read EDN from stdin and write the result to stdout:
|
||||
|
||||
``` shell
|
||||
$ bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]'
|
||||
[1 2]
|
||||
```
|
||||
|
||||
Read more about `*input*` and in- and output flags
|
||||
[here](https://book.babashka.org/#_input_and_output_flags).
|
||||
|
||||
Execute a script. E.g. print the current time in California using the
|
||||
`java.time` API:
|
||||
|
||||
File `pst.clj`:
|
||||
``` clojure
|
||||
#!/usr/bin/env bb
|
||||
|
||||
(def now (java.time.ZonedDateTime/now))
|
||||
(def LA-timezone (java.time.ZoneId/of "America/Los_Angeles"))
|
||||
(def LA-time (.withZoneSameInstant now LA-timezone))
|
||||
(def pattern (java.time.format.DateTimeFormatter/ofPattern "HH:mm"))
|
||||
(println (.format LA-time pattern))
|
||||
```
|
||||
|
||||
``` shell
|
||||
$ bb pst.clj
|
||||
05:17
|
||||
```
|
||||
|
||||
More examples can be found [here](examples/README.md).
|
||||
|
||||
## Try online
|
||||
|
||||
You can try babashka online with Nextjournal's babashka [notebook
|
||||
|
|
|
|||
2
deps.edn
2
deps.edn
|
|
@ -18,7 +18,7 @@
|
|||
"deps.clj/src" "deps.clj/resources"
|
||||
"resources" "sci/resources"
|
||||
"impl-java/src"],
|
||||
:deps {org.clojure/clojure {:mvn/version "1.11.2"},
|
||||
:deps {org.clojure/clojure {:mvn/version "1.12.0"},
|
||||
org.babashka/sci {:local/root "sci"}
|
||||
org.babashka/babashka.impl.java {:mvn/version "0.1.8"}
|
||||
org.babashka/sci.impl.types {:mvn/version "0.0.2"}
|
||||
|
|
|
|||
2
fs
2
fs
|
|
@ -1 +1 @@
|
|||
Subproject commit 11121dedba416e93ce1eb69674c78f269a1f3e0a
|
||||
Subproject commit 99d6a3b2f55b851a6949ed6eee31412b299dcf01
|
||||
|
|
@ -21,8 +21,8 @@
|
|||
:non-flaky (complement :flaky)
|
||||
:flaky :flaky}
|
||||
:jvm-opts ["--enable-preview"]
|
||||
:dependencies [[org.clojure/clojure "1.11.2"]
|
||||
[borkdude/edamame "1.4.24"]
|
||||
:dependencies [[org.clojure/clojure "1.12.0"]
|
||||
[borkdude/edamame "1.4.27"]
|
||||
[borkdude/graal.locking "0.0.2"]
|
||||
[org.clojure/tools.cli "1.0.214"]
|
||||
[cheshire "5.13.0"]
|
||||
|
|
|
|||
2
sci
2
sci
|
|
@ -1 +1 @@
|
|||
Subproject commit c556f4474303c61da72e7a07eef496dcbf66a56e
|
||||
Subproject commit f766255d14647d46486546dc6afce1ae1bcd2c7b
|
||||
6
src/babashka/impl/clojure/java/process.clj
Normal file
6
src/babashka/impl/clojure/java/process.clj
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(ns babashka.impl.clojure.java.process
|
||||
(:require [clojure.java.process]
|
||||
[sci.core :as sci]))
|
||||
|
||||
(def cjp (sci/create-ns 'clojure.java.process nil))
|
||||
(def cjp-namespace (sci/copy-ns clojure.java.process cjp))
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
[babashka.impl.clojure.tools.reader-types :refer [edn-namespace
|
||||
reader-types-namespace]]
|
||||
[babashka.impl.clojure.zip :refer [zip-namespace]]
|
||||
[babashka.impl.clojure.java.process :refer [cjp-namespace]]
|
||||
[babashka.impl.common :as common]
|
||||
[babashka.impl.core :as bbcore]
|
||||
[babashka.impl.curl :refer [curl-namespace]]
|
||||
|
|
@ -389,6 +390,7 @@ Use bb run --help to show this help output.
|
|||
'main main-var}
|
||||
'clojure.test t/clojure-test-namespace
|
||||
'clojure.math math-namespace
|
||||
'clojure.java.process cjp-namespace
|
||||
'babashka.classpath classpath-namespace
|
||||
'babashka.classes classes-namespace
|
||||
'clojure.pprint pprint-namespace
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
(-> line str/trimr
|
||||
;; take into account JDK14+ and native image differences
|
||||
(str/replace "class clojure.lang" "clojure.lang")
|
||||
(str/replace #" \(.*\)$" "")))
|
||||
(str/replace #" \(.*\)$" "")
|
||||
(str/replace #"--\d\d\d\d" "")))
|
||||
|
||||
(defmacro multiline-equals [s1 s2]
|
||||
`(let [lines-s1# (str/split-lines ~s1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue