From f69de91e181bbcdb78b832071aa48048b7beaecf Mon Sep 17 00:00:00 2001 From: Sergey Sobko Date: Fri, 15 Feb 2019 19:45:25 +0300 Subject: [PATCH] Write initial tests and update dependencies --- .gitignore | 1 + flower-common/project.clj | 8 +- flower-common/src/flower/credentials.clj | 5 +- flower-integration-default/project.clj | 8 +- flower-integration-exchange/project.clj | 8 +- flower-integration-github/project.clj | 8 +- flower-integration-gitlab/project.clj | 8 +- .../src/flower/repository/gitlab/pr.clj | 5 +- flower-integration-jira/project.clj | 8 +- flower-integration-slack/project.clj | 8 +- flower-integration-tfs/project.clj | 8 +- .../src/flower/tracker/tfs/common.clj | 3 +- .../src/flower/tracker/tfs/task.clj | 4 +- flower-messaging/project.clj | 8 +- flower-proto/project.clj | 8 +- flower-repository/project.clj | 8 +- .../src/flower/repository/core.clj | 4 +- .../test/flower/repository/core_test.clj | 47 +++++++++++ flower-team/project.clj | 8 +- flower-tracker/project.clj | 8 +- flower-tracker/src/flower/tracker/core.clj | 4 +- .../test/flower/tracker/core_test.clj | 77 +++++++++++++++++++ flower-utilities/project.clj | 8 +- flower-utilities/src/flower/util/tracker.clj | 7 +- lein-template/project.clj | 8 +- .../leiningen/new/flower/project.clj | 2 +- project.clj | 4 +- 27 files changed, 206 insertions(+), 77 deletions(-) create mode 100644 flower-repository/test/flower/repository/core_test.clj create mode 100644 flower-tracker/test/flower/tracker/core_test.clj diff --git a/.gitignore b/.gitignore index c1a8a8a..332e57c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ pom.xml.asc .lein-* .nrepl-port .idea +.eastwood diff --git a/flower-common/project.clj b/flower-common/project.clj index 2aa17e9..c9555a0 100644 --- a/flower-common/project.clj +++ b/flower-common/project.clj @@ -4,18 +4,18 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/core.memoize "0.7.1"] [com.cemerick/pomegranate "1.1.0"] [lambdaisland/uri "1.1.0"] [cprop "0.1.13"] [trptcolin/versioneer "0.2.0"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-common/src/flower/credentials.clj b/flower-common/src/flower/credentials.clj index 1c4c2b1..bf79660 100644 --- a/flower-common/src/flower/credentials.clj +++ b/flower-common/src/flower/credentials.clj @@ -1,5 +1,6 @@ (ns flower.credentials (:require [clojure.java.io :as io] + [clojure.string :as string] [cprop.core :as cprop] [cprop.source])) @@ -9,8 +10,8 @@ ;; (def ^:dynamic *credentials-file* - (clojure.string/join "/" [(System/getProperty "user.home") - ".credentials.edn"])) + (string/join "/" [(System/getProperty "user.home") + ".credentials.edn"])) ;; diff --git a/flower-integration-default/project.clj b/flower-integration-default/project.clj index e368556..1a6eb53 100644 --- a/flower-integration-default/project.clj +++ b/flower-integration-default/project.clj @@ -4,16 +4,16 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/core.async "0.4.490"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-integration-exchange/project.clj b/flower-integration-exchange/project.clj index 8e063f8..7e8bb2b 100644 --- a/flower-integration-exchange/project.clj +++ b/flower-integration-exchange/project.clj @@ -4,20 +4,20 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :eastwood {:exclude-namespaces [flower.messaging.exchange.async]} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} :repositories {"atlassian-public" "https://maven.atlassian.com/content/repositories/atlassian-public/" "sonatype" "https://oss.sonatype.org/content/repositories/releases"} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/core.async "0.4.490"] [com.microsoft.ews-java-api/ews-java-api "2.0"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-integration-github/project.clj b/flower-integration-github/project.clj index f1e8fbf..f3be70f 100644 --- a/flower-integration-github/project.clj +++ b/flower-integration-github/project.clj @@ -4,19 +4,19 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} :repositories {"eclipse-releases" "https://repo.eclipse.org/content/groups/releases/"} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [com.google.code.gson/gson "2.8.5"] [org.eclipse.mylyn.github/org.eclipse.egit.github.core "4.9.0.201710071750-r"] [clj-time "0.15.1"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-integration-gitlab/project.clj b/flower-integration-gitlab/project.clj index eaf0e8a..53e4658 100644 --- a/flower-integration-gitlab/project.clj +++ b/flower-integration-gitlab/project.clj @@ -4,19 +4,19 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} :repositories {"sonatype" "https://oss.sonatype.org/content/repositories/releases"} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [joda-time/joda-time "2.10.1"] [org.gitlab/java-gitlab-api "4.1.0"] [clj-time "0.15.1"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-integration-gitlab/src/flower/repository/gitlab/pr.clj b/flower-integration-gitlab/src/flower/repository/gitlab/pr.clj index 9464968..0a6a512 100644 --- a/flower-integration-gitlab/src/flower/repository/gitlab/pr.clj +++ b/flower-integration-gitlab/src/flower/repository/gitlab/pr.clj @@ -1,5 +1,6 @@ (ns flower.repository.gitlab.pr - (:require [flower.macros :as macros] + (:require [clojure.string :as string] + [flower.macros :as macros] [flower.repository.proto :as proto] [flower.repository.gitlab.common :as common]) (:import (java.io FileNotFoundException) @@ -162,7 +163,7 @@ project-id (.getId project-inner) changes (common/get-gitlab-changes-inner repository pull-request) flat-list (map (fn [diff] - (let [splitted (clojure.string/split (.getDiff diff) #"\n") + (let [splitted (string/split (.getDiff diff) #"\n") grouped (group-by first splitted) added (count (get grouped \+ [])) deleted (count (get grouped \- []))] diff --git a/flower-integration-jira/project.clj b/flower-integration-jira/project.clj index 0609c69..5240c3e 100644 --- a/flower-integration-jira/project.clj +++ b/flower-integration-jira/project.clj @@ -4,16 +4,16 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} :repositories {"atlassian-public" "https://maven.atlassian.com/content/repositories/atlassian-public/" "eclipse-releases" "https://repo.eclipse.org/content/groups/releases/"} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/core.memoize "0.7.1"] [joda-time/joda-time "2.10.1"] [org.slf4j/slf4j-api "1.7.25"] @@ -23,5 +23,5 @@ [clj-time "0.15.1"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-integration-slack/project.clj b/flower-integration-slack/project.clj index cfd341e..181d134 100644 --- a/flower-integration-slack/project.clj +++ b/flower-integration-slack/project.clj @@ -4,19 +4,19 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/core.async "0.4.490"] [org.clojure/data.json "0.2.6"] [org.julienxx/clj-slack "0.6.2"] [stylefruits/gniazdo "1.1.1"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-integration-tfs/project.clj b/flower-integration-tfs/project.clj index 5d9ff78..45a4ead 100644 --- a/flower-integration-tfs/project.clj +++ b/flower-integration-tfs/project.clj @@ -4,19 +4,19 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/data.json "0.2.6"] [joda-time/joda-time "2.10.1"] [clj-http "3.9.1"] [clj-time "0.15.1"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-integration-tfs/src/flower/tracker/tfs/common.clj b/flower-integration-tfs/src/flower/tracker/tfs/common.clj index ea9f5d4..b5fa55b 100644 --- a/flower-integration-tfs/src/flower/tracker/tfs/common.clj +++ b/flower-integration-tfs/src/flower/tracker/tfs/common.clj @@ -1,5 +1,6 @@ (ns flower.tracker.tfs.common (:require [clj-http.client :as client] + [clojure.string :as string] [clojure.data.json :as json] [flower.macros :as macros] [flower.tracker.proto :as proto])) @@ -60,7 +61,7 @@ (defn- private-get-tfs-workitems-inner [tracker task-ids] (if-not (empty? (filter identity task-ids)) - (let [query-string {:ids (clojure.string/join "," task-ids) + (let [query-string {:ids (string/join "," task-ids) :$expand "relations"}] (with-tfs-function tracker false ("/_apis/wit/workitems") query-string :value result)))) diff --git a/flower-integration-tfs/src/flower/tracker/tfs/task.clj b/flower-integration-tfs/src/flower/tracker/tfs/task.clj index 6445952..5052c29 100644 --- a/flower-integration-tfs/src/flower/tracker/tfs/task.clj +++ b/flower-integration-tfs/src/flower/tracker/tfs/task.clj @@ -74,7 +74,7 @@ (let [{task-url :url relation-type :rel} relation] (if task-url - (let [task-id (last (clojure.string/split task-url #"/"))] + (let [task-id (last (string/split task-url #"/"))] (update acc relation-type (fn [acc workitem] (if workitem (conj acc workitem) @@ -107,7 +107,7 @@ (into {} (map (fn [[key value]] [key (if (= key :task-tags) - (clojure.string/join "; " (sort value)) + (string/join "; " (sort value)) value)]) tags))) diff --git a/flower-messaging/project.clj b/flower-messaging/project.clj index 99c8db8..71eda37 100644 --- a/flower-messaging/project.clj +++ b/flower-messaging/project.clj @@ -4,16 +4,16 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [com.stuartsierra/component "0.4.0"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-proto/project.clj b/flower-proto/project.clj index e3f5627..ffab7fe 100644 --- a/flower-proto/project.clj +++ b/flower-proto/project.clj @@ -4,13 +4,13 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :dependencies [[org.clojure/clojure "1.10.0"]] + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-repository/project.clj b/flower-repository/project.clj index d576fed..8a38934 100644 --- a/flower-repository/project.clj +++ b/flower-repository/project.clj @@ -4,17 +4,17 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [com.stuartsierra/component "0.4.0"] [tesser.core "1.0.3"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-repository/src/flower/repository/core.clj b/flower-repository/src/flower/repository/core.clj index bd180e6..f9b01ed 100644 --- a/flower-repository/src/flower/repository/core.clj +++ b/flower-repository/src/flower/repository/core.clj @@ -36,12 +36,12 @@ (let [repo-projects-list (or repo-projects (list nil))] [repo-name (map #((resolver/resolve-implementation repo-type :repository) (let [[repo-project & repo-reversed-ns] (-> % - (clojure.string/split #"/") + (string/split #"/") reverse) repo-ns (if repo-reversed-ns (->> repo-reversed-ns reverse - (clojure.string/join #"/")) + (string/join #"/")) repo-ns)] {:repository-component repository-component :repo-name repo-name diff --git a/flower-repository/test/flower/repository/core_test.clj b/flower-repository/test/flower/repository/core_test.clj new file mode 100644 index 0000000..3a651d9 --- /dev/null +++ b/flower-repository/test/flower/repository/core_test.clj @@ -0,0 +1,47 @@ +(ns flower.repository.core-test + (:require [clojure.test :as test] + [flower.repository.core :as repository.core])) + + +(test/deftest test-repository-info + (test/testing "Getting repository info" + (test/testing "for GitHub" + (test/is (= (repository.core/get-repository-info "https://github.com/PositiveTechnologies/flower") + {:repo-type :github + :repo-url "https://github.com/PositiveTechnologies" + :repository-ns nil + :repo-projects ["PositiveTechnologies/flower"] + :repo-name :github-github.com-flower})) + (test/is (= (repository.core/get-repository-info "https://github.com/example/test") + {:repo-type :github + :repo-url "https://github.com/example" + :repository-ns nil + :repo-projects ["example/test"] + :repo-name :github-github.com-test}))) + + (test/testing "for GitLab" + (test/is (= (repository.core/get-repository-info "https://gitlab.com/example/test") + {:repo-type :gitlab + :repo-url "https://gitlab.com" + :repository-ns nil + :repo-projects ["example/test"] + :repo-name :gitlab-gitlab.com-test})) + (test/is (= (repository.core/get-repository-info "https://gitlab.example.com/example/test") + {:repo-type :gitlab + :repo-url "https://gitlab.example.com" + :repository-ns nil + :repo-projects ["example/test"] + :repo-name :gitlab-gitlab.example.com-test})) + (test/is (= (repository.core/with-repository-type :gitlab + (repository.core/get-repository-info "https://hello.example.com/example/test")) + {:repo-type :gitlab + :repo-url "https://hello.example.com" + :repository-ns nil + :repo-projects ["example/test"] + :repo-name :gitlab-hello.example.com-test}))) + + (test/testing "unrecognized" + (test/is (= (repository.core/get-repository-info "https://hello.example.com/example/test") + {:repo-type :default + :repo-name :default-hello.example.com + :repo-url "https://hello.example.com"}))))) diff --git a/flower-team/project.clj b/flower-team/project.clj index 571ffbd..ae11f5c 100644 --- a/flower-team/project.clj +++ b/flower-team/project.clj @@ -4,13 +4,13 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :dependencies [[org.clojure/clojure "1.10.0"]] + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-tracker/project.clj b/flower-tracker/project.clj index 407eb64..3b3585e 100644 --- a/flower-tracker/project.clj +++ b/flower-tracker/project.clj @@ -4,16 +4,16 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [com.stuartsierra/component "0.4.0"] [flower/flower-common "0.4.6-SNAPSHOT"] [flower/flower-proto "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-tracker/src/flower/tracker/core.clj b/flower-tracker/src/flower/tracker/core.clj index 89b2280..b2f29bc 100644 --- a/flower-tracker/src/flower/tracker/core.clj +++ b/flower-tracker/src/flower/tracker/core.clj @@ -27,12 +27,12 @@ (let [tracker-projects-list (or tracker-projects (list nil)) tracker-pair [tracker-name (map #((resolver/resolve-implementation tracker-type :tracker) (let [[tracker-project & tracker-reversed-ns] (-> % - (clojure.string/split #"/") + (string/split #"/") reverse) tracker-ns (if tracker-reversed-ns (->> tracker-reversed-ns reverse - (clojure.string/join #"/")) + (string/join #"/")) tracker-ns)] {:tracker-component tracker-component :tracker-name tracker-name diff --git a/flower-tracker/test/flower/tracker/core_test.clj b/flower-tracker/test/flower/tracker/core_test.clj new file mode 100644 index 0000000..b32de40 --- /dev/null +++ b/flower-tracker/test/flower/tracker/core_test.clj @@ -0,0 +1,77 @@ +(ns flower.tracker.core-test + (:require [clojure.test :as test] + [flower.tracker.core :as tracker.core])) + + +(test/deftest test-tracker-info + (test/testing "Getting tracker info" + (test/testing "for GitHub" + (test/is (= (tracker.core/get-tracker-info "https://github.com/PositiveTechnologies/flower") + {:tracker-type :github + :tracker-url "https://github.com/PositiveTechnologies" + :tracker-ns nil + :tracker-projects ["PositiveTechnologies/flower"] + :tracker-name :github-github.com-flower})) + (test/is (= (tracker.core/get-tracker-info "https://github.com/example/test") + {:tracker-type :github + :tracker-url "https://github.com/example" + :tracker-ns nil + :tracker-projects ["example/test"] + :tracker-name :github-github.com-test}))) + + (test/testing "for GitLab" + (test/is (= (tracker.core/get-tracker-info "https://gitlab.com/example/test") + {:tracker-type :gitlab + :tracker-url "https://gitlab.com" + :tracker-ns nil + :tracker-projects ["example/test"] + :tracker-name :gitlab-gitlab.com-test})) + (test/is (= (tracker.core/get-tracker-info "https://gitlab.example.com/example/test") + {:tracker-type :gitlab + :tracker-url "https://gitlab.example.com" + :tracker-ns nil + :tracker-projects ["example/test"] + :tracker-name :gitlab-gitlab.example.com-test})) + (test/is (= (tracker.core/with-tracker-type :gitlab + (tracker.core/get-tracker-info "https://hello.example.com/example/test")) + {:tracker-type :gitlab + :tracker-url "https://hello.example.com" + :tracker-ns nil + :tracker-projects ["example/test"] + :tracker-name :gitlab-hello.example.com-test}))) + + (test/testing "for Jira" + (test/is (= (tracker.core/get-tracker-info "https://jira.example.com/browse/TEST") + {:tracker-type :jira + :tracker-url "https://jira.example.com" + :tracker-ns nil + :tracker-projects ["TEST"] + :tracker-name :jira-jira.example.com-TEST})) + (test/is (= (tracker.core/with-tracker-type :jira + (tracker.core/get-tracker-info "https://hello.example.com/browse/TEST")) + {:tracker-type :jira + :tracker-url "https://hello.example.com" + :tracker-ns nil + :tracker-projects ["TEST"] + :tracker-name :jira-hello.example.com-TEST}))) + + (test/testing "for TFS" + (test/is (= (tracker.core/get-tracker-info "https://tfs.example.com/tfs/Example/TEST") + {:tracker-type :tfs + :tracker-url "https://tfs.example.com/tfs/Example" + :tracker-ns nil + :tracker-projects ["Example/TEST"] + :tracker-name :tfs-tfs.example.com-TEST})) + (test/is (= (tracker.core/with-tracker-type :tfs + (tracker.core/get-tracker-info "https://hello.example.com/tfs/Example/TEST")) + {:tracker-type :tfs + :tracker-url "https://hello.example.com/tfs/Example" + :tracker-ns nil + :tracker-projects ["Example/TEST"] + :tracker-name :tfs-hello.example.com-TEST}))) + + (test/testing "unrecognized" + (test/is (= (tracker.core/get-tracker-info "https://hello.example.com/example/test") + {:tracker-type :default + :tracker-name :default-hello.example.com + :tracker-url "https://hello.example.com"}))))) diff --git a/flower-utilities/project.clj b/flower-utilities/project.clj index 2917c4d..59ed3a1 100644 --- a/flower-utilities/project.clj +++ b/flower-utilities/project.clj @@ -4,17 +4,17 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [org.clojure/core.memoize "0.7.1"] [com.orgzly/org-java "1.2.2"] [org.jsoup/jsoup "1.11.3"] [flower/flower-tracker "0.4.6-SNAPSHOT"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}}) diff --git a/flower-utilities/src/flower/util/tracker.clj b/flower-utilities/src/flower/util/tracker.clj index b5d0c10..480d84d 100644 --- a/flower-utilities/src/flower/util/tracker.clj +++ b/flower-utilities/src/flower/util/tracker.clj @@ -1,5 +1,6 @@ (ns flower.util.tracker - (:require [flower.macros :as macros] + (:require [clojure.string :as string] + [flower.macros :as macros] [flower.common :as common] [flower.credentials :as credentials] [flower.tracker.core :as tracker.core] @@ -48,8 +49,8 @@ (defn- replace-title-for-org-mode-links [title] (-> title - (clojure.string/replace #"\[" "{") - (clojure.string/replace #"\]" "}"))) + (string/replace #"\[" "{") + (string/replace #"\]" "}"))) (defn- get-task-info-str [task long-version] diff --git a/lein-template/project.clj b/lein-template/project.clj index 2be1b08..869bf18 100644 --- a/lein-template/project.clj +++ b/lein-template/project.clj @@ -4,14 +4,14 @@ :scm {:dir ".."} :license {:name "MIT License" :url "https://opensource.org/licenses/MIT"} - :plugins [[jonase/eastwood "0.2.5"] + :plugins [[jonase/eastwood "0.3.5"] [lein-cljfmt "0.5.7"] [lein-bump-version "0.1.6"]] :cljfmt {:remove-consecutive-blank-lines? false} :aliases {"lint" ["do" ["cljfmt" "check"] ["eastwood"]] - "test-all" ["with-profile" "default:+1.7:+1.8" "test"] + "test-all" ["with-profile" "default:+1.9:+1.8" "test"] "lint-and-test-all" ["do" ["lint"] ["test-all"]]} - :dependencies [[org.clojure/clojure "1.9.0"]] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :dependencies [[org.clojure/clojure "1.10.0"]] + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}} :eval-in-leiningen true) diff --git a/lein-template/resources/leiningen/new/flower/project.clj b/lein-template/resources/leiningen/new/flower/project.clj index 3b29d09..ab5f3a1 100644 --- a/lein-template/resources/leiningen/new/flower/project.clj +++ b/lein-template/resources/leiningen/new/flower/project.clj @@ -1,7 +1,7 @@ (defproject {{name}} "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [flower "0.4.5"]] :main ^:skip-aot {{name}}.core :target-path "target/%s" diff --git a/project.clj b/project.clj index 3ea76c4..ad230e4 100644 --- a/project.clj +++ b/project.clj @@ -6,7 +6,7 @@ :plugins [[lein-sub "0.3.0"] [lein-ancient "0.6.15"] [lein-bump-version "0.1.6"]] - :dependencies [[org.clojure/clojure "1.9.0"] + :dependencies [[org.clojure/clojure "1.10.0"] [flower/flower-tracker "0.4.6-SNAPSHOT"] [flower/flower-repository "0.4.6-SNAPSHOT"] [flower/flower-messaging "0.4.6-SNAPSHOT"] @@ -36,6 +36,6 @@ "flower-team" "flower-utilities" "lein-template"] - :profiles {:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} + :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]} :dev {:dependencies [[org.clojure/tools.namespace "0.2.11"]]}})