Created
December 5, 2008 16:08
-
-
Save quirkey/32377 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Download a tarball from Github and extract to a shared dir then symlink to vendor/rails" | |
task :deploy_edge do | |
puts "Pulling Rails from github" | |
shared = ENV['SHARED_PATH'] || File.join('..','..','shared') | |
shared_path = File.expand_path(shared) | |
puts "Shared Path: #{shared_path}" | |
rails_path = File.join(shared_path, 'rails') | |
rails_version = ENV['VERSION'] || ENV['REVISION'] || 'v2.1.0' | |
export_path = File.join(rails_path, "rails_#{rails_version}") | |
symlink_path = File.join(RAILS_ROOT, 'vendor','rails') | |
puts "Pulling Rails tag: #{rails_version} to #{export_path}" | |
remote_revision_path = "http://github.com/rails/rails/tarball/#{rails_version}" | |
local_tarball_path = File.join(rails_path, "rails_#{rails_version}.tar.gz") | |
unless File.exists?(export_path) | |
puts 'Downloading tar from github' | |
mkdir_p export_path | |
system "curl -L #{remote_revision_path} > #{local_tarball_path}" | |
system "cd #{shared_path} && tar -xzf #{local_tarball_path}" | |
system "cd #{shared_path} && mv rails-rails-*/* #{export_path}/" | |
else | |
puts '-> Rails already downloaded and extracted' | |
end | |
puts 'Symlinking to vendor/rails' | |
rm_rf symlink_path | |
ln_s export_path, symlink_path | |
touch "vendor/rails_#{rails_version}" | |
puts 'Done' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment