Sha256: 0bac7a19159acc821a7333e302b1e79472cd7adaccdd9a7ec84633b047b4e73b

Contents?: true

Size: 840 Bytes

Versions: 2

Compression:

Stored size: 840 Bytes

Contents

require 'rails/generators/base'

module Bootstrapped
  module Generators
    class Base < ::Rails::Generators::Base
      def self.source_root
        @_bootstrapped_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'bootstrapped', generator_name, 'templates'))
      end

      def self.banner
        "rails generate bootstrap:#{generator_name} #{self.arguments.map{ |a| a.usage }.join(' ')} [options]"
      end

      private

      def add_gem(name, options = {})
        gemfile_content = File.read(destination_path("Gemfile"))
        File.open(destination_path("Gemfile"), 'a') { |f| f.write("\n") } unless gemfile_content =~ /\n\Z/
        gem name, options unless gemfile_content.include? name
      end

      def print_usage
        self.class.help(Thor::Base.shell.new)
        exit
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootstrapped-0.0.6 lib/generators/bootstrapped.rb
bootstrapped-0.0.4 lib/generators/bootstrapped.rb