From b17731b7486b73861b54cc2f6f67768774440e46 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Mon, 30 Aug 2010 22:11:18 -0700 Subject: [PATCH] Failing test case for standalone-install bug. --- src/leiningen/install.clj | 1 + test/test_install.clj | 15 ++++++++++++--- test_projects/sample/project.clj | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/leiningen/install.clj b/src/leiningen/install.clj index d79847e3..49450d34 100644 --- a/src/leiningen/install.clj +++ b/src/leiningen/install.clj @@ -18,6 +18,7 @@ (when-let [bin-name ((manifest-map (.getManifest jarfile)) "Leiningen-shell-wrapper")] (let [bin-file (file (bin-path) (last (.split bin-name "/")))] + (.mkdirs (.getParentFile bin-file)) (println "Installing shell wrapper to" (.getAbsolutePath bin-file)) (copy (.getInputStream jarfile (.getEntry jarfile bin-name)) bin-file) (.setExecutable bin-file true)))) diff --git a/test/test_install.clj b/test/test_install.clj index 8cc565aa..7f730fba 100644 --- a/test/test_install.clj +++ b/test/test_install.clj @@ -1,12 +1,13 @@ (ns test-install - (:use [leiningen.core :only [read-project defproject]] + (:use [leiningen.core :only [read-project defproject home-dir]] [leiningen.install] :reload-all) (:use [clojure.test] [clojure.contrib.io :only [delete-file-recursively file]] [clojure.contrib.shell :only [with-sh-dir sh]])) -(def m2-dir (file (System/getProperty "user.home") ".m2" "repository" - "nomnomnom" "nomnomnom" "0.5.0-SNAPSHOT")) +(def local-repo (file (System/getProperty "user.home") ".m2" "repository")) + +(def m2-dir (file local-repo "nomnomnom" "nomnomnom" "0.5.0-SNAPSHOT")) (defonce test-project (read-project "test_projects/sample/project.clj")) @@ -14,3 +15,11 @@ (delete-file-recursively m2-dir true) (install test-project) (is (not (empty? (.listFiles m2-dir))))) + +(def jdom-dir (file local-repo "jdom" "jdom" "1.0")) + +(deftest test-standalone-install + (delete-file-recursively jdom-dir true) + (install "nomnomnom" "0.5.0-SNAPSHOT") + (is (not (empty? (.listFiles jdom-dir)))) + (is (.exists (file (home-dir) "bin" "nom")))) diff --git a/test_projects/sample/project.clj b/test_projects/sample/project.clj index 4ad01d63..c5c6a008 100644 --- a/test_projects/sample/project.clj +++ b/test_projects/sample/project.clj @@ -6,6 +6,7 @@ (def clj-version "1.1.0-master-SNAPSHOT") (defproject nomnomnom "0.5.0-SNAPSHOT" + :description "A test project" :dependencies [[~(symbol "org.clojure" "clojure") ~clj-version] [rome/rome ~(str "0." "9")] [org.ccil.cowan.tagsoup/tagsoup "1.2"]]