Advertisement
Guest User

anars

a guest
Apr 10th, 2010
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. @echo off
  2.  
  3. rem this script works after downloading Leiningen standalone jar
  4. rem from http://repo.technomancy.us/
  5. rem and copying it on %LEIN_JAR% path
  6. rem There is needed also Clojure jar from http://build.clojure.org/
  7. rem and it should be copied on %CLOJURE_JAR% path
  8.  
  9.  
  10. set CLOJURE_VERSION=1.1.0
  11. set LEIN_VERSION=1.1.0
  12.  
  13. rem uncomment this and set paths explicitly
  14. set LEIN_JAR=C:\Users\Anders\Applications\leiningen\lein-standalone.jar
  15. set CLOJURE_JAR=C:\Users\Anders\Applications\clojure\clojure-%CLOJURE_VERSION%.jar
  16.  
  17.  
  18. if "x%1" == "xself-install" goto NO_SELF_INSTALL
  19.  
  20. rem it is possible to set LEIN_JAR and CLOJURE_JAR variables manually
  21. rem so we don't overwrite them
  22. if "x%LEIN_JAR%" == "x" goto SET_LEIN
  23. goto ARGS_HANDLING
  24. if "x%CLOJURE_JAR%" == "x" goto SET_CLOJURE
  25. goto ARGS_HANDLING
  26.  
  27. :SET_LEIN
  28. rem set LEIN_JAR=C:\Users\Anders\.m2\repository\leiningen\leiningen\%LEIN_VERSION%\leiningen-%LEIN_VERSION%-standalone.jar
  29.  
  30. :SET_CLOJURE
  31. rem set CLOJURE_JAR=C:\Users\Anders\.m2\repository\org\clojure\clojure\%CLOJURE_VERSION%\clojure-%CLOJURE_VERSION%.jar
  32.  
  33. :ARGS_HANDLING
  34. if not exist "%LEIN_JAR%" goto NO_LEIN_JAR
  35. if not exist "%CLOJURE_JAR%" goto NO_CLOJURE_JAR
  36.  
  37.  
  38. rem ##################################################
  39. rem count number of command line arguments
  40. rem
  41. set ARGCOUNT=0
  42. for %%a in (%*) do set /a ARGCOUNT+=1
  43. rem ##################################################
  44.  
  45.  
  46. rem ##################################################
  47. rem add jars found under "lib" directory to CLASSPATH
  48. rem
  49. setLocal EnableDelayedExpansion
  50. set CLASSPATH="
  51. for /R ./lib %%a in (*.jar) do (
  52. set CLASSPATH=!CLASSPATH!;%%a
  53. )
  54. set CLASSPATH=!CLASSPATH!"
  55.  
  56. set CLASSPATH=%CLASSPATH%;"%LEIN_JAR%"
  57. if "x%DEBUG%" == "x" goto RUN
  58. echo CLASSPATH=%CLASSPATH%
  59. rem ##################################################
  60.  
  61. :RUN
  62. if "x%1" == "xrepl" goto RUN_REPL
  63. if "%ARGCOUNT%" == "2" goto RUN_ARG2
  64. if "%ARGCOUNT%" == "3" goto RUN_ARG3
  65. java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\")"
  66. goto EOF
  67.  
  68. :RUN_ARG2
  69. java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\")"
  70. goto EOF
  71.  
  72. :RUN_ARG3
  73. java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp %CLASSPATH% clojure.main -e "(use 'leiningen.core) (-main \"%1\" \"%2\" \"%3\")"
  74. goto EOF
  75.  
  76. :RUN_REPL
  77. java -Xbootclasspath/a:"%CLOJURE_JAR%" -client -cp src;classes;%CLASSPATH% clojure.main %2 %3 %4
  78. goto EOF
  79.  
  80. :NO_LEIN_JAR
  81. echo.
  82. echo "%LEIN_JAR%" can not be found.
  83. echo Please change LEIN_JAR environment variable
  84. echo or edit lein.bat to set appropriate LEIN_JAR path.
  85. echo.
  86. goto EOF
  87.  
  88. :NO_CLOJURE_JAR
  89. echo.
  90. echo "%CLOJURE_JAR%" can not be found.
  91. echo Please change CLOJURE_JAR environment variable
  92. echo or edit lein.bat to set appropriate CLOJURE_JAR path.
  93. echo.
  94. goto EOF
  95.  
  96. :NO_SELF_INSTALL
  97. echo.
  98. echo SELF_INSTALL functionality is not available on Windows
  99. echo Please download needed JARs manually:
  100. echo 1. leiningen-%LEIN_VERSION%-standalone.jar from http://repo.technomancy.us/
  101. echo 2. clojure.jar from http://build.clojure.org/
  102. echo.
  103. goto EOF
  104.  
  105. :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement