Sha256: d69363da45b34fb9e94790f9cd9fb26fb353cb9e4bfb20624f76fe1e19e785da

Contents?: true

Size: 770 Bytes

Versions: 7

Compression:

Stored size: 770 Bytes

Contents

require "bundler/gem_tasks"
task :default => :spec

require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) do |spec|
  spec.pattern = FileList['spec/**/*_spec.rb']
end

desc 'Generate a new cop with a template'
task :new_cop, [:cop] do |_task, args|
  require 'rubocop'

  cop_name = args.fetch(:cop) do
    warn 'usage: bundle exec rake new_cop[Department/Name]'
    exit!
  end

  github_user = `git config github.user`.chop
  github_user = 'your_id' if github_user.empty?

  generator = RuboCop::Cop::Generator.new(cop_name, github_user)

  generator.write_source
  generator.write_spec
  generator.inject_require(root_file_path: 'lib/rubocop/cop/rubycw_cops.rb')
  generator.inject_config(config_file_path: 'config/default.yml')

  puts generator.todo
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubocop-rubycw-0.1.6 Rakefile
rubocop-rubycw-0.1.5 Rakefile
rubocop-rubycw-0.1.4 Rakefile
rubocop-rubycw-0.1.3 Rakefile
rubocop-rubycw-0.1.2 Rakefile
rubocop-rubycw-0.1.1 Rakefile
rubocop-rubycw-0.1.0 Rakefile