onkcop 0.46.0.0 → 0.46.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab9449901494c6535699cf14b4080684cbb8eb29
4
- data.tar.gz: ce23e644e8cb653cee9a287d1f17762380f1ae55
3
+ metadata.gz: f83267878bb72574be70f0738e90277de55c45f6
4
+ data.tar.gz: 6e51ecd9a4c2f65ec68d460decc73f92672ae175
5
5
  SHA512:
6
- metadata.gz: b495c91abecbdf08aa2eb271c135d60bd4170dcbd4ca8528fc26b0336f67428a5c409ee958355ecd9609a202fdb71fe4d0fed0e1897e131b824e3f607822126c
7
- data.tar.gz: a076e315ed7217ac81ed50cec217835fcc5c1b33de348f846c427e9937ac1d19377888b3f41243b2209f18857e908b048126aa40104b7ac736125aed56a89e98
6
+ metadata.gz: 174e751b5ece43776d88f8514439f1e7254254d171bc25fb43cfc6b3daa135ef150e57bfae0ca35b17a3969db357ef7bfd9b28a8ffa4b181beb4710900809d5d
7
+ data.tar.gz: 43f729b1a5e0662d02519f3e9fe63270da0de5b5a53f2ea8c8e290bec26d0b05c02f4f2f296c56356461dd4f1cc544a8d337e152630b32a4e2ba013b1152bf9d
data/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
1
  # onkcop
2
2
 
