2010-10-25 02:49:48 +00:00
|
|
|
(ns test-plugin
|
2010-11-20 18:20:38 +00:00
|
|
|
(:use [leiningen.plugin]
|
|
|
|
[leiningen.util.file :only (unique-lein-tmp-dir
|
|
|
|
delete-file-recursively)]
|
|
|
|
[leiningen.compile :only (platform-nullsink)]
|
|
|
|
[leiningen.core :only (read-project defproject)]
|
|
|
|
[clojure.java.io :only (file)])
|
2010-10-25 02:49:48 +00:00
|
|
|
(:use [clojure.test]))
|
|
|
|
|
|
|
|
(deftest test-plugin-standalone-filename
|
|
|
|
(is (= (plugin-standalone-filename "tehgroup" "tehname" "0.0.1")
|
|
|
|
"tehgroup-tehname-0.0.1.jar"))
|
|
|
|
(is (= (plugin-standalone-filename nil "tehname" "0.0.1")
|
|
|
|
"tehname-0.0.1.jar")))
|
|
|
|
|
|
|
|
(deftest test-extract-name-and-group
|
|
|
|
(is (= (extract-name-and-group "tehgroup/tehname")
|
|
|
|
["tehname" "tehgroup"]))
|
|
|
|
(is (= (extract-name-and-group "tehname")
|
|
|
|
["tehname" nil])))
|
|
|
|
|
2010-10-27 03:36:57 +00:00
|
|
|
(deftest test-help
|
|
|
|
(is (= "Arguments: ([subtask project-name version])
|
|
|
|
Manage user-level plugins.
|
|
|
|
|
|
|
|
Subtasks available:
|
|
|
|
install Download, package, and install plugin jarfile into
|
|
|
|
~/.lein/plugins
|
2010-11-09 04:49:26 +00:00
|
|
|
Syntax: lein plugin install [GROUP/]ARTIFACT-ID VERSION
|
2010-10-27 03:36:57 +00:00
|
|
|
You can use the same syntax here as when listing Leiningen
|
|
|
|
dependencies.
|
|
|
|
uninstall Delete the plugin jarfile
|
2010-11-09 04:49:26 +00:00
|
|
|
Syntax: lein plugin uninstall [GROUP/]ARTIFACT-ID VERSION\n"
|
2010-10-27 03:36:57 +00:00
|
|
|
(with-out-str (plugin "help")))))
|
|
|
|
|
2010-11-20 18:20:38 +00:00
|
|
|
(defonce test-project (read-project "test_projects/sample/project.clj"))
|
|
|
|
|
|
|
|
(deftest test-install
|
|
|
|
(with-out-str
|
|
|
|
(leiningen.install/install test-project)
|
|
|
|
(binding [plugins-path (unique-lein-tmp-dir)
|
|
|
|
leiningen.install/install (constantly nil)]
|
|
|
|
(install "nomnomnom" "0.5.0-SNAPSHOT")
|
|
|
|
(is (.exists (file plugins-path "nomnomnom-0.5.0-SNAPSHOT.jar")))
|
|
|
|
(delete-file-recursively plugins-path))))
|
2010-10-27 03:36:57 +00:00
|
|
|
|