Re: Getting started with open source Clojure projects

2010-03-31 Thread Daniel
Thanks for all the quick replies. I should've mentioned that I'm
already using leiningen, so the problem isn't so much getting the
dependencies and building the application as it is figuring out a way
to get inside the code and play with it a bit. I'd like to be able to
load the source files, execute member functions, and just get a feel
for what's going on internally. What sort of method do you all use for
exploring open source projects? Do you just read the source code, or
do you load it and test it out?

Thanks,

Daniel

On Mar 30, 6:50 pm, Matt macourt...@gmail.com wrote:
 If you're not stuck on using Compojure, you can try Conjure which will
 includes all of the dependencies in the jar.

 To start a hello world app:

 1. Download conjure.jar from:http://github.com/macourtney/Conjure/downloads
 2. java -jar conjure.jar hello_world
 3. cd hello_world
 4. ./run.sh script/server.clj
 5. Point your browser athttp://localhost:8080/
 6. Profit!

 There is a tutorial for Conjure 
 at:http://wiki.github.com/macourtney/Conjure/hello-world-tutorial-2

 -Matt Courtney

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using remove me as the subject.


Re: Getting started with open source Clojure projects

2010-03-30 Thread Mark J. Reed
On Mon, Mar 29, 2010 at 11:39 PM, Daniel cotter.dan...@gmail.com wrote:
 Is there a less cumbersome way to get a load of files on the classpath
 than manually editing the .clojure file?

Well, I have a ~/lib/clojure directory and a clj script that
automatically puts that directory and all .jar's in it on the
classpath.  Linux version:

#!/bin/bash
: ${CLOJURE_LIB:=${HOME}/lib/clojure}
export 
CLASSPATH=${CLASSPATH:+$CLASSPATH:}$HOME/lib/java/clojure.jar:$CLOJURE_LIB
if [ -d $CLOJURE_LIB ]; then
for f in $CLOJURE_LIB/*.jar; do
   if [ -r $f ]; then
CLASSPATH=$CLASSPATH:$f
  fi
done
fi
rlwrap java clojure.main $@


The actual java invocation can of course be replaced to e.g. use JLine
instead of rlwrap; I use the latter because JLine doesn't seem to have
a vi mode.  (Yes, I know, vi user in a Lispy language - heretical!)

-- 
Mark J. Reed markjr...@gmail.com

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Getting started with open source Clojure projects

2010-03-30 Thread Alex Osborne
Daniel cotter.dan...@gmail.com writes:

 Am I going about this the wrong way? Is there an easier way to explore
 existing open-source projects? I

Try this for any leiningen project (check for the existence of a
project.clj file).  I'm assuming you're using a unixy operating system.

First and once-off, install leiningen:
  
  wget http://github.com/technomancy/leiningen/raw/stable/bin/lein
  chmod a+x lein
  ./lein self-install

Clone target project (in this case Compojure):
  
  git clone git://github.com/weavejester/compojure.git
  cd compojure

Ask Lein to download Compojure's dependencies (this includes Clojure,
you don't need to it install it manually):

  ../lein deps

Fire up a repl:

  ../lein repl

  Clojure 1.1.0
  user= (use 'compojure.core)
  nil

Alternatively if you're using Java 6 you can start the REPL without any
wrapper script pretty easily.  I prefer to do it this way as it makes it
obvious what the classpath is and allows tweaking the JVM options (for
example increasing the memory limit with -Xmx256m).

  java -cp 'lib/*:classes:src' clojure.main

  Clojure 1.1.0
  user= (use 'compojure.core)
  nil

 Is there a less cumbersome way to get a load of files on the classpath
 than manually editing the .clojure file?

Note the wildcard 'lib/*' notation I used above.  This was added in Java
6.  Be aware that it has to be some/directory/* not *.jar, foo* or any
other variation.  Put it in single quotes to make sure your shell
doesn't try and expand it.  It'll add any jar files found in the
directory to the classpath.

Hope that helps.

Alex

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


RE: Getting started with open source Clojure projects

2010-03-30 Thread Kevin
 So here are my questions:
 
 Am I going about this the wrong way? Is there an easier way 
 to explore existing open-source projects? I Is there a less 
 cumbersome way to get a load of files on the classpath than 
 manually editing the .clojure file? How do I tell the REPL 
 where to find response.clj so that core.clj will load?

For Compojure I think you need also Ring: http://github.com/mmcgrana/ring
(also a mailing list here: http://groups.google.com/group/ring-clojure)

There's been a lot of activity there recently, various projects
refactoring in terms of each other, and that seems to be where
they're ending up.  I don't know too much about it, but I did run
through the code and examples just yesterday.

The other thing is: leiningen.  http://github.com/technomancy/leiningen
A lot of projects are using it, and it's dead simple dependency management.
Download the project, look for the project.clj file, run 'lein deps' 
in that directory, and you get all needed dependency jars loaded into
a 'lib' subdirectory. 

cheers,
Kevin Kelley

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Getting started with open source Clojure projects

2010-03-30 Thread Stuart Sierra
Take a look at the dependency management tools.  Most open-source
Clojure projects use either Maven and Leiningen.  Both use the same
dependency model and provide similar capabilities for starting a REPL
with the classpath configured automatically.

-SS



On Mar 29, 11:39 pm, Daniel cotter.dan...@gmail.com wrote:
 If this is a dumb question, let me apologize in advance. The thing is,
 I've been trying to learn Clojure in my spare time, and, following the
 advice of several Clojure blogs, started by reading Halloway's book
 and playing around a bit at the REPL, which is all well and good, but
 now I'm ready to tackle something a little bigger. The project that
 interests me most is James Reeve's Compojure, so I cloned the
 repository with the intention of loading the source files into the
 REPL and testing out some of the functions to get an idea of how it
 works internally. The first hurdle was getting all the dependent
 classes on the classpath, which I did by adding them one by one to
 the .clojure file (I'm using a script that concatenates the contents
 of .clojure to the classpath before launching the REPL). So far, so
 good. However, when I try to load core.clj from the REPL, it complains
 about not being able to find compojure/response.clj or its
 equivalent class. And it does this even if I load response.clj first,
 then try to load core.clj.

 So here are my questions:

 Am I going about this the wrong way? Is there an easier way to explore
 existing open-source projects? I
 Is there a less cumbersome way to get a load of files on the classpath
 than manually editing the .clojure file?
 How do I tell the REPL where to find response.clj so that core.clj
 will load?

 Any other advice will be much appreciated as well.

 Thanks,

 Daniel

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Getting started with open source Clojure projects

2010-03-30 Thread Meikel Brandmeyer
Hi,

On Mar 30, 3:45 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote:

 Take a look at the dependency management tools.  Most open-source
 Clojure projects use either Maven and Leiningen.  Both use the same
 dependency model and provide similar capabilities for starting a REPL
 with the classpath configured automatically.

There are also gradle and ant combined with Ivy as possible helpers.
They also build on the maven repositories. So they should work fine,
too.

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: Getting started with open source Clojure projects

2010-03-30 Thread Matt
If you're not stuck on using Compojure, you can try Conjure which will
includes all of the dependencies in the jar.

To start a hello world app:

1. Download conjure.jar from: http://github.com/macourtney/Conjure/downloads
2. java -jar conjure.jar hello_world
3. cd hello_world
4. ./run.sh script/server.clj
5. Point your browser at http://localhost:8080/
6. Profit!

There is a tutorial for Conjure at: 
http://wiki.github.com/macourtney/Conjure/hello-world-tutorial-2

-Matt Courtney

-- 
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe, reply using remove me as the subject.