Class: RailsUpgrade::Upgraders::Gems
- Inherits:
-
Object
- Object
- RailsUpgrade::Upgraders::Gems
- Defined in:
- lib/rails-upgrade/upgraders/gems.rb
Instance Method Summary collapse
Instance Method Details
#generate_gemfile ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rails-upgrade/upgraders/gems.rb', line 12 def generate_gemfile environment_file = File.open("config/environment.rb").read # Get each line that starts with config.gem gem_lines = environment_file.split("\n").select {|l| l =~ /^\s*config\.gem/} # yay hax config = GemfileGenerator.new eval(gem_lines.join("\n")) puts config.output end |
#upgrade!(args) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/rails-upgrade/upgraders/gems.rb', line 4 def upgrade!(args) if File.exists?("config/environment.rb") generate_gemfile else raise FileNotFoundError, "Can't find environment.rb [config/environment.rb]!" end end |