Sha256: 2ad9ddb5c541e5d4baf38410349cd3afa6fc9e9dacfb09eb3422c66fe2782216

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require 'rails/generators'
require 'rails/generators/rails/app/app_generator'

require_relative '../builders/base'

module Straptible
  module Rails
    module Generators
      class Base < ::Rails::Generators::AppGenerator
        # Override default Rails generator options
        # REVIEW: Is there a less monkey-patchy way to do this?
        class_option :database,         type: :string,
                                        aliases: '-d',
                                        default: 'postgresql'

        class_option :skip_test_unit,   type: :boolean,
                                        aliases: '-T',
                                        default: true

        class_option :skip_javascript,  type: :boolean,
                                        aliases: '-J',
                                        default: true

        def self.start
          tmpl_path = File.join('..', 'templates')
          tmpl_root = File.expand_path(tmpl_path, File.dirname(__FILE__))
          source_root tmpl_root
          source_paths << tmpl_root
          source_paths << ::Rails::Generators::AppGenerator.source_root

          super
        end

        protected

        def get_builder_class
          Straptible::Rails::Builders::Base
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
straptible-0.1.0 lib/straptible/rails/generators/base.rb