Skip to content

Commit

Permalink
Fix argument order for install & plugin install.
Browse files Browse the repository at this point in the history
This was breaking installs of things like
org.clojars.trptcolin/libthrift (where the group ID had
periods).
  • Loading branch information
trptcolin committed Dec 11, 2010
1 parent a8349c1 commit a4a517b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/leiningen/install.clj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ from a remote repository. May place shell wrappers in ~/.lein/bin."
(let [[name group] ((juxt name namespace) (symbol project-name))
_ (standalone-download name (or group name) version)
temp-project (format "%s/lein-%s" tmp-dir (UUID/randomUUID))
jarfile (-> (local-repo-path name (or group name) version)
jarfile (-> (local-repo-path (or group name) name version)
(.replace "$HOME" (System/getProperty "user.home")))]
(install-shell-wrappers (JarFile. jarfile))
;; TODO: use lancet/unjar?
Expand Down
2 changes: 1 addition & 1 deletion src/leiningen/plugin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Syntax: lein plugin install [GROUP/]ARTIFACT-ID VERSION
(.mkdirs plugins-path)
(let [[name group] (extract-name-and-group project-name)
temp-project (file tmp-dir (str "lein-" (java.util.UUID/randomUUID)))
jarfile (-> (local-repo-path name (or group name) version)
jarfile (-> (local-repo-path (or group name) name version)
(.replace "$HOME" (System/getProperty "user.home")))
_ (extract-jar (file jarfile) temp-project)
project (read-project (str (file temp-project "project.clj")))
Expand Down
19 changes: 19 additions & 0 deletions test/test_install.clj
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,22 @@
(install "nomnomnom" "0.5.0-SNAPSHOT")
(is (not (empty? (.listFiles jdom-dir))))
(is (.exists unix-shell-wrapper)))

(defonce test-project-tricky-name (read-project "test_projects/tricky-name/project.clj"))
(def tricky-m2-dir (file local-repo "org" "domain" "tricky-name" "1.0"))
(def tricky-unix-shell-wrapper (file (home-dir) "bin" "tricky-name"))
(def tricky-windows-shell-wrapper (file (home-dir) "bin" "tricky-name.bat"))
(defn delete-tricky-shell-wrappers []
(.delete tricky-unix-shell-wrapper)
(.delete tricky-windows-shell-wrapper))

(deftest test-tricky-name-install
(delete-file-recursively tricky-m2-dir true)
(delete-shell-wrappers)
(install test-project-tricky-name)
(install "org.domain/tricky-name" "1.0")
(is (not (empty? (.listFiles tricky-m2-dir))))
(is (.exists tricky-unix-shell-wrapper))
(if (= :windows (get-os))
(is (.exists tricky-windows-shell-wrapper))
(is (not (.exists tricky-windows-shell-wrapper)))))

0 comments on commit a4a517b

Please sign in to comment.