Sha256: 9c01b86ffce14587efdd6a7b6943270816258e0763e3d96d9885c1e0e1c2baa7

Contents?: true

Size: 1.18 KB

Versions: 47

Compression:

Stored size: 1.18 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
      # Requires Testing (NOT SURE IF THIS IS A GOOD APPROACH, need to look at other generator systems)
      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

47 entries across 47 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.3.5 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.3.4 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.3.3 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.3.2 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.3.1 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.3.0 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.43 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.42 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.41 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.40 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.39 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.38 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.37 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.36 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.35 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.34 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.33 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.32 lib/rails_app_generator/addons/generators.rb
rails_app_generator-0.2.31 lib/rails_app_generator/addons/generators.rb