space, → | next slide |
← | previous slide |
d | debug mode |
## <ret> | go to slide # |
c | table of contents (vi) |
f | toggle footer |
r | reload slides |
z | toggle help (this) |
$ java -jar jruby-complete-1.4.0.jar
$ java -jar jruby-complete-1.4.0.jar -e "puts 'Ahoy'"
Ahoy
$ java -Xmx500m -Xss1024k \
$ -jar jruby-complete-1.4.0.jar -e "puts 'Ahoy'"
Ahoy
$ java -Xmx500m -Xss1024k \
$ -jar jruby-complete-1.4.0.jar -S jirb
irb(main):001:0> puts "Ahoy"
Ahoy
=> nil
JRUBY_COMPLETE = "jruby-complete-1.4.0.jar"
JRUBY = "java -Xmx500m -Xss1024k " \
"-jar #{JRUBY_COMPLETE}"
namespace :jruby do
desc "Run JRuby help"
task :help do
sh %+#{JRUBY} --help+
end
desc "Run any command with JRuby"
task :run do
sh %+#{JRUBY} -e '#{ENV["cmd"]}'+
end
end
$ rake jruby:run cmd='puts "Hello"'
Hello
puts 'Hello from application_bootstrap'
task :run do
sh "#{JRUBY} lib/application_bootstrap.rb"
end
$ rake run
java -Xmx500m -Xss1024k -jar jruby-complete-1.4.0.jar \
lib/application_bootstrap.rb
Hello from application_bootstrap
namespace :spec do
desc "Run RSpec against a specific file"
task :run do
sh "#{JRUBY} -S spec -f specdoc " \
"#{ENV['spec']}"
end
end
describe "John Galt" do
it "doesn't tolerate logical fallacies" do
"A".should == "A"
end
end
$ rake spec:run spec=spec/unit/objectivism_spec.rb
java -Xmx500m -Xss1024k -jar jruby-complete-1.4.0.jar \
-S spec -f specdoc spec/unit/objectivism_spec.rb
John Galt
- doesn't tolerate logical fallacies
Finished in 0.123 seconds
1 example, 0 failures
$ which sp
sp () {
rake spec:run spec=$@
}
$ sp spec/unit/objectivism_spec.rb
java -Xmx500m -Xss1024k -jar jruby-complete-1.4.0.jar \
-S spec -f specdoc spec/unit/objectivism_spec.rb
require "rake/clean"
namespace :jruby do
output_directory = "classes"
directory output_directory
CLEAN.include output_directory
desc "Compile Ruby files in lib"
task :compile => output_directory do
sh "#{JRUBY} -S jrubyc " \
"-p com/atomicobject " \
-t #{output_directory} lib"
end
end
$ rake jruby:compile
java -Xmx500m -Xss1024k -jar jruby-complete-1.4.0.jar
-S jrubyc -p com/atomicobject -t classes lib
Compiling lib/application_bootstrap.rb to class
com/atomicobject/lib/application_bootstrap
$ rake jruby:run cmd='require \
$ "classes/com/atomicobject/lib/application_bootstrap"'
java -Xmx500m -Xss1024k -jar jruby-complete-1.4.0.jar ...
Hello from application_bootstrap