Class: ForgeCLI::BasePostHooks

Inherits:
PostHooks show all
Defined in:
lib/forge-cli/modules/base/post_hooks.rb

Instance Method Summary collapse

Methods inherited from PostHooks

#initialize, run!

Constructor Details

This class inherits a constructor from ForgeCLI::PostHooks

Instance Method Details

#fix_gemfileObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/forge-cli/modules/base/post_hooks.rb', line 12

def fix_gemfile
  if RUBY_VERSION.to_f > 1.9
    gemfile_content = File.read(File.join(@app, 'Gemfile'))
    new_content = gemfile_content.gsub("gem 'forge-rad'", "gem 'forge-rad20'")

    File.open(File.join(@app, 'Gemfile'), 'w') do |f|
      f.puts new_content
    end
  elsif RUBY_VERSION.to_f > 1.8
    gemfile_content = File.read(File.join(@app, 'Gemfile'))
    new_content = gemfile_content.gsub("gem 'capybara', '~> 2.0.0'", "gem 'capybara'")
    new_content = gemfile_content.gsub("gem 'shoulda-matchers', '~> 2.0.0'", "gem 'shoulda-matchers'")
    new_content = new_content.gsub("gem 'forge-rad'", "gem 'forge-rad19'")

    File.open(File.join(@app, 'Gemfile'), 'w') do |f|
      f.puts new_content
    end
  end
end

#run!Object



3
4
5
6
7
8
9
10
# File 'lib/forge-cli/modules/base/post_hooks.rb', line 3

def run!
  STDOUT.puts "Installing Routes..."
  ri = ForgeCLI::RouteInstaller.new(@app, module_path)
  ri.install_routes
  ri.install_routes(:forge)

  fix_gemfile
end