Sha256: 40db6aa16dc7215de461aff1bad680ce608b053a3f4418259b54780fe0f68069

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

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

      fix_gemfile
    end

    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

    private
      def module_path
        File.dirname(__FILE__)
      end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.9 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.8 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.7 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.6 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.5 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.4 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.3 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.2 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.1 lib/forge-cli/modules/base/post_hooks.rb
forge-cli-0.1.0 lib/forge-cli/modules/base/post_hooks.rb