Sha256: 1055cc68599da8579d91f40c1b313d94360a370499b26e5fe9e241dfdc56c4f3

Contents?: true

Size: 809 Bytes

Versions: 5

Compression:

Stored size: 809 Bytes

Contents

require 'rails/generators/base'

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

      def self.banner
        "rails generate faat:#{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

5 entries across 5 versions & 1 rubygems

Version Path
faat-0.1.7 lib/generators/faat.rb
faat-0.1.6 lib/generators/faat.rb
faat-0.1.5 lib/generators/faat.rb
faat-0.1.4 lib/generators/faat.rb
faat-0.1.3 lib/generators/faat.rb