This commit is contained in:
Michiel Borkent 2021-02-05 23:29:23 +01:00
parent 6de95254e8
commit 549c2166b4
4 changed files with 71 additions and 3 deletions

View file

@ -12,9 +12,10 @@
"depstar/src" "process/src"
"deps.clj/src" "deps.clj/resources"
"resources" "sci/resources"],
:deps {org.clojure/clojure {:mvn/version "1.10.2-alpha2"},
:deps {org.clojure/clojure {:mvn/version "1.10.2"},
borkdude/sci {:local/root "sci"}
babashka/babasha.curl {:local/root "babashka.curl"}
babashka/fs {:local/root "fs"}
borkdude/graal.locking {:mvn/version "0.0.2"},
org.clojure/core.async {:mvn/version "1.3.610"},
org.clojure/tools.cli {:mvn/version "1.0.194"},

View file

@ -7,14 +7,14 @@
:url "https://github.com/babashka/babashka"}
:license {:name "Eclipse Public License 1.0"
:url "http://opensource.org/licenses/eclipse-1.0.php"}
:source-paths ["src" "sci/src" "babashka.curl/src" "pods/src"
:source-paths ["src" "sci/src" "babashka.curl/src" "fs/src" "pods/src"
"babashka.nrepl/src" "depstar/src" "process/src"
"deps.clj/src" "deps.clj/resources"]
;; for debugging Reflector.java code:
;; :java-source-paths ["sci/reflector/src-java"]
:java-source-paths ["src-java"]
:resource-paths ["resources" "sci/resources"]
:dependencies [[org.clojure/clojure "1.10.2-alpha2"]
:dependencies [[org.clojure/clojure "1.10.2"]
[borkdude/edamame "0.0.11-alpha.29"]
[borkdude/graal.locking "0.0.2"]
[org.clojure/tools.cli "1.0.194"]

64
src/babashka/impl/fs.clj Normal file
View file

@ -0,0 +1,64 @@
(ns babashka.impl.fs
(:require [babashka.fs :as fs]
[sci.core :as sci]))
(def fns (sci/create-ns 'babashka.fs nil))
#_(doseq [k (sort (keys (ns-publics 'babashka.fs)))]
(println (str "'" k) (format "(sci/copy-var fs/%s fns)" k)))
(def fs-namespace
{'absolute? (sci/copy-var fs/absolute? fns)
'absolutize (sci/copy-var fs/absolutize fns)
'components (sci/copy-var fs/components fns)
'copy (sci/copy-var fs/copy fns)
'copy-tree (sci/copy-var fs/copy-tree fns)
'create-dir (sci/copy-var fs/create-dir fns)
'create-dirs (sci/copy-var fs/create-dirs fns)
'create-file (sci/copy-var fs/create-file fns)
'create-sym-link (sci/copy-var fs/create-sym-link fns)
'create-temp-dir (sci/copy-var fs/create-temp-dir fns)
'creation-time (sci/copy-var fs/creation-time fns)
'delete (sci/copy-var fs/delete fns)
'delete-if-exists (sci/copy-var fs/delete-if-exists fns)
'delete-on-exit (sci/copy-var fs/delete-on-exit fns)
'delete-tree (sci/copy-var fs/delete-tree fns)
'directory-stream (sci/copy-var fs/directory-stream fns)
'directory? (sci/copy-var fs/directory? fns)
'executable? (sci/copy-var fs/executable? fns)
'exists? (sci/copy-var fs/exists? fns)
'file (sci/copy-var fs/file fns)
'file-name (sci/copy-var fs/file-name fns)
'file-separator (sci/copy-var fs/file-separator fns)
'file-time->instant (sci/copy-var fs/file-time->instant fns)
'file-time->millis (sci/copy-var fs/file-time->millis fns)
'get-attribute (sci/copy-var fs/get-attribute fns)
'glob (sci/copy-var fs/glob fns)
'hidden? (sci/copy-var fs/hidden? fns)
'instant->file-time (sci/copy-var fs/instant->file-time fns)
'last-modified-time (sci/copy-var fs/last-modified-time fns)
'list-dir (sci/copy-var fs/list-dir fns)
'millis->file-time (sci/copy-var fs/millis->file-time fns)
'move (sci/copy-var fs/move fns)
'normalize (sci/copy-var fs/normalize fns)
'parent (sci/copy-var fs/parent fns)
'path (sci/copy-var fs/path fns)
'path-separator (sci/copy-var fs/path-separator fns)
'posix->str (sci/copy-var fs/posix->str fns)
'posix-file-permissions (sci/copy-var fs/posix-file-permissions fns)
'read-all-bytes (sci/copy-var fs/read-all-bytes fns)
'read-all-lines (sci/copy-var fs/read-all-lines fns)
'read-attributes (sci/copy-var fs/read-attributes fns)
'readable? (sci/copy-var fs/readable? fns)
'real-path (sci/copy-var fs/real-path fns)
'relative? (sci/copy-var fs/relative? fns)
'relativize (sci/copy-var fs/relativize fns)
'same-file? (sci/copy-var fs/same-file? fns)
'set-attribute (sci/copy-var fs/set-attribute fns)
'set-creation-time (sci/copy-var fs/set-creation-time fns)
'set-last-modified-time (sci/copy-var fs/set-last-modified-time fns)
'set-posix-file-permissions (sci/copy-var fs/set-posix-file-permissions fns)
'size (sci/copy-var fs/size fns)
'str->posix (sci/copy-var fs/str->posix fns)
'walk-file-tree (sci/copy-var fs/walk-file-tree fns)
'writable? (sci/copy-var fs/writable? fns)})

View file

@ -21,6 +21,7 @@
[babashka.impl.deps :as deps :refer [deps-namespace]]
[babashka.impl.error-handler :refer [error-handler]]
[babashka.impl.features :as features]
[babashka.impl.fs :refer [fs-namespace]]
[babashka.impl.pods :as pods]
[babashka.impl.pprint :refer [pprint-namespace]]
[babashka.impl.process :refer [process-namespace]]
@ -334,6 +335,7 @@ Use -- to separate script command line args from bb command line args.
io clojure.java.io
json cheshire.core
curl babashka.curl
fs babashka.fs
bencode bencode.core
deps babashka.deps}
features/xml? (assoc 'xml 'clojure.data.xml)
@ -375,6 +377,7 @@ Use -- to separate script command line args from bb command line args.
'babashka.classpath classpath-namespace
'clojure.pprint pprint-namespace
'babashka.curl curl-namespace
'babashka.fs fs-namespace
'babashka.pods pods/pods-namespace
'bencode.core bencode-namespace
'clojure.java.browse browse-namespace