1 | | diff --git a/bin/lein b/bin/lein |
2 | | index 21eef64..26f655e 100755 |
3 | | --- a/bin/lein |
4 | | +++ b/bin/lein |
5 | | @@ -1,5 +1,6 @@ |
6 | | #!/bin/sh |
7 | | |
8 | | +PREFIX=__PREFIX__ |
9 | | export LEIN_VERSION="1.3.1" |
10 | | |
11 | | case $LEIN_VERSION in |
12 | | @@ -31,14 +32,15 @@ do |
13 | | done |
14 | | |
15 | | if [ "$LEIN_HOME" = "" ]; then |
16 | | - LEIN_HOME="$HOME/.lein" |
17 | | + LEIN_HOME="$PREFIX/share/java/leiningen" |
18 | | fi |
19 | | |
20 | | +CLASSPATH="$(find -H $PREFIX -name \*.jar 2> /dev/null -print0 | tr \\0 \:)" |
21 | | LEIN_PLUGINS="$(ls -1 lib/dev/*jar 2> /dev/null | tr \\n \:)" |
22 | | LEIN_USER_PLUGINS="$(ls -1 $LEIN_HOME/plugins/*jar 2> /dev/null | tr \\n \:)" |
23 | | CLASSPATH=$LEIN_USER_PLUGINS:$LEIN_PLUGINS:src/:$CLASSPATH |
24 | | LEIN_JAR="$HOME/.m2/repository/leiningen/leiningen/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar" |
25 | | -CLOJURE_JAR="$HOME/.m2/repository/org/clojure/clojure/1.2.0/clojure-1.2.0.jar" |
26 | | +CLOJURE_JAR="$PREFIX/share/java/clojure/lib/clojure.jar" |
27 | | NULL_DEVICE=/dev/null |
28 | | |
29 | | # normalize $0 on certain BSDs |
30 | | @@ -87,82 +89,38 @@ fi |
31 | | |
32 | | JAVA_CMD=${JAVA_CMD:-"java"} |
33 | | |
34 | | -# If you're packaging this for a package manager (.deb, homebrew, etc) |
35 | | -# you need to remove the self-install and upgrade functionality. |
36 | | -if [ "$1" = "self-install" ]; then |
37 | | - echo "Downloading Leiningen now..." |
38 | | - LEIN_DIR=`dirname "$LEIN_JAR"` |
39 | | - mkdir -p "$LEIN_DIR" |
40 | | - LEIN_URL="http://github.com/downloads/technomancy/leiningen/leiningen-$LEIN_VERSION-standalone.jar" |
41 | | - $HTTP_CLIENT "$LEIN_JAR" "$LEIN_URL" |
42 | | - if [ $? != 0 ]; then |
43 | | - echo "Failed to download $LEIN_URL" |
44 | | - if [ $SNAPSHOT = "YES" ]; then |
45 | | - echo "See README.md for SNAPSHOT build instructions." |
46 | | - fi |
47 | | - rm $LEIN_JAR |
48 | | - exit 1 |
49 | | - fi |
50 | | -elif [ "$1" = "upgrade" ]; then |
51 | | - if [ $SNAPSHOT = "YES" ]; then |
52 | | - echo "The upgrade task is only meant for stable releases." |
53 | | - echo "See the \"Hacking\" section of the README." |
54 | | - exit 1 |
55 | | - fi |
56 | | - if [ ! -w "$SCRIPT" ]; then |
57 | | - echo "You do not have permission to upgrade the installation in $SCRIPT" |
58 | | - exit 1 |
59 | | - else |
60 | | - echo "The script at $SCRIPT will be upgraded to the latest stable version." |
61 | | - echo -n "Do you want to continue [Y/n]? " |
62 | | - read RESP |
63 | | - case "$RESP" in |
64 | | - y|Y|"") |
65 | | - echo |
66 | | - echo "Upgrading..." |
67 | | - LEIN_SCRIPT_URL="http://github.com/technomancy/leiningen/raw/stable/bin/lein" |
68 | | - $HTTP_CLIENT "$SCRIPT" "$LEIN_SCRIPT_URL" \ |
69 | | - && chmod +x "$SCRIPT" \ |
70 | | - && echo && $SCRIPT self-install && echo && echo "Now running" `$SCRIPT version` |
71 | | - exit $?;; |
72 | | - *) |
73 | | - echo "Aborted." |
74 | | - exit 1;; |
75 | | - esac |
76 | | - fi |
77 | | -else |
78 | | - if [ "$OSTYPE" = "cygwin" ]; then |
79 | | - # When running on Cygwin, use Windows-style paths for java |
80 | | - CLOJURE_JAR=`cygpath -w "$CLOJURE_JAR"` |
81 | | - CLASSPATH=`cygpath -wp "$CLASSPATH"` |
82 | | - NULL_DEVICE=NUL |
83 | | - fi |
84 | | +if [ "$OSTYPE" = "cygwin" ]; then |
85 | | + # When running on Cygwin, use Windows-style paths for java |
86 | | + CLOJURE_JAR=`cygpath -w "$CLOJURE_JAR"` |
87 | | + CLASSPATH=`cygpath -wp "$CLASSPATH"` |
88 | | + NULL_DEVICE=NUL |
89 | | +fi |
90 | | |
91 | | - if [ $DEBUG ]; then |
92 | | - echo $CLASSPATH |
93 | | - echo $CLOJURE_JAR |
94 | | - fi |
95 | | +if [ $DEBUG ]; then |
96 | | + echo $CLASSPATH |
97 | | + echo $CLOJURE_JAR |
98 | | +fi |
99 | | |
100 | | - if ([ "$1" = "repl" ] || [ "$1" = "interactive" ] || [ "$1" = "int" ]) && |
101 | | - [ -z $INSIDE_EMACS ] && [ "$TERM" != "dumb" ]; then |
102 | | - # Use rlwrap if it's available, otherwise fall back to JLine |
103 | | - RLWRAP=`which rlwrap` |
104 | | - if [ $? -eq 1 ]; then |
105 | | - JLINE=jline.ConsoleRunner |
106 | | - if [ "$OSTYPE" = "cygwin" ]; then |
107 | | - JLINE="-Djline.terminal=jline.UnixTerminal jline.ConsoleRunner" |
108 | | - CYGWIN_JLINE=y |
109 | | - fi |
110 | | +if ([ "$1" = "repl" ] || [ "$1" = "interactive" ] || [ "$1" = "int" ]) && |
111 | | + [ -z $INSIDE_EMACS ] && [ "$TERM" != "dumb" ]; then |
112 | | + # Use rlwrap if it's available, otherwise fall back to JLine |
113 | | + RLWRAP=`which rlwrap` |
114 | | + if [ $? -eq 1 ]; then |
115 | | + JLINE=jline.ConsoleRunner |
116 | | + if [ "$OSTYPE" = "cygwin" ]; then |
117 | | + JLINE="-Djline.terminal=jline.UnixTerminal jline.ConsoleRunner" |
118 | | + CYGWIN_JLINE=y |
119 | | fi |
120 | | fi |
121 | | - |
122 | | - # The -Xbootclasspath argument is optional here: if the jar |
123 | | - # doesn't exist everything will still work, it will just have a |
124 | | - # slower JVM boot. |
125 | | - # TODO: add more to the boot classpath |
126 | | - test $CYGWIN_JLINE && stty -icanon min 1 -echo |
127 | | - exec $RLWRAP $JAVA_CMD -Xbootclasspath/a:"$CLOJURE_JAR" -client $JAVA_OPTS \ |
128 | | - -cp "$CLASSPATH" $JLINE clojure.main -e "(use 'leiningen.core)(-main)" \ |
129 | | - $NULL_DEVICE $@ |
130 | | - test $CYGWIN_JLINE && stty icanon echo |
131 | | fi |
132 | | + |
133 | | +# The -Xbootclasspath argument is optional here: if the jar |
134 | | +# doesn't exist everything will still work, it will just have a |
135 | | +# slower JVM boot. |
136 | | +# TODO: add more to the boot classpath |
137 | | +test $CYGWIN_JLINE && stty -icanon min 1 -echo |
138 | | +exec $RLWRAP $JAVA_CMD -Xbootclasspath/a:"$CLOJURE_JAR" -client $JAVA_OPTS \ |
139 | | + -cp "$CLASSPATH" $JLINE clojure.main -e "(use 'leiningen.core)(-main)" \ |
140 | | + $NULL_DEVICE $@ |
141 | | +test $CYGWIN_JLINE && stty icanon echo |
142 | | + |