Skip to content

Commit 2a2f5ab

Browse files
authored
Bump fs (#777)
1 parent cdf2938 commit 2a2f5ab

File tree

5 files changed

+36
-28
lines changed

5 files changed

+36
-28
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ jobs:
9191
cli: '1.12.0.1530'
9292
bb: latest
9393

94-
- name: 🗝 maven cache
95-
uses: actions/cache@v3
96-
with:
97-
path: |
98-
~/.m2
99-
~/.gitlibs
100-
~/.deps.clj
101-
key: ${{ runner.os }}-maven-test-${{ hashFiles('deps.edn') }}
94+
# - name: 🗝 maven cache
95+
# uses: actions/cache@v3
96+
# with:
97+
# path: |
98+
# ~/.m2
99+
# ~/.gitlibs
100+
# ~/.deps.clj
101+
# key: ${{ runner.os }}-maven-test-${{ hashFiles('deps.edn') }}
102102
- name: 🧪 Run tests
103103
shell: bash
104104
run: |
@@ -132,14 +132,14 @@ jobs:
132132
with:
133133
bb: latest
134134

135-
- name: 🗝 maven cache
136-
uses: actions/cache@v3
137-
with:
138-
path: |
139-
~/.m2
140-
~/.gitlibs
141-
~/.deps.clj
142-
key: ${{ runner.os }}-maven-test-${{ hashFiles('deps.edn') }}-${{ hashFiles('bb.edn') }}
135+
# - name: 🗝 maven cache
136+
# uses: actions/cache@v3
137+
# with:
138+
# path: |
139+
# ~/.m2
140+
# ~/.gitlibs
141+
# ~/.deps.clj
142+
# key: ${{ runner.os }}-maven-test-${{ hashFiles('deps.edn') }}-${{ hashFiles('bb.edn') }}
143143

144144
- name: 🧪 Run tests
145145
shell: bash

deps.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{:paths ["src" "resources" "bb"]
22
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
33
org.clojure/java.classpath {:mvn/version "1.0.0"}
4-
babashka/fs {:mvn/version "0.5.27"}
4+
babashka/fs {:mvn/version "0.5.28"}
55
org.babashka/http-client {:mvn/version "0.4.23"}
66
borkdude/edamame {:mvn/version "1.4.28"}
77
weavejester/dependency {:mvn/version "0.2.1"}

src/nextjournal/clerk/analyzer.clj

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@
408408

409409
(defn normalize-filename [f]
410410
(if (fs/windows?)
411-
(-> f fs/normalize fs/unixify)
411+
(-> f fs/normalize utils/unixify)
412412
f))
413413

414414
(defn ns->jar [ns]
@@ -451,12 +451,15 @@
451451
(when (fs/exists? file)
452452
(fs/relativize (fs/cwd) (fs/file file)))
453453
(when-let [resource (io/resource file)]
454-
(let [protocol (.getProtocol resource)]
455-
(or (and (= "jar" protocol)
456-
(second (re-find #"^file:(.*)!" (.getFile resource))))
457-
(and (= "file" protocol)
458-
(.getFile resource))))))
459-
str)))
454+
(let [protocol (.getProtocol resource)
455+
resource-file (case protocol
456+
"jar" (first (str/split (.getPath resource) #"!"))
457+
"file" (str resource))]
458+
(-> resource-file java.net.URI. io/file str))))
459+
utils/unixify)))
460+
461+
#_(var->location #'inc)
462+
#_(var->location #'var->location)
460463

461464
(defn find-location [sym]
462465
(if (deref? sym)
@@ -547,7 +550,7 @@
547550
(let [jar? (or (nil? source)
548551
(str/ends-with? source ".jar"))
549552
gitlib-hash (and (not jar?)
550-
(second (re-find #".gitlibs/libs/.*/(\b[0-9a-f]{5,40}\b)/" (fs/unixify source))))]
553+
(second (re-find #".gitlibs/libs/.*/(\b[0-9a-f]{5,40}\b)/" (utils/unixify source))))]
551554
(if (or jar? gitlib-hash)
552555
(update g :->analysis-info merge (into {} (map (juxt identity
553556
(constantly (if source

src/nextjournal/clerk/paths.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"Clerk's paths expansion and paths-fn handling."
33
(:require [babashka.fs :as fs]
44
[clojure.edn :as edn]
5-
[clojure.string :as str])
5+
[clojure.string :as str]
6+
[nextjournal.clerk.utils :as utils])
67
(:import [java.net URL]))
78

89
(defn ^:private ensure-not-empty [build-opts {:as opts :keys [error expanded-paths]}]
@@ -130,7 +131,7 @@
130131
(fs/exists? file))
131132
(let [rel (fs/relativize (fs/cwd) (fs/canonicalize file #{:nofollow-links}))]
132133
(when-not (str/starts-with? (str rel) "..")
133-
(fs/unixify rel)))))
134+
(utils/unixify rel)))))
134135

135136
#_(path-in-cwd "notebooks/rule_30.clj")
136137
#_(path-in-cwd "/tmp/foo.clj")

src/nextjournal/clerk/utils.clj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
(ns nextjournal.clerk.utils
2-
(:require [alphabase.base58 :as base58]))
2+
(:require [alphabase.base58 :as base58]
3+
[clojure.string :as str]))
34

45
(def bb? (System/getProperty "babashka.version"))
56

@@ -23,3 +24,6 @@
2324

2425
(defn ->base58 [x]
2526
(base58/encode x))
27+
28+
(defn unixify [x]
29+
(str/replace (str x) "\\" "/"))

0 commit comments

Comments
 (0)