Skip to content

Commit

Permalink
dynamically create snapshots and update snapshot readme
Browse files Browse the repository at this point in the history
  • Loading branch information
somecho committed Jul 3, 2023
1 parent afc2efe commit 8db5150
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 720 deletions.
19 changes: 14 additions & 5 deletions generate.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
(def INPUT-FOLDER "test/resources/input/")
(def SNAPSHOTS-FOLDER "test/resources/snapshots/")
(def FILES ["project.clj" "deps.edn" "bb.edn" "shadow-cljs.edn"])
(def TARGETS ["add-reagent-1.2.0" "add-multiple"])
; (def TARGETS ["add-reagent-1.2.0" "add-multiple"])
(def TARGETS [{:name "add-reagent-1.2.0"
:commands ["add" "reagent@1.2.0"]}
{:name "add-multiple"
:commands ["add" "reagent@1.2.0" "org.clojure/java.jdbc@0.7.12"]}])

(defn setup-directories []
(mapv #(io/make-parents (str SNAPSHOTS-FOLDER % "/FILE")) TARGETS))
(mapv #(io/make-parents (str SNAPSHOTS-FOLDER (:name %) "/FILE")) TARGETS))

(defn create-snapshot
[input-file target-folder & commands]
Expand All @@ -23,7 +27,12 @@
(println "Setting up snapshot directories")
(setup-directories)
(println "Creating snapshots")
(println "add-reagent-1.2.0 snapshots")
(mapv #(create-snapshot % "add-reagent-1.2.0" "add" "reagent@1.2.0") FILES)
(mapv #(create-snapshot % "add-multiple" "add" "reagent@1.2.0" "org.clojure/java.jdbc@0.7.12") FILES)
(doall
(for [{:keys [name commands]} TARGETS]
(do (println name "snapshots")
(mapv #(apply create-snapshot (concat [% name] commands)) FILES))))
; (println "Creating snapshots")
; (println "add-reagent-1.2.0 snapshots")
; (mapv #(create-snapshot % "add-reagent-1.2.0" "add" "reagent@1.2.0") FILES)
; (mapv #(create-snapshot % "add-multiple" "add" "reagent@1.2.0" "org.clojure/java.jdbc@0.7.12") FILES)
(println "All snapshots have been created"))
6 changes: 2 additions & 4 deletions test/resources/snapshots/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
This directory contains snapshots created for the end-to-end tests. The
snapshots have to be updated regularly to keep the tests up-to-date.

### Directory structure
- update-all - snapshots of the `update` command
snapshots have to be updated regularly to keep the tests up-to-date. Snapshots
are [generated programmatically](../../../generate.clj).

### Generating snapshots
```bash
Expand Down
19 changes: 0 additions & 19 deletions test/resources/temp/add-multiple/bb.edn

This file was deleted.

234 changes: 0 additions & 234 deletions test/resources/temp/add-multiple/deps.edn

This file was deleted.

53 changes: 0 additions & 53 deletions test/resources/temp/add-multiple/project.clj

This file was deleted.

Loading

0 comments on commit 8db5150

Please sign in to comment.