Sha256: 17562913cea4e179a4ad8328c06a6266fa946ad7908994b0fceb25006f1fb5d1

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

# frozen_string_literal: true

module Hoboken
  module AddOns
    # Basic Rubocop YAML config.
    #
    class Rubocop < ::Hoboken::Group
      def add_gems
        gem 'rubocop', version: '1.12', group: %i[development test]
        gem 'rubocop-rake', version: '0.5', group: %i[development test]
        gem 'rubocop-rspec', version: '2.2', group: %i[development test] if rspec?
      end

      def rubocop_yml
        template('hoboken/templates/rubocop.yml.tt', '.rubocop.yml')
      end

      def rake_task
        create_file('tasks/rubocop.rake') do
          <<~TEXT
            # frozen_string_literal: true

            require 'rubocop/rake_task'

            RuboCop::RakeTask.new
          TEXT
        end
      end

      def ci_task
        task_list = if rspec?
                      '%w[rspec rubocop]'
                    else
                      "['test:all', 'rubocop']"
                    end
        gsub_file('Rakefile', /task ci:.*/, "task ci: #{task_list}")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hoboken-0.9.0 lib/hoboken/add_ons/rubocop.rb