Sha256: f82b557d66b75fcbb7ce00070f4d09ed0d730a0b75932715d81a96f7657a420a

Contents?: true

Size: 1.09 KB

Versions: 30

Compression:

Stored size: 1.09 KB

Contents

require "rails/generators"
require_relative "generator_helper"

module ReactOnRails
  module Generators
    class RubyLintersGenerator < Rails::Generators::Base
      include GeneratorHelper
      Rails::Generators.hide_namespace(namespace)
      source_root File.expand_path("../templates", __FILE__)

      def add_ruby_linter_gems_to_gemfile
        linter_gems = <<-GEMS.strip_heredoc

          # require: false is necessary for the linters as we only want them loaded
          # when used by the linting rake tasks.
          group :development do
            gem("rubocop", require: false)
            gem("ruby-lint", require: false)
            gem("scss_lint", require: false)
          end
        GEMS
        append_to_file("Gemfile", linter_gems)
      end

      def copy_ruby_linting_and_auditing_tasks
        base_path = "ruby_linters/"
        %w(lib/tasks/brakeman.rake
           lib/tasks/ci.rake
           .rubocop.yml
           .scss-lint.yml).each { |file| copy_file(base_path + file, file) }
        template("ruby_linters/ruby-lint.yml.tt", "ruby-lint.yml")
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
react_on_rails-5.1.1 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-5.1.0 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-5.0.0 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-5.0.0.rc.1 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-4.0.3 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-4.0.2 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-4.0.1 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-4.0.0 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-4.0.0.beta.3 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-4.0.0.beta.2 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-4.0.0.beta.1 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.6 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.5 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.4 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.3 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.2 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.1 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.0 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.0.rc.2 lib/generators/react_on_rails/ruby_linters_generator.rb
react_on_rails-3.0.0.rc.1 lib/generators/react_on_rails/ruby_linters_generator.rb