Skip to content

Commit 75e7b31

Browse files
committed
bump script
1 parent 7837c4f commit 75e7b31

3 files changed

Lines changed: 35 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,17 @@ You can also take a look at a [comprehensive comparison](http://time4j.net/tutor
6262

6363
## Usage
6464

65-
Add the following dependency to your `deps.edn`
65+
Add the following dependency to your `deps.edn`:
6666
```clj
6767
clojure.java-time/clojure.java-time {:mvn/version "1.0.0"}
6868
```
6969

7070
or to your `project.clj` or `build.boot`:
71-
7271
```clj
7372
[clojure.java-time "1.0.0"]
7473
```
7574

76-
The [API](https://dm3.github.io/clojure.java-time/) of the Clojure.Java-Time
75+
The [API](https://dm3.github.io/clojure.java-time) of the Clojure.Java-Time
7776
consists of one namespace, namely `java-time.api`. For the purposes of this guide,
7877
we will `require` the main namespace:
7978

bin/sync-readme-version.clj

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bb
2+
(ns sync-readme-version
3+
(:require [clojure.string :as str]))
4+
5+
(def project-version-prefix "(defproject clojure.java-time \"")
6+
(def project-version-suffix "\"")
7+
(def project-version (some #(when (and (str/starts-with? % project-version-prefix)
8+
(str/ends-with? % project-version-suffix))
9+
(subs % (count project-version-prefix) (- (count %) (count project-version-suffix))))
10+
(str/split-lines (slurp "project.clj"))))
11+
(assert project-version "Could not determine project version")
12+
(def replace-version-around
13+
(volatile!
14+
#{{:prefix "clojure.java-time/clojure.java-time {:mvn/version \""
15+
:suffix "\"}"}
16+
{:prefix "[clojure.java-time \""
17+
:suffix "\"]"}}))
18+
(spit "README.md"
19+
(str/join "\n"
20+
(map (fn [s]
21+
(if-some [matching (first (filter #(and (str/starts-with? s (:prefix %))
22+
(str/ends-with? s (:suffix %)))
23+
@replace-version-around))]
24+
(do (vswap! replace-version-around disj matching)
25+
(str (:prefix matching) project-version (:suffix matching)))
26+
s))
27+
(str/split-lines (slurp "README.md")))))
28+
(assert (empty? @replace-version-around)
29+
(str "Failed to replace: " @replace-version-around))

project.clj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
:username :env/clojars_user
1919
:password :env/clojars_token
2020
:sign-releases false}]]
21+
:plugins [[lein-codox "0.10.8"]
22+
[lein-shell "0.5.0"]
23+
[jonase/eastwood "1.2.3"]]
2124
:release-tasks [["clean"]
2225
["vcs" "assert-committed"]
2326
["change" "version" "leiningen.release/bump-version" "release"]
2427
["doc"]
28+
["shell" "./bin/sync-readme-version.clj"]
2529
["vcs" "commit"]
2630
["vcs" "tag" "--no-sign"]
2731
["deploy" "release"]
@@ -34,9 +38,6 @@
3438
[org.clojure/tools.namespace "1.3.0"]
3539
[joda-time/joda-time ~joda-time-version]
3640
[org.threeten/threeten-extra ~threeten-extra-version]]
37-
:plugins [[lein-codox "0.10.8"]
38-
[jonase/eastwood "1.2.3"]]
39-
4041
:source-paths ["dev"]
4142
:global-vars {*warn-on-reflection* true}
4243
:eastwood {:exclude-namespaces [java-time

0 commit comments

Comments
 (0)