Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated doc, fixed some bugs, added clj based tests

  • Loading branch information...
commit ebf74eb27197f56d405964364d854755695485f5 1 parent 43f84ed
@russolsen authored
Showing with 73 additions and 27 deletions.
  1. +37 −13 README.textile
  2. +6 −8 bin/clj
  3. +30 −6 build.xml
View
50 README.textile
@@ -1,26 +1,26 @@
-h2. Dejure
+h2. Dejour
-Dejure provides an easy, 'works out of the box' for the Clojure programming language. Clojure is a function LISP JVM hosted variant that is great for concurrent programming. You can find the clojure source and original downloads at http://clojure.org/.
+Dejour provides an easy, 'works out of the box' experience for the Clojure programming language. Clojure is a function LISP JVM hosted variant that is great for concurrent programming. You can find the clojure source and original downloads at http://clojure.org/.
-Unfortunately, while clojure.org provides the superb Clojure language as well as clojure-contrib, which is a set of useful libraries, there are a few things missing. The most important missing bit is a script that will run Clojure. Also missing is the very useful jline, which provides you with command editing when you are running the interactive clojure interpreter.
+Unfortunately, while clojure.org provides the superb Clojure language as well as clojure-contrib (a set of useful libraries) there are a few things missing. The most important missing bit is a script that will run Clojure. Also missing is the very useful jline, which provides you with command editing when you are running the interactive clojure interpreter or REPL.
-The Dejure project pulls all of this together in a single easy to get, easy to install download. Dejure currently works on Linux and Macs, with a windows version coming soon.
+The Dejour project pulls all of this together in a single easy to get, easy to install download. Dejour currently works on Linux and Macs, and windows.
-h2. Installing Dejure
+h2. Installing Dejour
-Installing Dejure is a very simple project: Just download the latest Dejure archive from:
+Step one is to download the latest Dejour jar or zip from:
http://github.com/russolsen/dejour/downloads
-Then unpack it into the directory of your choice. You will end up with a directory with a name like dejure-1.1.0. Inside that directory is a bin directory, containing a script, clj. If you run the script with no parameters, clj will bring up the interactive clojure 'interpreter': You can simply type in clojure code and immediately see the results. Alternatively, if you supply clj with the name of a clojure script, it will run that script.
+Step two is to unpack Dejuour. You will end up with a directory with a name like dejour-1.1.0. Inside that directory is a bin directory, containing a Linux/Mac script, clj as well as a couple of Windows executables. If you are running on Linux or a Mac, you can run clojure by running the clj script. If you are on windows you have a choice of clj.exe which will run clojure with a console or cljw.exe which will run clojure without a console.
-h2. Examples
-
-Dejure also comes with some simple examples of Clojure code from my "Clojure, the least you need to know" talk. You will find these in the examples subdirectory.
+There is no step three.
h2. Using the clj script
-The clj script is designed to be as simple for beginners to use as it can be, but it is capable of doing more elaborate things. Here are the arguments that clj understands:
+If you run the script with no parameters, clj will bring up the interactive clojure 'interpreter': You can simply type in clojure code and immediately see the results. Alternatively, if you supply clj with the name of a clojure script, it will run that script.
+
+The clj script and executable are designed to be as simple for beginners to use as it can be, but it is capable of doing more elaborate things. Here are the arguments that clj understands:
* -debug Just print out the java command and exit.
@@ -46,12 +46,36 @@ The clj script is designed to be as simple for beginners to use as it can be, bu
* -- Treat everything that follows as a clojure argument
-Dejure will use the java program indicated by JAVA_HOME or from your path. If you have both, JAVA_HOME wins.
+Dejour is also location independant. It will run out of where every you decide to unpack it, no environment variables required. The only external dependancy that Dejour has is on Java: It assumes that there is a java command in your path, or that JAVA_HOME is set.
+
+Dejour will use the java program indicated by JAVA_HOME or from your path. If you have both, JAVA_HOME wins.
+
+h2. Examples
+
+If you just want the clojure REPL (i.e. interactive shell), simply run the clj (or clj.exe on Windows).
+
+If you want to execute a file full of clojure code, call out the file on after clj:
+
+ clj my-clojure-code.clj
+
+If you want to pass arguments to your clojure script, just hang them on the end of the command:
+
+ clj my-clojure-code.clj some arguments
+
+If you need to pass a -D or -X argument to java, put it before the clojure file:
+
+ clj -Xmx500M -DFoo=bar my-clojure-code.clj some arguments
+
+If you have other java VM arguments, you can pass them in via the -J option:
+
+ clj -J -d32
+
+Dejour also comes with some simple examples of Clojure code from my "Clojure, the least you need to know" talk. You will find these in the examples subdirectory.
h2. Contributors
-Dejure was created by "Russ Olsen":http://github.com/russolsen and is, of course, based on Clojure, clojure-contrib and jline. Much of the clj script was hamelessly stolen from the Jruby startup script,jruby.sh. Also borrowed some code from Mark Reid's clj script.
+Dejour was created by "Russ Olsen":http://github.com/russolsen and is, of course, based on Clojure, clojure-contrib and jline. Much of the clj script was hamelessly stolen from the Jruby startup script,jruby.sh. Also borrowed some code from Mark Reid's clj script.
See my website at "russolsen.com":http://www.russolsen.com
View
14 bin/clj
@@ -41,6 +41,8 @@ arg_check() {
add_to_path() {
if [ -z "$1" ]; then
echo $2
+ elif [ -z "$2" ]; then
+ echo $1
else
echo $1$3$2
fi
@@ -105,11 +107,9 @@ CP_DELIMITER=":"
# Pick up all the jar files in dejour/lib
-LIB_DIR_CP=""
+LIB_DIR_CP="$CLOJURE_LIB"
for jarfile in `find "$CLOJURE_LIB" -name "*.jar"`; do
- if [ "$jarfile" != "$CLOJURE_JAR" ]; then
- LIB_DIR_CP=`add_to_path "$USER_CP" "$jarfile" $CP_DELIMITER`
- fi
+ LIB_DIR_CP=`add_to_path "$USER_CP" "$jarfile" $CP_DELIMITER`
done
# Process all the - flags that this script understands
@@ -221,10 +221,8 @@ else
fi
CLOJURE_CP="$CORE_CP"
-echo "clojure_cp: $CLOJURE_CP"
-if [ ! -z "$LIB_DIR_CP" ] ; then
- CLOJURE_CP=`add_to_path "$CLOJURE_CP" "$LIB_DIR_CP" $CP_DELIMITER`
-fi
+
+CLOJURE_CP=`add_to_path "$CLOJURE_CP" "$LIB_DIR_CP" $CP_DELIMITER`
CLOJURE_CP=`add_to_path "$CLOJURE_CP" "$USER_CP" $CP_DELIMITER`
View
36 build.xml
@@ -1,12 +1,15 @@
<project name="dejour" basedir="." default="all">
+ <property environment="env"/>
+
<property name="clojure-version" value="1.1.0" />
<property name="clojure-contrib-version" value="1.1.0" />
<property name="jline-version" value="0.9.94" />
- <property name="dejour-version" value="${clojure-version}" />
+ <property name="dejour-version" value="${clojure-version}a" />
- <property name="staging-dir" value="build/dejour-${dejour-version}"/>
+ <property name="staging-dir" value="${basedir}/build/dejour-${dejour-version}"/>
+ <property name="test-dir" value="${basedir}/test"/>
<target name="init">
<mkdir dir="${staging-dir}"/>
@@ -14,6 +17,10 @@
<mkdir dir="${staging-dir}/cljlib"/>
</target>
+ <target name="clj.exe" depends="init">
+ <exec dir="c_src" executable="make"/>
+ </target>
+
<target name="clojure.zip" depends="init" unless="skip.download">
<get src="http://clojure.googlecode.com/files/clojure-${clojure-version}.zip"
dest="build/clojure.zip" />
@@ -50,15 +57,22 @@
<target name="downloaded-jars"
depends="clojure.jar,clojure-contrib.jar,jline.jar" />
- <target name="build.dejour" depends="downloaded-jars">
+ <target name="build.dejour" depends="downloaded-jars,clj.exe">
<copy todir="${staging-dir}" >
<fileset dir="${basedir}" includes="bin/**/*"/>
<fileset dir="${basedir}" includes="examples/**/*"/>
</copy>
+ <copy file="c_src/clj.exe" todir="${staging-dir}/bin"/>
+ <copy file="c_src/cljw.exe" todir="${staging-dir}/bin"/>
<chmod file="${staging-dir}/bin/clj" perm="ugo+x"/>
</target>
- <target name="all" depends="dejour.tar"/>
+ <target name="all" depends="dejour.tar,dejour.zip"/>
+
+ <target name="dejour.zip" depends="build.dejour">
+ <zip destfile="build/dejour-${dejour-version}.zip" basedir="build"
+ includes="dejour-${dejour-version}/**/*"/>
+ </target>
<target name="dejour.tar" depends="build.dejour">
<tar destfile="build/dejour-${dejour-version}.tar">
@@ -73,11 +87,21 @@
</target>
<target name="test">
- <exec dir="test/unix" failonerror="true" executable="clj_tests"/>
+ <java fork="true" failonerror="true" classname="clojure.main">
+ <env key="PATH" value="${staging-dir}/bin${path.separator}${env.PATH}"/>
+ <classpath>
+ <fileset dir="${staging-dir}/cljlib">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ <arg value="${test-dir}/dejour-tests.clj"/>
+ </java>
</target>
-
<target name="clean">
<delete dir="build" />
+ <exec dir="c_src" executable="make">
+ <arg value="clean"/>
+ </exec>
</target>
</project>
Please sign in to comment.
Something went wrong with that request. Please try again.