Skip to content

Instantly share code, notes, and snippets.

@troter
Forked from yhara/Rakefile
Created September 1, 2009 14:13
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 troter/179111 to your computer and use it in GitHub Desktop.
Save troter/179111 to your computer and use it in GitHub Desktop.
# configurations
BIN_DIR = File.expand_path("~/bin/")
INSTALL_DIR = File.expand_path("~/bin/rubys/")
P185 = "p231"
P186 = "p369"
P187 = "p174"
P191 = "p129"
JRUBY_VER = "1.3.0"
# ~/bin/ruby-1.8.6
# ~/bin/rubys/ruby-1.8.6/...
TOP_DIR = File.dirname(__FILE__)
def cd(dir=TOP_DIR)
Dir.chdir(File.expand_path(dir, TOP_DIR))
end
def compile(name)
cd "#{name}"
sh "./configure " +
"--prefix='#{INSTALL_DIR}/#{name}' " +
"--program-suffix='#{name.sub(/ruby/, '')}' "+
"--disable-install-doc "
sh "make"
sh "make install"
end
def symlink(name)
cd BIN_DIR
# sh "ln -s " +
# "'#{INSTALL_DIR}/#{name}/bin/#{name}' " +
# "'#{BIN_DIR}/#{name.sub(/-p\d+$/, '')}' "
sh "ln -s " +
"'#{INSTALL_DIR}/#{name}/bin/#{name}' " +
"'#{BIN_DIR}/#{name}' "
end
task :cruby => [:ruby186, :ruby187, :ruby191]
desc "install ruby-1.8.5 #{P185}"
task :ruby185 => ["#{BIN_DIR}/ruby-1.8.5-#{P185}"]
desc "install ruby-1.8.6 #{P186}"
task :ruby186 => ["#{BIN_DIR}/ruby-1.8.6-#{P186}"]
desc "install ruby-1.8.7 #{P187}"
task :ruby187 => ["#{BIN_DIR}/ruby-1.8.7-#{P187}"]
desc "install ruby-1.9.1 #{P191}"
task :ruby191 => ["#{BIN_DIR}/ruby-1.9.1-#{P191}"]
# install
rule /\// => [lambda{|s| File.basename(s)}] do |t|
compile t.source
symlink t.source
end
# unpack
rule /ruby-.*-p\d+$/ => [lambda{|s| "#{s}.tar.bz2"}] do |t|
cd
sh "tar xvf #{t.source}"
end
# download
rule ".bz2" do |t|
sh "wget ftp://core.ring.gr.jp/pub/lang/ruby/#{t.name}"
end
# --- rubinius
desc "install rubinius"
task :rubinius => "#{BIN_DIR}/rubinius"
file "#{BIN_DIR}/rubinius" => "rubinius-git" do
cd "rubinius-git"
sh "git pull"
sh "rake"
sh "ln -s #{TOP_DIR}/bin/rbx #{BIN_DIR}/rubinius"
end
file "rubinius-git" do
cd
sh "git clone --depth 1 git://github.com/evanphx/rubinius.git rubinius-git"
end
# --- macruby
#
#desc "install macruby"
#task :macruby => "#{BIN_DIR}/macruby"
#
#file "#{BIN_DIR}/macruby" => "macruby-git" do
# cd "macruby-git"
# sh "git pull"
# sh "RUBYOPT='' DESTDIR='#{INSTALL_DIR}/macruby' rake"
# sh "RUBYOPT='' DESTDIR='#{INSTALL_DIR}/macruby' rake install"
# #sh "ln -s #{TOP_DIR}/bin/rbx #{BIN_DIR}/macruby"
#end
#
#file "macruby-git" do
# cd
# sh "git clone --depth 1 git://github.com/masterkain/macruby.git macruby-git"
#end
# task jruby
desc "install jruby"
task :jruby => "#{BIN_DIR}/jruby"
file "#{BIN_DIR}/jruby" => "jruby-#{JRUBY_VER}" do
sh "ln -s #{TOP_DIR}/jruby-#{JRUBY_VER}/bin/jruby #{BIN_DIR}/jruby"
end
file "jruby-#{JRUBY_VER}" do
cd
sh "wget http://dist.codehaus.org/jruby/#{JRUBY_VER}/jruby-bin-#{JRUBY_VER}.tar.gz"
sh "tar xvf jruby-bin-#{JRUBY_VER}.tar.gz"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment