Skip to content
Open
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
12 changes: 10 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ directory "pkg/classes"
desc "Clean up build artifacts"
task :clean do
rm_rf "pkg/classes"
rm_rf "lib/cloby_ext.jar"
rm_rf "javalib/cloby_ext.jar"
end

desc "Compile the extension"
task :compile => "pkg/classes" do |t|
ant.javac :srcdir => "src", :destdir => t.prerequisites.first,
:source => "1.5", :target => "1.5", :debug => true,
:classpath => "${java.class.path}:${sun.boot.class.path}:lib/clojure-1.2.0.jar"
:classpath => "${java.class.path}:${sun.boot.class.path}:javalib/clojure-1.2.0.jar"
end

desc "Build the jar"
Expand All @@ -26,3 +26,11 @@ desc "Run the specs"
task :spec => :jar do
ruby "-S", "spec", "spec"
end

desc "install the jar"
task :install => :jar do
current_ruby = `/bin/bash -l -c 'rvm current'`.strip
gem_dir = "/Users/tim/.rvm/gems/#{current_ruby}/gems/cloby-0.0.3-java/lib"
puts "copying cloby_ext.jar to #{gem_dir}"
`cp javalib/cloby_ext.jar #{gem_dir}`
end
2 changes: 2 additions & 0 deletions src/org/jruby/clojure/ClojureLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ public ClojureObject(Ruby runtime, RubyClass klass) {

@Override
public Object getVariable(int index) {
if (index < 0) return null;
return ((IPersistentVector)variableTable.deref()).nth(index);
}

@Override
public void setVariable(int index, Object value) {
if (index < 0) return;
try {
variableTable.set(((IPersistentVector)variableTable.deref()).assocN(index, value));
} catch (IllegalStateException ise) {
Expand Down