guard-rubocop 0.0.3 → 0.0.4

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: 5bc5fa655511eae8b694c297d101d6ad09d266db
4
- data.tar.gz: 0d464ef835877c3fcc291ceabc67e7ac2e2f8195
3
+ metadata.gz: 0dfc8d85682b0eb89593cac569aeb9c3287c0f3c
4
+ data.tar.gz: 09fe402f245769e82794e2da20af64c6474f2c44
5
5
  SHA512:
6
- metadata.gz: f1a50603256283df2cc4c27f6b7014557258dbf9d8773f95e30b21bcb4d54de3dd6b8bab072c592fbaa9089b0a93a50f0f2a0c6fbf1d34c41dd1d6125f7e9fe7
7
- data.tar.gz: edff6f80a97feb8ecc18f0aeb20708a2eec01777fcfc8829e63e995e68e2cd5dfed882fabad98d59ea4a0aaf28a624a02ebdf5d4cfddf7e24cd861f94c990a16
6
+ metadata.gz: 73d2c70b2fa70867c5955f399e13485e36a8740ee5dc496d96abc568e72b5539affe589614de1c20aa8daa236f4a69c47a2734a91050bc2fbc2168a017e97b7d
7
+ data.tar.gz: d008aeeccc2be2404307980b01f8e5028508927871fbb1904c025920bfae005c3f23bffeec66f9e6f52c8c90e15e80303dbe46c61836f7115b4a7a56d263d7f9
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :test do
6
- gem 'coveralls'
6
+ gem 'coveralls', '~> 0.6'
7
7
  gem 'simplecov-rcov', '~> 0.2'
8
8
  gem 'ci_reporter', '~> 1.8'
9
9
  end
data/Guardfile CHANGED
@@ -1,14 +1,14 @@
1
1
  # A sample Guardfile
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
- guard 'rspec' do
4
+ guard :rspec, all_after_pass: true, all_on_start: true, keep_failed: true do
5
5
  watch(%r{^spec/.+_spec\.rb$})
6
6
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
7
  watch('spec/spec_helper.rb') { "spec" }
8
8
  watch(%r{^spec/support/.+\.rb$}) { "spec" }
9
9
  end
10
10
 
11
- guard 'rubocop' do
11
+ guard :rubocop do
12
12
  watch(%r{.+\.rb$})
13
13
  watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
