-
-
Save hchoroomi/308836 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Convert a Gemfile to Heroku's .gems file plus config.gem statements for Rails 2.3 | |
herokuconfig = "" | |
railsconfig = "" | |
gemfile = File.new("Gemfile") | |
gemfile.readlines.each do |line| | |
if line =~ /gem ['"](\w+)['"](?:, ['"](.+?)['"]){0,1}(?:, :require => ['"](.+?)['"]){0,1}/ | |
herokuconfig << "#{$1}" + ($2 ? %Q( --version "#{$2}") : '') + "\n" | |
railsconfig << "config.gem '#{$1}'" + ($2 ? ", :version => '#{$2}'" : '') + ($3 ? ", :lib => '#{$3}'" : '') + "\n" | |
end | |
end | |
puts herokuconfig | |
puts railsconfig |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment