Sha256: 0a13f3e45006cc4a25636716080907c6eb2a7fa8d4bdb9b5cb5c744ef9d38213

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

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

#
module Bearonrails
  #
  class AppGenerator < Rails::Generators::AppGenerator
    def finish_template
      bearonrails_customization
      super
    end

    def bearonrails_customization
      invoke :remove_files_we_dont_need
      invoke :add_common_rake_tasks
      invoke :customize_gemfile
      invoke :install_rspec
      invoke :add_rubocop_config
      invoke :add_pry_config
      invoke :remove_routes_comment_lines
      invoke :init_git
    end

    def remove_files_we_dont_need
      say 'remove files we don\'t need'
      build :remove_public_index
      build :remove_rails_logo_image
    end

    def add_common_rake_tasks
      say 'Add common rake tasks'
      build :add_common_rake_tasks
    end

    def customize_gemfile
      build :add_custom_gems
      bundle_command 'install'
    end

    def add_rubocop_config
      say 'Add rubocop config'
      build :add_rubocop_config
    end

    def add_pry_config
      say 'Add pry config'
      build :add_pryrc
      build :add_pry_config
    end

    def install_rspec
      say 'Install rspec'
      build :install_rspec
      build :add_rspec_helper_addon
    end

    def remove_routes_comment_lines
      say 'Remove routes comment lines'
      build :remove_routes_comment_lines
    end

    def init_git
      say 'Init git'
      build :init_git
    end

    protected

    def get_builder_class
      Bearonrails::AppBuilder
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bearonrails-0.1.1 lib/bearonrails/generators/app_generator.rb
bearonrails-0.1.0 lib/bearonrails/generators/app_generator.rb