3
- ## v0.45.0 (2016-11-02)
3
+ ## v0.46.0.1 (2017-01-07)
4
+
5
+ [full changelog](https://github.com/onk/onkcop/compare/v0.46.0.0...v0.46.0.1)
6
+
7
+ * Update to `rubocop-rspec` v1.9.1.
8
+ * Disable `RSpec/MessageExpectation` cop that is replaced with a new cop: `RSpec/MessageSpies`.
9
+ * Add CLI for setup `.rubocop.yml`.
10
+
11
+
12
+ ## v0.46.0.0 (2016-11-30)
13
+
14
+ [full changelog](https://github.com/onk/onkcop/compare/v0.45.0.0...v0.46.0.0)
15
+
16
+ * Update to `rubocop` v0.46.0.
17
+ * Use new `Style/EmptyMethod` cop with `expanded` style.
18
+ * Use `Style/TernaryParentheses` cop `require_parentheses_when_complex` style.
19
+
20
+
21
+ ## v0.45.0.0 (2016-11-02)
4
22
  [full changelog](https://github.com/onk/onkcop/compare/v0.44.1.1...v0.45.0.0)
5
23
 
6
24
  * Update to `rubocop` v0.45.0 and `rubocop-rspec` v1.8.0.
data/README.md CHANGED
@@ -7,7 +7,13 @@ OnkCop is a RuboCop configration gem.
7
7
 
8
8
  ## Usage
9
9
 
10
- Add the following directive to your `.rubocop.yml`:
10
+ Setup .rubocop.yml
11
+
12
+ ```sh
13
+ bundle exec onkcop init
14
+ ```
15
+
16
+ `init` generate the following directive to your `.rubocop.yml`:
11
17
 
12
18
  ```yaml
13
19
  inherit_gem:
@@ -19,7 +25,7 @@ inherit_gem:
19
25
  # - "config/rspec.yml"
20
26
 
21
27
  AllCops:
22
- TargetRubyVersion: 2.3
28
+ TargetRubyVersion: 2.4
23
29
  ```
24
30
 
25
31
  ```sh
data/config/rspec.yml CHANGED
@@ -20,14 +20,6 @@ RSpec/ImplicitExpect:
20
20
  RSpec/InstanceVariable:
21
21
  Enabled: false
22
22
 
23
- # mock ではなく spy を使うのを推奨したい。
24
- # ただメッセージが悪く、「mock ではなく stub を使え」と言っているように読み取れる
25
- # (そのため Enabled: false になった) ので
26
- # https://github.com/backus/rubocop-rspec/pull/224
27
- # が cop 名も分かりやすくなって良さそう。
28
- RSpec/MessageExpectation:
29
- Enabled: true
30
-
31
23
  # 強く 1 example 1 assertion の立場は取らないが、多すぎてもツラいので。
32
24
  # aggregate_failures で囲われていたら無視する的なオプション欲しい。
33
25
  RSpec/MultipleExpectations:
data/exe/onkcop ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../lib"
4
+
5
+ # Exit cleanly from an early interrupt
6
+ Signal.trap("INT") { exit 1 }
7
+
8
+ require "onkcop"
9
+
10
+ Onkcop::CLI.start(ARGV)
data/lib/onkcop/cli.rb ADDED
@@ -0,0 +1,43 @@
1
+ require "fileutils"
2
+ module Onkcop
3
+ class CLI
4
+ def self.start(args)
5
+ action_name = retrieve_command_name(args)
6
+ unless action_name
7
+ print_help
8
+ exit
9
+ end
10
+
11
+ instance = self.new
12
+ if instance.public_methods(false).include?(action_name.to_sym)
13
+ instance.__send__(action_name, args)
14
+ exit
15
+ end
16
+
17
+ puts "Could not find command #{action_name}."
18
+ print_help
19
+ exit(1)
20
+ rescue => e
21
+ puts e.message
22
+ exit(1)
23
+ end
24
+
25
+ def self.retrieve_command_name(args)
26
+ meth = args.first.to_s unless args.empty?
27
+ args.shift if meth && (meth !~ /^\-/)
28
+ end
29
+
30
+ def self.print_help
31
+ puts "onkcop commands:"
32
+ puts " init - Setup .rubocop.yml"
33
+ end
34
+
35
+ CONFIG_FILE_NAME = ".rubocop.yml"
36
+ def init(args)
37
+ raise "usage: onkcop init" unless args.empty?
38
+ template_path = File.expand_path("../../templates", __dir__)
39
+ puts "#{File.exist?(CONFIG_FILE_NAME) ? "overwrite" : "create"} #{CONFIG_FILE_NAME}"
40
+ FileUtils.copy_file(File.join(template_path, CONFIG_FILE_NAME), CONFIG_FILE_NAME)
41
+ end
42
+ end
43
+ end
@@ -1,3 +1,3 @@
1
1
  module Onkcop
2
- VERSION = "0.46.0.0"
2
+ VERSION = "0.46.0.1"
3
3
  end
data/lib/onkcop.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "onkcop/cli"
1
2
  require "onkcop/version"
2
3
 
3
4
  module Onkcop
data/onkcop.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_dependency "rubocop", "~> 0.46.0"
23
- spec.add_dependency "rubocop-rspec", ">= 1.8.0"
23
+ spec.add_dependency "rubocop-rspec", ">= 1.9.1"
24
24
  spec.add_development_dependency "bundler"
25
25
  spec.add_development_dependency "rake"
26
26
  end
@@ -0,0 +1,10 @@
1
+ inherit_gem:
2
+ onkcop:
3
+ - "config/rubocop.yml"
4
+ # uncomment if use rails cops
5
+ # - "config/rails.yml"
6
+ # uncomment if use rspec cops
7
+ # - "config/rspec.yml"
8
+
9
+ AllCops:
10
+ TargetRubyVersion: 2.4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onkcop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.46.0.0
4
+ version: 0.46.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takafumi ONAKA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-30 00:00:00.000000000 Z
11
+ date: 2017-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.0
33
+ version: 1.9.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.0
40
+ version: 1.9.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -69,7 +69,8 @@ dependencies:
69
69
  description: OnkCop is a RuboCop configration gem.
70
70
  email:
71
71
  - takafumi.onaka@gmail.com
72
- executables: []
72
+ executables:
73
+ - onkcop
73
74
  extensions: []
74
75
  extra_rdoc_files: []
75
76
  files:
@@ -85,9 +86,12 @@ files:
85
86
  - config/rails.yml
86
87
  - config/rspec.yml
87
88
  - config/rubocop.yml
89
+ - exe/onkcop
88
90
  - lib/onkcop.rb
91
+ - lib/onkcop/cli.rb
89
92
  - lib/onkcop/version.rb
90
93
  - onkcop.gemspec
94
+ - templates/.rubocop.yml
91
95
  homepage: https://github.com/onk/onkcop
92
96
  licenses:
93
97
  - MIT