Created
September 23, 2009 10:54
-
-
Save mkdynamic/191916 to your computer and use it in GitHub Desktop.
Spit out gems.yml and .gems in root of Rails app
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
namespace :gems do | |
desc "Spit out gems.yml and .gems in root of app (for Heroku + EY etc.)" | |
task :specify => :environment do | |
gems = Rails.configuration.gems | |
# output gems.yml | |
yaml = File.join(RAILS_ROOT, "gems.yml") | |
File.open(yaml, "w") do |f| | |
output = [] | |
gems.each do |gem| | |
spec = { "name" => gem.name, "version" => gem.version_requirements.to_s } | |
spec["install_options"] = "--source #{gem.source}" if gem.source | |
output << spec | |
end | |
f.write output.to_yaml | |
puts output.to_yaml | |
end | |
# output .gems | |
dot_gems = File.join(RAILS_ROOT, ".gems") | |
File.open(dot_gems, "w") do |f| | |
output = [] | |
gems.each do |gem| | |
spec = "#{gem.name} --version '#{gem.version_requirements.to_s}'" | |
spec << " --source #{gem.source}" if gem.source | |
output << spec | |
end | |
f.write output.join("\n") | |
puts output.join("\n") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment