Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README with Rake instructions #1

Merged
merged 4 commits into from
Aug 5, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
# Running Ruby from Clojure
# Ruby from Clojure

This is a simple example of calling Ruby from Clojure. It contains a simple
JRuby project and a Clojure project:

* steel_city - a Ruby project that returns the speakers for the given day
* `steel_city` - a Ruby project that returns the speakers for the given day
in the Steel City Ruby Conference 2012
* speaker_selector - Returns a "top" speaker for the given day using a
* `speaker_selector` - Returns a "top" speaker for the given day using a
sophisticated algorithm (ie, random selection)

## Compiling

cd steel_city
jrubyc --javac schedule.rb
jar -cf schedule.jar com/steelcity/Schedule.class

## Installing with mvn

In your clojure project, set up the dependencies in the project.clj.
You will need dependencies on jruby and your compiled jar.

You will have to install these with mvn so that lein deps loads the
dependencies:
## Running

mvn install:install-file -DgroupId=com.steelcity.schedule \
-DartifactId=com.steelcity.schedule -Dversion=0.0.0 \
-Dpackaging=jar -Dfile=schedule.jar
$ rake

The command to install jruby to your local mvn repository will be similar.
=> (import com.steelcity.Schedule)
=> (top-speaker "Friday")
=> (top-speaker "Saturday")

## Running
## How does this work?

In the Clojure REPL, load the speaker-selector.core namespace and run:
For detailed instructions on how to get this working with your own Ruby code,
have a look at the
[`Rakefile`](https://github.com/jsl/ruby_from_clojure/blob/master/Rakefile)

(top-speaker "Friday")
(top-speaker "Saturday")
rake clean # Remove build artifacts
rake compile # Compile Ruby into Java bytecode
rake install # Install and copy to Clojure project
rake run # Start leiningen repl
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ task :run => :install do
# Open repl with leiningen
system "cd speaker_selector && lein repl"
end

task :default => :run