Skip to content

Commit

Permalink
windows environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Wolfe authored and technomancy committed Jan 2, 2010
1 parent 815adb8 commit 5e9f694
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
52 changes: 52 additions & 0 deletions bin/lein.bat
@@ -0,0 +1,52 @@
@echo off

rem this script works after downloading Leiningen standalone jar
rem from http://repo.technomancy.us/
rem and copying it on %LEIN_JAR% path
rem There is needed also Clojure jar from http://build.clojure.org/
rem and it should be copied on %CLOJURE_JAR% path


set CLOJURE_VERSION=1.1.0-alpha-SNAPSHOT
set LEIN_VERSION=1.0.1-SNAPSHOT
set LEIN_JAR=%HOMEDRIVE%%HOMEPATH%\.m2\repository\leiningen\leiningen\%LEIN_VERSION%\leiningen-%LEIN_VERSION%-standalone.jar
set CLOJURE_JAR=%HOMEDRIVE%%HOMEPATH%\.m2\repository\org\clojure\clojure\%CLOJURE_VERSION%\clojure-%CLOJURE_VERSION%.jar

rem ##################################################
rem count number of command line arguments
rem
set ARGCOUNT=0
for %%a in (%*) do set /a ARGCOUNT+=1
rem ##################################################


rem ##################################################
rem add jars found under "lib" directory to CLASSPATH
rem
setLocal EnableDelayedExpansion
set CLASSPATH="
for /R ./lib %%a in (*.jar) do (
set CLASSPATH=!CLASSPATH!;%%a
)
set CLASSPATH=!CLASSPATH!"

set CLASSPATH=%CLASSPATH%;"%LEIN_JAR%"
if "%DEBUG%" == "" goto :RUN
echo CLASSPATH=%CLASSPATH%
rem ##################################################

:RUN
if "%ARGCOUNT%" == "2" goto :RUN_ARG2
if "%ARGCOUNT%" == "3" goto :RUN_ARG3
java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\")"
goto :EOF

:RUN_ARG2
java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\")"
goto :EOF

:RUN_ARG3
java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\" \"%3\")"
goto :EOF

:EOF
8 changes: 6 additions & 2 deletions src/leiningen/jar.clj
Expand Up @@ -22,13 +22,17 @@
(str "Main-Class: " main))])
"\n")))))

(defn unix-path [path]
(.replaceAll path "\\\\" "/"))

(defmulti copy-to-jar (fn [project jar-os spec] (:type spec)))

(defmethod copy-to-jar :path [project jar-os spec]
(doseq [child (file-seq (file (:path spec)))]
(when-not (.isDirectory child)
(let [path (str child)
path (re-sub (re-pattern (str "^" (:root project))) "" path)
(let [path (unix-path (str child))
path (re-sub (re-pattern (str "^" (unix-path (:root project))))
"" path)
path (re-sub #"^/resources" "" path)
path (re-sub #"^/classes" "" path)
path (re-sub #"^/src" "" path)
Expand Down

0 comments on commit 5e9f694

Please sign in to comment.