Skip to content

Commit bdd0abf

Browse files
committed
feat: adds initial project structure
1 parent 7df345f commit bdd0abf

File tree

10 files changed

+279
-14
lines changed

10 files changed

+279
-14
lines changed

.github/workflows/tests.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Tests
2+
3+
# Controls when the action will run.
4+
on:
5+
# Triggers the workflow on push or pull request events but only for the main branch
6+
pull_request:
7+
branches: [ main ]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
jobs:
13+
14+
tests:
15+
16+
strategy:
17+
matrix:
18+
operating-system: [ubuntu-latest]
19+
20+
runs-on: ${{ matrix.operating-system }}
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
26+
- name: Prepare java
27+
uses: actions/setup-java@v3
28+
with:
29+
distribution: 'adopt'
30+
java-version: '11'
31+
32+
- name: Install clojure cli
33+
uses: DeLaGuardo/setup-clojure@master
34+
with:
35+
cli: 1.11.1.1273
36+
37+
- name: Cache Maven packages
38+
uses: actions/cache@v3
39+
with:
40+
path: ~/.m2
41+
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }}
42+
restore-keys: ${{ runner.os }}-m2
43+
44+
- name: Execute clojure code
45+
run: clojure -M:dev:test
46+
47+
check-lint:
48+
49+
strategy:
50+
matrix:
51+
operating-system: [ubuntu-latest]
52+
53+
runs-on: ${{ matrix.operating-system }}
54+
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v3
58+
59+
- name: Install clojure cli
60+
uses: DeLaGuardo/setup-clojure@master
61+
with:
62+
cli: 1.11.1.1273
63+
64+
- name: Setup clojure-lsp
65+
uses: clojure-lsp/setup-clojure-lsp@v1
66+
with:
67+
clojure-lsp-version: 2023.04.19-12.43.29
68+
69+
- name: Execute lint checks
70+
run: |
71+
clojure-lsp format --dry
72+
clojure-lsp clean-ns --dry
73+
clojure-lsp diagnostics
74+
75+
security:
76+
77+
strategy:
78+
matrix:
79+
operating-system: [ubuntu-latest]
80+
81+
runs-on: ${{ matrix.operating-system }}
82+
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v3
86+
87+
- name: Scan
88+
uses: clj-holmes/clj-holmes-action@main
89+
with:
90+
output-type: 'stdout'
91+
fail-on-result: 'true'

.gitignore

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1-
pom.xml
2-
pom.xml.asc
3-
*.jar
4-
*.class
5-
/lib/
6-
/classes/
7-
/target/
8-
/checkouts/
9-
.lein-deps-sum
10-
.lein-repl-history
11-
.lein-plugins/
12-
.lein-failures
1+
.calva/output-window/
2+
.classpath
3+
.clj-kondo/.cache
4+
.cpcache
5+
.eastwood
6+
.factorypath
7+
.hg/
8+
.hgignore
9+
.java-version
10+
.lein-*
11+
.lsp/.cache
12+
.lsp/sqlite.db
13+
.nrepl-history
1314
.nrepl-port
14-
.cpcache/
15+
.project
16+
.rebel_readline_history
17+
.settings
18+
.socket-repl-port
19+
.sw*
20+
.vscode
21+
*.class
22+
*.jar
23+
*.swp
24+
*~
25+
/checkouts
26+
/classes
27+
/target

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,27 @@
1-
# docs.extractor
1+
# codes.clj.docs/extractor
2+
23
Tool to extract namespace/functions documentation from Clojure projects into indexed Datalevin file.
4+
5+
# CLI
6+
7+
## Extract and generate datalevin file
8+
```bash
9+
clojure -X:extract
10+
```
11+
12+
## Update version of the configured projects in the config file
13+
```bash
14+
clojure -X:update
15+
```
16+
17+
# Developing
18+
19+
## Repl
20+
```bash
21+
clojure -M:dev:nrepl
22+
```
23+
24+
## Tests
25+
```bash
26+
clojure -M:dev:test
27+
```

