Skip to content

Instantly share code, notes, and snippets.

@spariev
Created February 2, 2010 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spariev/292556 to your computer and use it in GitHub Desktop.
Save spariev/292556 to your computer and use it in GitHub Desktop.
From cece59d0bb84e4bde30e8062ac4a4217313f3298 Mon Sep 17 00:00:00 2001
From: Sergey Pariev <spariev@gmail.com>
Date: Tue, 2 Feb 2010 12:43:25 +0300
Subject: [PATCH 1/2] support for self-install on Windows using bitsadmin
---
bin/lein.bat | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/bin/lein.bat b/bin/lein.bat
index 2475374..a9d9cdc 100644
--- a/bin/lein.bat
+++ b/bin/lein.bat
@@ -10,12 +10,11 @@ rem and it should be copied on %CLOJURE_JAR% path
set CLOJURE_VERSION=1.1.0
set LEIN_VERSION=1.1.0-SNAPSHOT
-rem uncomment this and set paths explicitly
+rem uncomment this and set paths explicitly
rem set LEIN_JAR=C:\Documents and Settings\wojcirob\.m2\repository\leiningen\leiningen\%LEIN_VERSION%\leiningen-%LEIN_VERSION%-standalone.jar
rem set CLOJURE_JAR=C:\Documents and Settings\wojcirob\.m2\repository\org\clojure\clojure\%CLOJURE_VERSION%\clojure-%CLOJURE_VERSION%.jar
-
-if "x%1" == "xself-install" goto NO_SELF_INSTALL
+if "x%1" == "xself-install" goto SELF_INSTALL
rem it is possible to set LEIN_JAR and CLOJURE_JAR variables manually
rem so we don't overwrite them
@@ -34,7 +33,6 @@ set CLOJURE_JAR=%HOMEDRIVE%%HOMEPATH%\.m2\repository\org\clojure\clojure\%CLOJUR
if not exist "%LEIN_JAR%" goto NO_LEIN_JAR
if not exist "%CLOJURE_JAR%" goto NO_CLOJURE_JAR
-
rem ##################################################
rem count number of command line arguments
rem
@@ -93,13 +91,25 @@ echo or edit lein.bat to set appropriate CLOJURE_JAR path.
echo.
goto EOF
-:NO_SELF_INSTALL
+:SELF_INSTALL
+rem checking for unstable version
+IF "x%LEIN_VERSION:~-8%" == "xSNAPSHOT" goto UNSTABLE_NO_SELF_INSTALL
+
echo.
-echo SELF_INSTALL functionality is not available on Windows
-echo Please download needed JARs manually:
-echo 1. leiningen-%LEIN_VERSION%-standalone.jar from http://repo.technomancy.us/
-echo 2. clojure.jar from http://build.clojure.org/
+echo Downloading Leiningen now...
+set LEIN_JAR=%HOMEDRIVE%%HOMEPATH%\.m2\repository\leiningen\leiningen\%LEIN_VERSION%\leiningen-%LEIN_VERSION%-standalone.jar
+set LEIN_DIR=%HOMEDRIVE%%HOMEPATH%\.m2\repository\leiningen\leiningen\%LEIN_VERSION%
+mkdir %LEIN_DIR%
+set LEIN_URL="http://repo.technomancy.us/leiningen-%LEIN_VERSION%-standalone.jar"
+
+rem tested on Windows 7 Ultimate
+bitsadmin /transfer xnase %LEIN_URL% %LEIN_JAR%
echo.
goto EOF
+:UNSTABLE_NO_SELF_INSTALL
+echo The self-install task is only meant for stable releases.
+echo See the "Hacking" section of the README.
+goto EOF
+
:EOF
--
1.6.5.1.1367.gcd48
From bf9eada3fd6c73cc00882e1ba7cb27ae0abb66fd Mon Sep 17 00:00:00 2001
From: Sergey Pariev <spariev@gmail.com>
Date: Tue, 2 Feb 2010 12:55:56 +0300
Subject: [PATCH 2/2] disable check for CLOJURE_JAR since lein works just fine without it
---
bin/lein.bat | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/bin/lein.bat b/bin/lein.bat
index a9d9cdc..edb30cc 100644
--- a/bin/lein.bat
+++ b/bin/lein.bat
@@ -31,7 +31,7 @@ set CLOJURE_JAR=%HOMEDRIVE%%HOMEPATH%\.m2\repository\org\clojure\clojure\%CLOJUR
:ARGS_HANDLING
if not exist "%LEIN_JAR%" goto NO_LEIN_JAR
-if not exist "%CLOJURE_JAR%" goto NO_CLOJURE_JAR
+rem if not exist "%CLOJURE_JAR%" goto NO_CLOJURE_JAR
rem ##################################################
rem count number of command line arguments
--
1.6.5.1.1367.gcd48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment