Skip to content

Commit 196f702

Browse files
authored
Merge pull request #61 from zen-lang/feat/work-with-fs
Use io/file for work creating file path
2 parents 5c95fc6 + f578c0e commit 196f702

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1657
-1782
lines changed

.clj-kondo/config.edn

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{:lint-as {}
2+
:ns-groups [{:pattern "^.*-test$" :name tests}]
3+
:skip-comments true
4+
:config-in-ns {tests {:linters {:inline-def {:level :off}}}}
5+
6+
:linters {:not-empty? {:level :off}
7+
#_#_:line-length {:max-line-length 120}
8+
:warn-on-reflection {:level :off
9+
:warn-only-on-interop true}
10+
:used-underscored-binding {:level :warning}
11+
:shadowed-var {:level :off}
12+
:inline-def {:level :warning}
13+
:reduce-without-init {:level :off}
14+
:keyword-binding {:level :warning}
15+
:main-without-gen-class {:level :warning}
16+
:cond-else {:level :warning}
17+
:aliased-namespace-symbol {:level :warning
18+
:exclude [clojure.string]}
19+
:duplicate-require {:level :warning}
20+
:deprecated-var {:level :warning}
21+
:docstring-no-summary {:level :warning}
22+
:unresolved-namespace {:level :warning}
23+
:unused-namespace {:level :warning}
24+
:unsorted-required-namespaces {:level :warning}
25+
:unused-binding {:level :warning}
26+
:redundant-call {:level :warning}
27+
:redundant-fn-wrapper {:level :warning}
28+
:namespace-name-mismatch {:level :warning}
29+
:missing-body-in-when {:level :warning}
30+
:refer-all {:level :warning}
31+
:single-key-in {:level :warning}
32+
:missing-clause-in-try {:level :warning}
33+
:docstring-leading-trailing-whitespace {:level :warning}
34+
:missing-else-branch {:level :off}
35+
:non-arg-vec-return-type-hint {:level :off}
36+
:unused-private-var {:level :off}}
37+
:output {:show-rule-name-in-message true}}

.github/workflows/clojure.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
uses: actions/checkout@v3
1616

1717
- name: Install all the tools
18-
uses: DeLaGuardo/setup-clojure@10.3
18+
uses: DeLaGuardo/setup-clojure@11.0
1919
with:
20-
cli: 1.11.1.1149
20+
cli: 1.11.1.1347
2121
bb: latest
2222
github-token: ${{ secrets.GITHUB_TOKEN }}
2323
- name: Cache clojure dependencies
@@ -32,4 +32,3 @@ jobs:
3232
restore-keys: cljdeps-
3333
- name: Run tests
3434
run: bb test-ci
35-

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
.nrepl-port
44
target
55
.env
6-
/.clj-kondo
7-
/.calva
6+
!.clj-kondo/config.edn
7+
.clj-kondo/
8+
.calva
89

910
# pulled dependencies for zen-package used for benchmark fixtures
1011
/pkg/zen-pkg/zen-packages/

deps.edn

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:version "0.0.1-SNAPSHOT"
55

66
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
7-
borkdude/edamame {:mvn/version "1.0.16"}
7+
borkdude/edamame {:mvn/version "1.3.22"}
88
hawk/hawk {:mvn/version "0.2.11"}
99
healthsamurai/matcho {:mvn/version "0.3.10"}}
1010

@@ -13,7 +13,7 @@
1313
{:extra-paths []
1414
:extra-deps {org.clojure/tools.nrepl {:mvn/version "0.2.13"}
1515
org.clojure/core.rrb-vector {:mvn/version "0.1.2"}
16-
cider/cider-nrepl {:mvn/version "0.29.0"}
16+
cider/cider-nrepl {:mvn/version "0.30.0"}
1717
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}}
1818

1919
:jvm-opts ^:replace ["-XX:-OmitStackTraceInFastThrow"]
@@ -27,9 +27,9 @@
2727
"-XX:+UnlockDiagnosticVMOptions"
2828
"-XX:+DebugNonSafepoints"]
2929
:extra-deps {criterium/criterium {:mvn/version "0.4.6"}
30-
com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.0.3"}}}
30+
com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.0.4"}}}
3131
:kaocha
32-
{:extra-deps {lambdaisland/kaocha {:mvn/version "1.76.1230"}}
32+
{:extra-deps {lambdaisland/kaocha {:mvn/version "1.85.1342"}}
3333
:extra-paths ["runner" "test"]
3434
:jvm-opts ^:replace ["-XX:-OmitStackTraceInFastThrow"]
3535
:main-opts ["-m" "kaocha.runner" "--config-file" "kaocha.edn"]}
@@ -39,7 +39,7 @@
3939
:ns-default build.zen
4040
:jvm-opts ^:replace ["-XX:-OmitStackTraceInFastThrow"]
4141
:extra-deps {io.github.clojure/tools.build {:git/url "https://github.com/clojure/tools.build"
42-
:sha "984a24c0ef0a6af3f304b567adb45af40baefd08"}}}
42+
:sha "fcb8ecb555d5db341c7fb8310a00c8c86c78aae3"}}}
4343
:deploy
4444
{:extra-deps {slipset/deps-deploy {:mvn/version "RELEASE"}}
4545
:main-opts ["-m" "deps-deploy.deps-deploy" "deploy" "target/zen.jar"]}}}

doc.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## zen
1+
# zen
22

33
Zen is declarative language to describe models with data.
44
Zen syntax is based on extensible data notation (edn) - [see refs](https://github.com/edn-format/edn)
@@ -24,11 +24,8 @@ Namespace should have a name under `ns` key.
2424

2525
By convention path to file should match namespace name: i.e. `my/package/model.edn` <-> `my.package.model**
2626

27-
28-
2927
## v2
3028

31-
3229
zen model is just a data in edn format
3330

3431
edn primer:
@@ -44,7 +41,7 @@ edn primer:
4441

4542
models are grouped into namespaces, map of model names (keys) and model's data (values).
4643

47-
Each namespace should have a name - `ns` key.
44+
Each namespace should have a name - `ns` key.
4845

4946
Each model in namespace can be references by full name `<ns-name>/<model-key>`
5047

@@ -54,9 +51,7 @@ symbols in zen are reference to other models.
5451
zen checks that referenced name exists.
5552

5653
Local refs can by unnamespaced names (current namespace name is assumed)
57-
Symbols from other namespaces are referenced with full name - <ns-name>/<model-name>
58-
59-
54+
Symbols from other namespaces are referenced with full name - `<ns-name>/<model-name>`
6055

6156
## Namespaces & references
6257

@@ -70,7 +65,7 @@ There are two special keys:
7065
Other keys are names of **models** or **symbols**, which are just arbitrary data in edn
7166

7267
```edn
73-
;; file name: my-pachage/my-namespace.edn
68+
;; file name: my-package/my-namespace.edn
7469
{
7570
;; namespace name
7671
ns my-package.my-namespace
@@ -92,18 +87,18 @@ Other keys are names of **models** or **symbols**, which are just arbitrary data
9287

9388
```
9489

95-
Zen project contains one or more edn files with namespaces.
96-
By convention path to file should match namespace name:
90+
Zen project contains one or more edn files with namespaces.
91+
By convention path to file should match namespace name:
9792
i.e. `my/package/model.edn` <-> `my.package.model**
9893

9994
One file should contain only one namespace!
10095

10196
Symbols in zen models are interpreted as references to other models.
10297

10398
To reference symbol in same namespace simple name may be used, zen checker
104-
will interpret it as <current-namespace-name>/<symbol-name>.
99+
will interpret it as `<current-namespace-name>/<symbol-name>`.
105100

106-
To reference symbol from other namespace, full name should be used <other-namespace>/<symbol-name>.
101+
To reference symbol from other namespace, full name should be used `<other-namespace>/<symbol-name>`.
107102
Zen load should check, that referenced namespace is imported and referenced symbol exists in it.
108103

109104
No cyclic references are allowed between namespaces.
@@ -144,7 +139,7 @@ Zen runtime should provide an procedure to load all symbols with specific tag!
144139

145140
## zen/schema
146141

147-
Zen is coming with built-in schema language - `zen/schema`,
142+
Zen is coming with built-in schema language - `zen/schema`,
148143
to describe shape of data in an open way.
149144

150145
zen/schema is a map, where each key is validation instruction.
@@ -165,4 +160,4 @@ Other keys are enabled only for specific "types".
165160

166161
zen/schema engine should validate current schema and all referenced schemas.
167162

168-
`:confirms`
163+
`:confirms`

kaocha.edn

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
#kaocha/v1
2-
{:fail-fast? false
3-
:color? true
2+
{:fail-fast? false
3+
:color? true
44
;; :reporter [kaocha.report/dots]
55
;;:reporter [kaocha.report.progress/report]
6-
:reporter [kaocha.report/documentation]
6+
:reporter [kaocha.report/documentation]
77

8-
:plugins [:hooks
8+
:plugins [:hooks
99
;; :kaocha.plugin/filter
1010
;; :kaocha.plugin/capture-output
11-
:kaocha.plugin/print-invocations
12-
:kaocha.plugin/profiling]
13-
14-
:kaocha.plugin.randomize/randomize? false
15-
:kaocha.plugin.profiling/profiling? true}
11+
:kaocha.plugin/print-invocations
12+
:kaocha.plugin/profiling]
13+
:tests [{:id :unit
14+
:source-paths ["src"]
15+
:test-paths ["test"]
16+
:ns-patterns ["-test$"]}]
17+
:kaocha.plugin.randomize/randomize? false
18+
:kaocha.plugin.profiling/profiling? true}

lib/auth/auth.edn

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/auth/auth/op.edn

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/example/.#myapp.edn

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/example/myapp.edn

Lines changed: 0 additions & 32 deletions
This file was deleted.

pom.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,15 @@
1313
<artifactId>clojure</artifactId>
1414
<version>1.11.1</version>
1515
</dependency>
16-
<dependency>
17-
<groupId>cli-matic</groupId>
18-
<artifactId>cli-matic</artifactId>
19-
<version>0.5.4</version>
20-
</dependency>
2116
<dependency>
2217
<groupId>healthsamurai</groupId>
2318
<artifactId>matcho</artifactId>
24-
<version>0.3.9</version>
19+
<version>0.3.10</version>
2520
</dependency>
2621
<dependency>
2722
<groupId>borkdude</groupId>
2823
<artifactId>edamame</artifactId>
29-
<version>1.0.0</version>
24+
<version>1.3.22</version>
3025
</dependency>
3126
<dependency>
3227
<groupId>hawk</groupId>

src/zen/changes.clj

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
(defn namespace-check [acc old-ztx new-ztx]
88
(let [get-set-of-ns #(set (keys (:ns %)))
9-
109
[lost new same]
1110
(clojure.data/diff (get-set-of-ns @old-ztx)
1211
(get-set-of-ns @new-ztx))]
@@ -20,12 +19,12 @@
2019
:namespace lost-ns}))
2120
lost)
2221
(seq new) (update :changes
23-
into
24-
(map (fn [new-ns]
25-
{:type :namespace/new
26-
:message (str "New namespace: " new-ns)
27-
:namespace new-ns}))
28-
new))))
22+
into
23+
(map (fn [new-ns]
24+
{:type :namespace/new
25+
:message (str "New namespace: " new-ns)
26+
:namespace new-ns}))
27+
new))))
2928

3029

3130
(def core-zen-syms #{'import 'ns 'alias})
@@ -65,12 +64,12 @@
6564
:symbol lost-sym}))
6665
lost)
6766
(seq new) (update :changes
68-
into
69-
(map (fn [new-sym]
70-
{:type :symbol/new
71-
:message (str "New symbol: " new-sym)
72-
:symbol new-sym}))
73-
new))))
67+
into
68+
(map (fn [new-sym]
69+
{:type :symbol/new
70+
:message (str "New symbol: " new-sym)
71+
:symbol new-sym}))
72+
new))))
7473

7574

7675
(defn index-sch-seq [sch-seq]
@@ -112,7 +111,7 @@
112111
:new new}
113112
old)]
114113

115-
(reduce (fn [acc [ch-pth new-el]]
114+
(reduce (fn [acc [_ch-pth new-el]]
116115
(let [{:keys [path]} new-el
117116
change (process-change sym path nil (:value new-el))]
118117
(cond-> acc (some? change) (conj change))))

0 commit comments

Comments
 (0)