2014-04-11 00:31:44 -07:00
|
|
|
|
|
|
|
require_relative 'lib/homebrew'
|
2014-04-13 08:46:20 -07:00
|
|
|
require_relative 'lib/rbenv'
|
2014-04-11 00:31:44 -07:00
|
|
|
|
2014-04-13 08:46:20 -07:00
|
|
|
task :rbenv => 'rbenv:update'
|
2014-04-11 00:31:44 -07:00
|
|
|
|
|
|
|
namespace :rbenv do
|
|
|
|
|
2014-04-13 08:46:20 -07:00
|
|
|
GLOBAL_GEMS = %w{bundler pry rspec rake}
|
2014-04-11 00:31:44 -07:00
|
|
|
|
|
|
|
task :install do
|
2014-04-13 08:46:20 -07:00
|
|
|
unless Rbenv.is_installed?
|
|
|
|
echo "Installing rbenv"
|
|
|
|
Rbenv.bootstrap
|
|
|
|
end
|
2014-04-11 00:31:44 -07:00
|
|
|
end
|
|
|
|
|
2014-04-13 08:46:20 -07:00
|
|
|
task :v2_0 => :install do
|
|
|
|
v = "2.0.0-p451"
|
|
|
|
unless Rbenv.is_version_installed?(v)
|
|
|
|
echo "Building ruby #{v}"
|
|
|
|
Rbenv.install v, GLOBAL_GEMS
|
2014-04-11 00:31:44 -07:00
|
|
|
end
|
2014-04-13 08:46:20 -07:00
|
|
|
end
|
2014-04-11 00:31:44 -07:00
|
|
|
|
2014-04-13 08:46:20 -07:00
|
|
|
task :v1_9 => :install do
|
|
|
|
v = "1.9.3-p545"
|
|
|
|
unless Rbenv.is_version_installed?(v)
|
|
|
|
echo "Building ruby #{v}"
|
|
|
|
Rbenv.install v, GLOBAL_GEMS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if Rbenv.is_installed?
|
|
|
|
task :remove do
|
|
|
|
echo "Deleting rbenv"
|
|
|
|
Rbenv.destroy
|
|
|
|
end
|
|
|
|
end
|
2014-04-11 00:31:44 -07:00
|
|
|
|
2014-04-13 08:46:20 -07:00
|
|
|
task :update => :install do
|
|
|
|
Rbenv.installed_versions.each do |v|
|
|
|
|
echo "Updating ruby #{v}"
|
|
|
|
Rbenv.update v
|
2014-04-11 00:31:44 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|