Sha256: 201002eb3c5b5830f90b7fb0de99e617ba650166790c6d4082cdb0525d723c91

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module RailsAppGenerator
  # Custom add-ons for RailsAppGenerator
  module AddOns
    # Add Rails Generator configuration to rails application
    class Generators < RailsAppGenerator::Addon
      def apply
        directory('lib/generators/rails/navigation', 'lib/generators/rails/navigation') if uses?(:views)

        template = 'lib/generators/rails/scaffold_controller_generator.rb'
        template(template) if uses?(:scaffold)

        generators = <<-RUBY
    config.generators do |generate|
        #{"require_relative '../lib/generators/rails/scaffold_controller_generator'" if uses?(:scaffold)}
        generate.helper false
        generate.javascripts false
        generate.request_specs false
        generate.routing_specs false
        generate.stylesheets false
        #{'generate.test_framework :rspec' if uses?(:rspec)}
        generate.view_specs false
        #{'generate.factory_bot true' if uses?(:factory_bot)}
    end
        RUBY
        inject_into_file 'config/application.rb', generators, before: /^ {2}end\n/
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_app_generator-0.2.3 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.2 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.1 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.0 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.1.28 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.1.27 lib/rails_app_generator/addons/generators.rb