Sha256: 9923b07abb370ce137b65aef67e8350ef90df6bc078f4d1a7f6ac2b8e0a69120

Contents?: true

Size: 951 Bytes

Versions: 7

Compression:

Stored size: 951 Bytes

Contents

# frozen_string_literal: true

module Boring
  module Bullet
    class InstallGenerator < Rails::Generators::Base
      desc "Adds Bullet gem to the application"
      source_root File.expand_path("templates", __dir__)

      class_option :skip_configuration, type: :boolean, aliases: "-s",
                                        desc: "Skips adding bullet development configuration"

      def add_bullet_gem
        say "Adding Bullet gem", :green
        bullet_gem_content = <<~RUBY
          \n
          \t# reports N+1 queries
          \tgem "bullet"
        RUBY
        insert_into_file "Gemfile", bullet_gem_content, after: /group :development do/
        run "bundle install"
      end

      def add_bullet_gem_configuration
        return if options[:skip_configuration]

        say "Copying bullet.rb configuration to the initializer", :green
        template("bullet.rb", "config/initializers/bullet.rb")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
boring_generators-0.9.0 lib/generators/boring/bullet/install/install_generator.rb
boring_generators-0.8.0 lib/generators/boring/bullet/install/install_generator.rb
boring_generators-0.7.0 lib/generators/boring/bullet/install/install_generator.rb
boring_generators-0.6.0 lib/generators/boring/bullet/install/install_generator.rb
boring_generators-0.5.0 lib/generators/boring/bullet/install/install_generator.rb
boring_generators-0.4.0 lib/generators/boring/bullet/install/install_generator.rb
boring_generators-0.3.0 lib/generators/boring/bullet/install/install_generator.rb