14
14
  end
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- # Guard::Rubocop [![Gem Version](https://badge.fury.io/rb/guard-rubocop.png)](http://badge.fury.io/rb/guard-rubocop) [![Dependency Status](https://gemnasium.com/yujinakayama/guard-rubocop.png)](https://gemnasium.com/yujinakayama/guard-rubocop) [![Build Status](https://travis-ci.org/yujinakayama/guard-rubocop.png?branch=master)](https://travis-ci.org/yujinakayama/guard-rubocop) [![Coverage Status](https://coveralls.io/repos/yujinakayama/guard-rubocop/badge.png?branch=master)](https://coveralls.io/r/yujinakayama/guard-rubocop) [![Code Climate](https://codeclimate.com/github/yujinakayama/guard-rubocop.png)](https://codeclimate.com/github/yujinakayama/guard-rubocop)
1
+ [![Gem Version](https://badge.fury.io/rb/guard-rubocop.png)](http://badge.fury.io/rb/guard-rubocop) [![Dependency Status](https://gemnasium.com/yujinakayama/guard-rubocop.png)](https://gemnasium.com/yujinakayama/guard-rubocop) [![Build Status](https://travis-ci.org/yujinakayama/guard-rubocop.png?branch=master)](https://travis-ci.org/yujinakayama/guard-rubocop) [![Coverage Status](https://coveralls.io/repos/yujinakayama/guard-rubocop/badge.png?branch=master)](https://coveralls.io/r/yujinakayama/guard-rubocop) [![Code Climate](https://codeclimate.com/github/yujinakayama/guard-rubocop.png)](https://codeclimate.com/github/yujinakayama/guard-rubocop)
2
+
3
+ # Guard::Rubocop
2
4
 
3
5
  Guard::Rubocop allows you to automatically check Ruby code style with [RuboCop](https://github.com/bbatsov/rubocop) when files are modified.
4
6
 
@@ -43,7 +45,7 @@ Please read the [Guard usage documentation](https://github.com/guard/guard#readm
43
45
  You can pass some options in `Guardfile`:
44
46
 
45
47
  ```ruby
46
- guard 'rubocop', all_on_start: false, notification: true do
48
+ guard :rubocop, all_on_start: false, notification: true do
47
49
  # ...
48
50
  end
49
51
  ```
data/Rakefile CHANGED
@@ -15,4 +15,4 @@ namespace :ci do
15
15
  end
16
16
  end
17
17
 
18
- task :default => :spec
18
+ task default: :spec
@@ -15,19 +15,20 @@ Gem::Specification.new do |spec|
15
15
  spec.homepage = 'https://github.com/yujinakayama/guard-rubocop'
16
16
  spec.license = 'MIT'
17
17
 
18
- spec.files = `git ls-files`.split($/)
18
+ spec.files = `git ls-files`.split($/).reject { |f| File.basename(f).start_with?('.') }
19
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_runtime_dependency 'guard', '~> 1.8'
24
- spec.add_runtime_dependency 'rubocop', ['>= 0.6.1', '< 1.0.0']
25
- spec.add_runtime_dependency 'childprocess', '~> 0.3'
23
+ spec.add_runtime_dependency "guard", '~> 1.8'
24
+ spec.add_runtime_dependency "rubocop", ['>= 0.8.2', '< 0.9.0']
25
+ spec.add_runtime_dependency "childprocess", '~> 0.3'
26
+ spec.add_runtime_dependency "term-ansicolor", '~> 1.1'
26
27
 
27
28
  spec.add_development_dependency 'bundler', '~> 1.3'
28
29
  spec.add_development_dependency 'rake', '~> 10.0'
29
30
  spec.add_development_dependency 'rspec', '~> 2.13'
30
31
  spec.add_development_dependency 'simplecov', '~> 0.7'
31
- spec.add_development_dependency 'guard-rspec', '>= 2.5.4'
32
- spec.add_development_dependency 'ruby_gntp', '>= 0.3'
32
+ spec.add_development_dependency 'guard-rspec', '~> 3.0'
33
+ spec.add_development_dependency 'ruby_gntp', '~> 0.3'
33
34
  end
data/lib/guard/rubocop.rb CHANGED
@@ -2,11 +2,10 @@
2
2
 
3
3
  require 'guard'
4
4
  require 'guard/guard'
5
- require 'guard/notifier'
6
5
 
7
6
  module Guard
8
7
  class Rubocop < Guard
9
- autoload :Runner, 'guard/rubocop/runner' # rubocop:disable SymbolSnakeCase
8
+ autoload :Runner, 'guard/rubocop/runner'
10
9
 
11
10
  attr_reader :options, :failed_paths
12
11
 
@@ -1,6 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require 'childprocess'
4
+ require 'term/ansicolor'
4
5
 
5
6
  module Guard
6
7
  class Rubocop
@@ -17,8 +18,9 @@ module Guard
17
18
  end
18
19
 
19
20
  def run(paths = [])
20
- exit_code, @output = rubocop(['--no-color'].concat(paths))
21
+ exit_code, output = rubocop(paths)
21
22
  @passed = (exit_code == PASSED_EXIT_CODE)
23
+ @output = Term::ANSIColor.uncolor(output)
22
24
 
23
25
  case @options[:notification]
24
26
  when :failed
@@ -33,9 +35,12 @@ module Guard
33
35
  def rubocop(args)
34
36
  process = ChildProcess.build('rubocop', *args)
35
37
 
36
- stdout_reader, stdout_writer = IO.pipe
37
- process.io.stdout = stdout_writer
38
+ # Force Rainbow inside RuboCop to colorize output
39
+ # even though output is not TTY.
40
+ # https://github.com/sickill/rainbow/blob/0b64edc/lib/rainbow.rb#L7
41
+ process.environment['CLICOLOR_FORCE'] = '1'
38
42
 
43
+ stdout_reader, process.io.stdout = IO.pipe
39
44
  process.start
40
45
 
41
46
  output = ''
@@ -1,4 +1,4 @@
1
- guard 'rubocop' do
1
+ guard :rubocop do
2
2
  watch(%r{.+\.rb$})
3
3
  watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
4
4
  end
@@ -7,7 +7,7 @@ module Guard
7
7
  # http://semver.org/
8
8
  MAJOR = 0
9
9
  MINOR = 0
10
- PATCH = 3
10
+ PATCH = 4
11
11
  VERSION = [MAJOR, MINOR, PATCH].join('.')
12
12
  end
13
13
  end
@@ -1,6 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  require 'spec_helper.rb'
4
+ require 'term/ansicolor'
4
5
 
5
6
  describe Guard::Rubocop::Runner, :silence_output do
6
7
  include CaptureHelper
@@ -120,9 +121,9 @@ describe Guard::Rubocop::Runner, :silence_output do
120
121
  runner.stub(:notify)
121
122
  end
122
123
 
123
- it 'returns output of rubocop command' do
124
+ it 'returns uncolored output of rubocop command' do
124
125
  captured_output = capture(:stdout) { runner.run(paths) }
125
- runner.output.should == captured_output
126
+ runner.output.should == Term::ANSIColor.uncolor(captured_output)
126
127
  end
127
128
  end
128
129
  end
data/spec/spec_helper.rb CHANGED
@@ -14,7 +14,7 @@ SimpleCov.coverage_dir(File.join('spec', 'coverage'))
14
14
  if ENV['TRAVIS']
15
15
  require 'coveralls'
16
16
  SimpleCov.formatter = Coveralls::SimpleCov::Formatter
17
- elsif ENV['CI']
17
+ elsif ENV['CI'] # rubocop:disable IfUnlessModifier
18
18
  require 'simplecov-rcov'
19
19
  SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
20
20
  end
@@ -1,6 +1,7 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module CaptureHelper
4
+ # rubocop:disable Eval
4
5
  def capture(stream_name)
5
6
  stream_name = stream_name.to_s.downcase
6
7
  original_stream = eval("$#{stream_name}")
@@ -15,4 +16,5 @@ module CaptureHelper
15
16
 
16
17
  result
17
18
  end
19
+ # rubocop:enable Eval
18
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-01 00:00:00.000000000 Z
11
+ date: 2013-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -30,20 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - '>='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.1
33
+ version: 0.8.2
34
34
  - - <
35
35
  - !ruby/object:Gem::Version
36
- version: 1.0.0
36
+ version: 0.9.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '>='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.6.1
43
+ version: 0.8.2
44
44
  - - <
45
45
  - !ruby/object:Gem::Version
46
- version: 1.0.0
46
+ version: 0.9.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: childprocess
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ~>
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0.3'
61
+ - !ruby/object:Gem::Dependency
62
+ name: term-ansicolor
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: '1.1'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ version: '1.1'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: bundler
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -118,28 +132,28 @@ dependencies:
118
132
  name: guard-rspec
119
133
  requirement: !ruby/object:Gem::Requirement
120
134
  requirements:
121
- - - '>='
135
+ - - ~>
122
136
  - !ruby/object:Gem::Version
123
- version: 2.5.4
137
+ version: '3.0'
124
138
  type: :development
125
139
  prerelease: false
126
140
  version_requirements: !ruby/object:Gem::Requirement
127
141
  requirements:
128
- - - '>='
142
+ - - ~>
129
143
  - !ruby/object:Gem::Version
130
- version: 2.5.4
144
+ version: '3.0'
131
145
  - !ruby/object:Gem::Dependency
132
146
  name: ruby_gntp
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
- - - '>='
149
+ - - ~>
136
150
  - !ruby/object:Gem::Version
137
151
  version: '0.3'
138
152
  type: :development
139
153
  prerelease: false
140
154
  version_requirements: !ruby/object:Gem::Requirement
141
155
  requirements:
142
- - - '>='
156
+ - - ~>
143
157
  - !ruby/object:Gem::Version
144
158
  version: '0.3'
145
159
  description: Guard::Rubocop allows you to automatically check Ruby code style with
@@ -150,8 +164,6 @@ executables: []
150
164
  extensions: []
151
165
  extra_rdoc_files: []
152
166
  files:
153
- - .gitignore
154
- - .travis.yml
155
167
  - Gemfile
156
168
  - Guardfile
157
169
  - LICENSE.txt
@@ -162,7 +174,6 @@ files:
162
174
  - lib/guard/rubocop/runner.rb
163
175
  - lib/guard/rubocop/templates/Guardfile
164
176
  - lib/guard/rubocop/version.rb
165
- - spec/.rubocop.yml
166
177
  - spec/guard/rubocop/runner_spec.rb
167
178
  - spec/guard/rubocop_spec.rb
168
179
  - spec/spec_helper.rb
@@ -193,7 +204,6 @@ signing_key:
193
204
  specification_version: 4
194
205
  summary: Guard plugin for RuboCop
195
206
  test_files:
196
- - spec/.rubocop.yml
197
207
  - spec/guard/rubocop/runner_spec.rb
198
208
  - spec/guard/rubocop_spec.rb
199
209
  - spec/spec_helper.rb
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- script: bundle exec rspec
data/spec/.rubocop.yml DELETED
@@ -1,4 +0,0 @@
1
- # Avoid warning "Possibly useless use of == in void context"
2
- # for `should ==`
3
- Syntax:
4
- Enabled: false