Skip to content

Commit

Permalink
Merge pull request #266 from liquidz/dev
Browse files Browse the repository at this point in the history
Next release
  • Loading branch information
liquidz authored Nov 6, 2024
2 parents ec0903c + 983bdd2 commit d077088
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 30 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ce615373108dfd379ff640264daa8a7fae5810f9 # apply cljstyle
4 changes: 4 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
All notable changes to this project will be documented in this file. This change log follows the conventions of http://keepachangelog.com/[keepachangelog.com].

== Unreleased (dev)
// {{{
=== Added
* https://github.com/liquidz/antq/pull/265[#265]: Added CircleCI support.
// }}}

== 2.10.1241 (2024-09-29)
// {{{
Expand Down
2 changes: 1 addition & 1 deletion build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

(def ^:private config
{:lib 'com.github.liquidz/antq
:version "2.10.{{git/commit-count}}"
:version "2.11.{{git/commit-count}}"
:description "Point out your outdated dependencies"
:licenses [{:name "Eclipse Public License - v 2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}]
Expand Down
11 changes: 6 additions & 5 deletions src/antq/dep/circle_ci.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
(ns antq.dep.circle-ci
(:require
[clojure.java.io :as io]
[clojure.string :as str]
[clj-yaml.core :as yaml]
[antq.record :as r]
[antq.util.dep :as u.dep]
[antq.record :as r]))
[clj-yaml.core :as yaml]
[clojure.java.io :as io]
[clojure.string :as str]))

(defn extract-deps [file-path content-str]
(defn extract-deps
[file-path content-str]
(let [parsed (yaml/parse-string content-str)]
(->> parsed
:orbs
Expand Down
5 changes: 3 additions & 2 deletions src/antq/upgrade/circle_ci.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns antq.upgrade.circle-ci
(:require
[clojure.string :as str]
[antq.upgrade :as upgrade]
[clojure.string :as str]
[rewrite-indented.zip :as ri.zip]))

(defn- update-value
Expand All @@ -10,7 +10,8 @@
(str/replace line #"([^@]+\s*@\s*['\"]?)[^\s'\"]+(['\"]?)"
(str "$1" new-value "$2"))))

(defn upgrade-dep [loc version-checked-dep]
(defn upgrade-dep
[loc version-checked-dep]
(loop [loc loc]
(if-let [loc (ri.zip/find-next-string loc #(re-seq (re-pattern (str "[^:]+\\s*:\\s*" (:name version-checked-dep) "@")) %))]
(recur (-> (ri.zip/update loc (update-value (:latest-version version-checked-dep)))
Expand Down
14 changes: 8 additions & 6 deletions src/antq/ver/circle_ci_orb.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
(ns antq.ver.circle-ci-orb
(:require
[clojure.java.io :as io]
[clojure.string :as str]
[clojure.data.json :as json]
[antq.log :as log]
[antq.ver :as ver]))
[antq.ver :as ver]
[clojure.data.json :as json]
[clojure.java.io :as io]
[clojure.string :as str]))

(defn- orb-id [orb-ns orb-name]
(defn- orb-id
[orb-ns orb-name]
(try
(-> (io/as-url (str "https://internal.circleci.com/api/v2/orbs?ns=" orb-ns "&name=" orb-name))
slurp
Expand All @@ -18,7 +19,8 @@
(log/error (str "Failed to fetch orb id from circleci: "
(.getMessage ex))))))

(defn- orb-versions [id]
(defn- orb-versions
[id]
(try
(-> (io/as-url (str "https://internal.circleci.com/api/v2/orbs/" id))
slurp
Expand Down
6 changes: 3 additions & 3 deletions test/antq/dep/circle_ci_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
(:require
[antq.dep.circle-ci :as sut]
[antq.record :as r]
[clojure.test :as t]
[clojure.java.io :as io]))
[clojure.java.io :as io]
[clojure.test :as t]))

(defn- circle-ci-orb-dependency
[m]
Expand All @@ -18,4 +18,4 @@
(t/is (every? #(instance? antq.record.Dependency %) deps))
(t/is (= #{(circle-ci-orb-dependency {:name "circleci/node" :version "6.3.0"})
(circle-ci-orb-dependency {:name "circleci/docker" :version "2.8.0"})}
(set deps)))))
(set deps)))))
18 changes: 9 additions & 9 deletions test/antq/upgrade/circle_ci_test.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns antq.upgrade.circle-ci-test
(:require
[antq.upgrade :as upgrade]
[antq.upgrade.circle-ci]
[antq.record :as r]
[antq.dep.circle-ci :as dep.circle-ci]
[antq.record :as r]
[antq.test-helper :as h]
[antq.upgrade :as upgrade]
[antq.upgrade.circle-ci]
[clojure.java.io :as io]
[clojure.test :as t]))

Expand All @@ -24,11 +24,11 @@
temp-content (->> node-dep
(upgrade/upgrader))
to-deps (h/with-temp-file
[temp-file temp-content]
(->> (assoc node-dep
:version "7.0.0"
:file temp-file)
(upgrade/upgrader)
(dep.circle-ci/extract-deps "")))]
[temp-file temp-content]
(->> (assoc node-dep
:version "7.0.0"
:file temp-file)
(upgrade/upgrader)
(dep.circle-ci/extract-deps "")))]
(t/is (= #{{:name "circleci/node" :version {:- "6.3.0" :+ "7.0.0"}}}
(h/diff-deps from-deps to-deps))))))
10 changes: 6 additions & 4 deletions test/antq/ver/circle_ci_orb_test.clj
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
(ns antq.ver.circle-ci-orb-test
(:require
[clojure.test :as t]
[antq.record :as r]
[antq.ver :as ver]
[antq.ver.circle-ci-orb :as sut]))
[antq.ver.circle-ci-orb :as sut]
[clojure.test :as t]))

(defn- dep
[m]
(r/map->Dependency (merge {:type :circle-ci-orb} m)))

(defn- orb-id [orb-ns orb-name]
(defn- orb-id
[orb-ns orb-name]
(get-in {"circleci" {"node" "circleci-node-id"}} [orb-ns orb-name]))

(defn- orb-versions [id]
(defn- orb-versions
[id]
(get {"circleci-node-id" ["3.0.0" "2.0.0" "1.0.0"]} id))

(t/deftest get-sorted-versions-test
Expand Down

0 comments on commit d077088

Please sign in to comment.