build.clj

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
(ns build
2+
(:refer-clojure :exclude [test])
3+
(:require [clojure.tools.build.api :as b]))
4+
5+
(def default-lib 'codes.clj.docs/extractor)
6+
(def default-main 'codes.clj.docs.extractor)
7+
(def default-version "0.0.1-SNAPSHOT")
8+
(def class-dir "target/classes")
9+
10+
(defn- uber-opts [{:keys [lib main uber-file version] :as opts}]
11+
(let [actual-lib (or lib default-lib)
12+
actual-main (or main default-main)
13+
actual-version (or version default-version)
14+
actual-uber-file (or uber-file (format "target/%s-%s.jar"
15+
actual-lib
16+
actual-version))]
17+
(assoc opts
18+
:lib actual-lib
19+
:main actual-main
20+
:uber-file actual-uber-file
21+
:basis (b/create-basis {})
22+
:class-dir class-dir
23+
:src-dirs ["src"]
24+
:ns-compile [actual-main])))
25+
26+
(defn uberjar "Build the Uberjar." [opts]
27+
(b/delete {:path "target"})
28+
(let [{:keys [main uber-file] :as opts} (uber-opts opts)]
29+
(println "\nCopying source" class-dir)
30+
(b/copy-dir {:src-dirs ["resources" "src"] :target-dir class-dir})
31+
(println (str "\nCompiling " main))
32+
(b/compile-clj opts)
33+
(println "\nBuilding JAR on" uber-file)
34+
(b/uber opts))
35+
opts)

deps.edn

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{:paths ["src" "resources"]
2+
:deps {org.clojure/clojure {:mvn/version "1.11.1"}
3+
org.clojure/tools.deps {:mvn/version "0.18.1335"}
4+
clj-kondo/clj-kondo {:mvn/version "2023.04.14"}
5+
datalevin/datalevin {:mvn/version "0.8.14"}
6+
com.cognitect/transit-clj {:mvn/version "1.0.333"}}
7+
:aliases
8+
{:extract {:ns-default codes.clj.docs.extractor
9+
:exec-fn extract!}
10+
:update {:ns-default codes.clj.docs.extractor
11+
:exec-fn update!}
12+
13+
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.4"}}
14+
:ns-default build
15+
:exec-args {:uber-file "target/extractor.jar"}}
16+
17+
:dev {:extra-paths ["test" "test-resources"]
18+
:extra-deps {lambdaisland/kaocha {:mvn/version "1.82.1306"}
19+
lambdaisland/kaocha-cloverage {:mvn/version "1.1.89"}
20+
nubank/mockfn {:mvn/version "0.7.0"}
21+
nubank/matcher-combinators {:mvn/version "3.8.5"}}}
22+
23+
:nrepl {:extra-deps {cider/cider-nrepl {:mvn/version "0.30.0"}}
24+
:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]"]}
25+
26+
:test {:main-opts ["-m" "kaocha.runner"]
27+
:jvm-opts ["-Xms3g" "-Xmx3g"]}}}

pom.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>codes.clj.docs</groupId>
5+
<artifactId>extractor</artifactId>
6+
<version>0.1.0-SNAPSHOT</version>
7+
<name>codes.clj.docs/extractor</name>
8+
<description>FIXME: my new application.</description>
9+
<url>https://github.com/codes.clj.docs/extractor</url>
10+
<licenses>
11+
<license>
12+
<name>Eclipse Public License</name>
13+
<url>http://www.eclipse.org/legal/epl-v10.html</url>
14+
</license>
15+
</licenses>
16+
<developers>
17+
<developer>
18+
<name>Rafael.delboni</name>
19+
</developer>
20+
</developers>
21+
<scm>
22+
<url>https://github.com/codes.clj.docs/extractor</url>
23+
<connection>scm:git:git://github.com/codes.clj.docs/extractor.git</connection>
24+
<developerConnection>scm:git:ssh://git@github.com/codes.clj.docs/extractor.git</developerConnection>
25+
<tag>v0.1.0-SNAPSHOT</tag>
26+
</scm>
27+
<dependencies>
28+
<dependency>
29+
<groupId>org.clojure</groupId>
30+
<artifactId>clojure</artifactId>
31+
<version>1.11.1</version>
32+
</dependency>
33+
</dependencies>
34+
<build>
35+
<sourceDirectory>src</sourceDirectory>
36+
</build>
37+
<repositories>
38+
<repository>
39+
<id>clojars</id>
40+
<url>https://repo.clojars.org/</url>
41+
</repository>
42+
<repository>
43+
<id>sonatype</id>
44+
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
45+
</repository>
46+
</repositories>
47+
<distributionManagement>
48+
<repository>
49+
<id>clojars</id>
50+
<name>Clojars repository</name>
51+
<url>https://clojars.org/repo</url>
52+
</repository>
53+
</distributionManagement>
54+
</project>

resources/.keep

Whitespace-only changes.

src/codes/clj/docs/extractor.clj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(ns codes.clj.docs.extractor
2+
(:gen-class))
3+
4+
(defn extract!
5+
"Extract data from configured projects and generate Datalevin file."
6+
[_data]
7+
(println "extract!"))
8+
9+
(defn update!
10+
"Update the file with version/hashs of the configured projects."
11+
[_data]
12+
(println "update!"))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(ns codes.clj.docs.extractor-test
2+
(:require [clojure.test :refer :all]
3+
[codes.clj.docs.extractor :refer :all]))
4+
5+
(deftest a-test
6+
(testing "FIXME, I fail."
7+
(is (= 0 1))))

tests.edn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#kaocha/v1 {}

0 commit comments

Comments
 (0)