Skip to content

Instantly share code, notes, and snippets.

@bjfish
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjfish/742dcc0c6ff8ab08dd3c to your computer and use it in GitHub Desktop.
Save bjfish/742dcc0c6ff8ab08dd3c to your computer and use it in GitHub Desktop.
Run a small Rakefile Tutorial with ruby/rake
# Add a small Rakefile to current directory
task :default => [:test]
task :test do
puts "Hello Rake"
end
# Rake's file_utils.rb needs the following small workaround/change:
RUBY = '/Users/brandonfish/Documents/jruby-mine/bin/jruby'
# ENV['RUBY'] || File.join(
# RbConfig::CONFIG['bindir'],
# RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']).
# sub(/.*\s.*/m, '"\&"')
# Fix path to your rake and run
$~/Documents/jruby-mine/bin/jruby -X+T -e '$:.unshift("/Users/brandonfish/Documents/rake/lib");require "rake";Rake.application.run'
Hello Rake
@bjfish
Copy link
Author

bjfish commented Apr 20, 2015

This is a bash profile function. Because it sets the RUBY var no ruby/rake change is needed.

function jtr { RUBY='/Users/brandonfish/Documents/jruby' ~/Documents/jruby/bin/jruby -X+T -e '$:.unshift("/Users/brandonfish/Documents/rake/lib");require "rake";Rake.application.run' $@; }

Then just

$ jtr test
Hello Rake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment