rubocop-extension-generator 0.2.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ce00b1c4ee87c6c5df795360129dff739229396becdff10de93520e049ff348
4
- data.tar.gz: 30b0f9069c85c1adeb7b8f5ab5f7949148c89b1e59297a39a37c173052875106
3
+ metadata.gz: f3c330aa44efa7895f962c779c3cce0beecfa92e9d79ae589ffecd12fc8492ad
4
+ data.tar.gz: 5df3674bf68a9d16bbbb2fe3814f83698b43d1fb0f3607473143220e47531779
5
5
  SHA512:
6
- metadata.gz: a5f0d41a6f2b78b40ff0fdc2d943659b64f90e322976c14029509700799e8c8864c74ed1e290fd0bd56ef63a41e7209e482394baf16a915d86da855a248a9a14
7
- data.tar.gz: 5f6a490e7ea1aaa5a675dffde0cc9b8e2dda0cf0ba923bb3fb26e86edd63b0dc69e7d03f941d9bcc538d987fcc98bb5177645dc2bd67c98cee0301d45d111771
6
+ metadata.gz: cb8cf264c9986b2e86821cee13e718aa766ab529ba1b9643824662b7bc0745874af1a28a3097c9003b9b663feb3b608ee9d7737b67800ae81cdde59907a961de
7
+ data.tar.gz: 8c39677e988be2c140e7046ef7251c8031ab63621ef1fe865e2b1fe7de26b5de72966fab2ff43fddf3572a808291de0e259e72800a3ea83d3b6446f3c4720f65
data/CHANGELOG.md CHANGED
@@ -1,22 +1,38 @@
1
1
  # master (unreleased)
2
2
 
3
- # v0.2.1
3
+ ## v0.4.0
4
4
 
5
- * [#4](https://github.com/rubocop-hq/rubocop-extension-generator/pull/4): Exclude main lib file from Naming/FileName cop
5
+ * [#13](https://github.com/rubocop/rubocop-extension-generator/pull/13): Fix an `ArgumentError` when RuboCop 1.22.0 or higher.
6
6
 
7
- # v0.2.0
7
+ ## v0.3.0
8
8
 
9
- * Rename `custom_cops_generator` to `rubocop-extension-generator`
9
+ * [#8](https://github.com/rubocop/rubocop-extension-generator/pull/8): Enable to work "Exclude" in AllCops section.
10
10
 
11
- # v0.1.2
11
+ ## v0.2.3
12
12
 
13
- * Fix bugs
13
+ * [#7](https://github.com/rubocop/rubocop-extension-generator/pull/7): Improve CLI.
14
+
15
+ ## v0.2.2
16
+
17
+ * [#5](https://github.com/rubocop/rubocop-extension-generator/pull/5): Add `require: false` to sample code in README.
18
+
19
+ ## v0.2.1
20
+
21
+ * [#4](https://github.com/rubocop/rubocop-extension-generator/pull/4): Exclude main lib file from Naming/FileName cop.
22
+
23
+ ## v0.2.0
24
+
25
+ * Rename `custom_cops_generator` to `rubocop-extension-generator`.
26
+
27
+ ## v0.1.2
28
+
29
+ * Fix bugs.
14
30
  * This release is the first release that works actually.
15
31
 
16
- # v0.1.1
32
+ ## v0.1.1
17
33
 
18
34
  * Specify MIT License in gemspec.
19
35
 
20
- # v0.1.0
36
+ ## v0.1.0
21
37
 
22
38
  * The initial release.
data/Gemfile CHANGED
@@ -3,4 +3,4 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in rubocop-extension-generator.gemspec
4
4
  gemspec
5
5
 
6
- gem "rake", "~> 12.0"
6
+ gem "rake", "~> 13.0"
data/README.md CHANGED
@@ -60,7 +60,11 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
60
60
 
61
61
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
62
62
 
63
+ ### Testing
64
+
65
+ You can execute a smoke test with `ruby smoke/smoke.rb`. Check it is success before open a pull request.
66
+
63
67
  ## Contributing
64
68
 
65
- Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop-hq/rubocop-extension-generator.
69
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop/rubocop-extension-generator.
66
70
 
@@ -4,6 +4,8 @@ module RuboCop
4
4
  class CLI
5
5
  BANNER = <<~TEXT
6
6
  Usage: rubocop-extension-generator NAME
7
+
8
+ The NAME must start with rubocop-, like rubocop-rspec.
7
9
  TEXT
8
10
 
9
11
  def self.run(argv)
@@ -17,13 +19,20 @@ module RuboCop
17
19
  def run
18
20
  # For --help
19
21
  opt = OptionParser.new(BANNER)
22
+ opt.version = VERSION
20
23
  args = opt.parse(@argv)
21
24
 
22
25
  name = args.first
23
- raise "It must be named `rubocop-*`. For example: rubocop-rspec" unless name.match?(/\Arubocop-\w+\z/)
26
+ fail!(opt) unless name
27
+ fail!(opt) unless name.match?(/\Arubocop-\w+\z/)
24
28
 
25
29
  Generator.new(name).generate
26
30
  end
31
+
32
+ private def fail!(opt)
33
+ puts opt.help
34
+ exit 1
35
+ end
27
36
  end
28
37
  end
29
38
  end
@@ -26,8 +26,8 @@ module RuboCop
26
26
  put "lib/#{dirname}/inject.rb", <<~RUBY
27
27
  # frozen_string_literal: true
28
28
 
29
- # The original code is from https://github.com/rubocop-hq/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
30
- # See https://github.com/rubocop-hq/rubocop-rspec/blob/master/MIT-LICENSE.md
29
+ # The original code is from https://github.com/rubocop/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
30
+ # See https://github.com/rubocop/rubocop-rspec/blob/master/MIT-LICENSE.md
31
31
  module RuboCop
32
32
  module #{classname}
33
33
  # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
@@ -36,7 +36,7 @@ module RuboCop
36
36
  def self.defaults!
37
37
  path = CONFIG_DEFAULT.to_s
38
38
  hash = ConfigLoader.send(:load_yaml_configuration, path)
39
- config = Config.new(hash, path)
39
+ config = Config.new(hash, path).tap(&:make_excludes_absolute)
40
40
  puts "configuration from \#{path}" if ConfigLoader.debug?
41
41
  config = ConfigLoader.merge_with_default(config, path)
42
42
  ConfigLoader.instance_variable_set(:@default_configuration, config)
@@ -122,10 +122,7 @@ module RuboCop
122
122
  exit!
123
123
  end
124
124
 
125
- github_user = `git config github.user`.chop
126
- github_user = 'your_id' if github_user.empty?
127
-
128
- generator = RuboCop::Cop::Generator.new(cop_name, github_user)
125
+ generator = RuboCop::Cop::Generator.new(cop_name)
129
126
 
130
127
  generator.write_source
131
128
  generator.write_spec
@@ -140,6 +137,8 @@ module RuboCop
140
137
  gem 'rspec'
141
138
  RUBY
142
139
 
140
+ patch 'README.md', /^gem '#{name}'$/, "gem '#{name}', require: false"
141
+
143
142
  puts
144
143
  puts <<~MESSAGE
145
144
  It's done! You can start developing a new extension of RuboCop in #{root_path}.
@@ -1,7 +1,7 @@
1
1
  module RuboCop
2
2
  module Extension
3
3
  module Generator
4
- VERSION = "0.2.1"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
  end
7
7
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
 
9
9
  spec.summary = %q{A generator of RuboCop's custom cops gem}
10
10
  spec.description = %q{A generator of RuboCop's custom cops gem}
11
- spec.homepage = "https://github.com/rubocop-hq/rubocop-extension-generator"
11
+ spec.homepage = "https://github.com/rubocop/rubocop-extension-generator"
12
12
  spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
13
13
  spec.licenses = ['MIT']
14
14
 
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
+ spec.add_runtime_dependency 'rubocop', '>= 1.22.0'
30
31
  spec.add_runtime_dependency 'bundler'
31
32
  spec.add_runtime_dependency 'activesupport'
32
33
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-extension-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Pocke Kuwabara
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-23 00:00:00.000000000 Z
11
+ date: 2022-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.22.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.22.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,14 +75,14 @@ files:
61
75
  - lib/rubocop/extension/generator/version.rb
62
76
  - rubocop-extension-generator.gemspec
63
77
  - smoke/smoke.rb
64
- homepage: https://github.com/rubocop-hq/rubocop-extension-generator
78
+ homepage: https://github.com/rubocop/rubocop-extension-generator
65
79
  licenses:
66
80
  - MIT
67
81
  metadata:
68
82
  allowed_push_host: https://rubygems.org
69
- homepage_uri: https://github.com/rubocop-hq/rubocop-extension-generator
70
- source_code_uri: https://github.com/rubocop-hq/rubocop-extension-generator
71
- post_install_message:
83
+ homepage_uri: https://github.com/rubocop/rubocop-extension-generator
84
+ source_code_uri: https://github.com/rubocop/rubocop-extension-generator
85
+ post_install_message:
72
86
  rdoc_options: []
73
87
  require_paths:
74
88
  - lib
@@ -83,8 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
97
  - !ruby/object:Gem::Version
84
98
  version: '0'
85
99
  requirements: []
86
- rubygems_version: 3.0.3
87
- signing_key:
100
+ rubygems_version: 3.2.13
101
+ signing_key:
88
102
  specification_version: 4
89
103
  summary: A generator of RuboCop's custom cops gem
90
104
  test_files: []