Sha256: d0a18315ac074d1d78f28de352dc7655a23f6cc0b120f19f52410d69af3bf2cf

Contents?: true

Size: 872 Bytes

Versions: 1

Compression:

Stored size: 872 Bytes

Contents

require 'rake'
require 'rails/generators'

module Heartwood
  class GemfileGenerator < Rails::Generators::Base

    desc "Replace your existing Gemfile with Heartwood's default Gemfile."

    source_root File.expand_path('../../templates', __FILE__)

    # Here we figure out some of the more complicated logic
    # before rendering the Gemfile template
    #
    def resolve_options
      @rails_version = `bundle exec rails -v`.to_s.split(' ').last
    end

    # Move our default Gemfile to the project's Gemfile.
    #
    def add_config_file
      template "Gemfile.erb", "Gemfile", :force => true
      gsub_file "Gemfile", /\n\n\n+?/, "\n\n"
    end

    private

      def gem_root
        Gem::Specification.find_by_name("heartwood").gem_dir
      end

      def help_message(file)
        puts File.read("#{gem_root}/lib/help/#{file}.txt")
      end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heartwood-0.0.1 lib/generators/cambium/gemfile_generator.rb