guard-reek 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +15 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/guard-reek.gemspec +28 -0
- data/lib/guard/reek/templates/Guardfile +0 -0
- data/lib/guard/reek.rb +54 -0
- data/spec/guard/reek_spec.rb +96 -0
- data/spec/spec_helper.rb +15 -0
- metadata +170 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
guard :rspec do
|
2
|
+
watch(%r{^spec/.+_spec\.rb$})
|
3
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
4
|
+
watch('spec/spec_helper.rb') { "spec" }
|
5
|
+
end
|
6
|
+
|
7
|
+
guard :bundler do
|
8
|
+
watch('Gemfile')
|
9
|
+
watch('guard-reek.gemspec')
|
10
|
+
end
|
11
|
+
|
12
|
+
guard :reek do
|
13
|
+
watch("lib/guard/reek.rb")
|
14
|
+
watch(/^lib\/.*\.rb$/)
|
15
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Gustavo Villalta
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Guard::Reek
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'guard-reek'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install guard-reek
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/guard-reek.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "guard-reek"
|
7
|
+
gem.version = "0.0.1"
|
8
|
+
gem.authors = ["Gustavo Villalta"]
|
9
|
+
gem.email = ["gvillalta99@gmail.com"]
|
10
|
+
gem.description = %q{Guard::Reek automatically runs Reek when files change}
|
11
|
+
gem.summary = %q{Guard plugin for Reek}
|
12
|
+
gem.homepage = "https://github.com/gvillalta99/guard-reek"
|
13
|
+
gem.license = "MIT"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|gem|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'reek'
|
21
|
+
gem.add_dependency 'guard'
|
22
|
+
|
23
|
+
gem.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
gem.add_development_dependency "guard-rspec"
|
25
|
+
gem.add_development_dependency "guard-bundler"
|
26
|
+
gem.add_development_dependency "simplecov"
|
27
|
+
gem.add_development_dependency "rspec"
|
28
|
+
end
|
File without changes
|
data/lib/guard/reek.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/guard'
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
# Guard::Reek class, it implements an guard for reek task
|
6
|
+
class Reek < Guard
|
7
|
+
SUCCESS = ["Passed", { title: "Passed", image: :success }]
|
8
|
+
FAILED = ["Failed", { title: "Failed", image: :failed }]
|
9
|
+
|
10
|
+
attr_reader :last_result, :options
|
11
|
+
|
12
|
+
def initialize(watchers = [], options = {})
|
13
|
+
super
|
14
|
+
@options = options
|
15
|
+
@files = Dir["**/*"]
|
16
|
+
@files.select! do |file|
|
17
|
+
watchers.reduce(false) { |res, watcher| res || watcher.match(file) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def start
|
22
|
+
UI.info "Guard::Reek is running"
|
23
|
+
run_all
|
24
|
+
end
|
25
|
+
|
26
|
+
def run_all
|
27
|
+
self.class.reek @files
|
28
|
+
end
|
29
|
+
|
30
|
+
def run_on_changes path
|
31
|
+
self.class.reek path
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.reek(paths)
|
35
|
+
result = system command(paths)
|
36
|
+
|
37
|
+
notify(result)
|
38
|
+
@last_result = result
|
39
|
+
result
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.command paths
|
43
|
+
"reek -n #{paths.uniq.join(' ')}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.notify result
|
47
|
+
if result
|
48
|
+
Notifier.notify(*SUCCESS)
|
49
|
+
else
|
50
|
+
Notifier.notify(*FAILED)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Guard::Reek do
|
4
|
+
subject { reek }
|
5
|
+
let(:guard) { described_class.new }
|
6
|
+
|
7
|
+
before do
|
8
|
+
Guard::Notifier.stub :notify
|
9
|
+
|
10
|
+
Guard::UI.stub :info
|
11
|
+
Guard::UI.stub :error
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#start" do
|
15
|
+
subject(:start) { guard.start }
|
16
|
+
|
17
|
+
it "runs all" do
|
18
|
+
guard.should_receive :run_all
|
19
|
+
|
20
|
+
start
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#run_all" do
|
25
|
+
subject(:run_all) { guard.run_all }
|
26
|
+
|
27
|
+
it "runs reek" do
|
28
|
+
described_class.should_receive(:reek).with([])
|
29
|
+
|
30
|
+
run_all
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#run_on_changes" do
|
35
|
+
subject(:run_on_changes) { guard.run_on_changes "path" }
|
36
|
+
|
37
|
+
it "runs changed paths" do
|
38
|
+
described_class.should_receive(:reek).with("path")
|
39
|
+
|
40
|
+
run_on_changes
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe ".reek" do
|
45
|
+
before do
|
46
|
+
described_class.stub(:system)
|
47
|
+
described_class.stub(:command)
|
48
|
+
described_class.stub(:system).and_return(true)
|
49
|
+
end
|
50
|
+
|
51
|
+
subject(:reek) { described_class.reek("paths") }
|
52
|
+
|
53
|
+
it "calls the system" do
|
54
|
+
described_class.should_receive(:system)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "calls the reek command" do
|
58
|
+
described_class.should_receive(:command).with("paths")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "notifies guard the ddsuccess" do
|
62
|
+
described_class.should_receive(:notify)
|
63
|
+
end
|
64
|
+
|
65
|
+
after do
|
66
|
+
reek
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe ".command" do
|
71
|
+
subject(:command) { described_class.command ["path"] }
|
72
|
+
it { should =~ /-n/ }
|
73
|
+
it { should =~ /^reek/ }
|
74
|
+
it { should =~ /path$/ }
|
75
|
+
end
|
76
|
+
|
77
|
+
describe ".notify" do
|
78
|
+
context "well done" do
|
79
|
+
subject(:notify) { described_class.notify true }
|
80
|
+
it "notifies the success to notifier" do
|
81
|
+
Guard::Notifier.should_receive(:notify).with(*Guard::Reek::SUCCESS)
|
82
|
+
|
83
|
+
notify
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "something went wrong" do
|
88
|
+
subject(:notify) { described_class.notify false }
|
89
|
+
it "notifies the failure to notifier" do
|
90
|
+
Guard::Notifier.should_receive(:notify).with(*Guard::Reek::FAILED)
|
91
|
+
|
92
|
+
notify
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-reek
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gustavo Villalta
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-06-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: reek
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: guard
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.3'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.3'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: guard-rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: guard-bundler
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: simplecov
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: Guard::Reek automatically runs Reek when files change
|
127
|
+
email:
|
128
|
+
- gvillalta99@gmail.com
|
129
|
+
executables: []
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- .gitignore
|
134
|
+
- .rspec
|
135
|
+
- Gemfile
|
136
|
+
- Guardfile
|
137
|
+
- LICENSE.txt
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- guard-reek.gemspec
|
141
|
+
- lib/guard/reek.rb
|
142
|
+
- lib/guard/reek/templates/Guardfile
|
143
|
+
- spec/guard/reek_spec.rb
|
144
|
+
- spec/spec_helper.rb
|
145
|
+
homepage: https://github.com/gvillalta99/guard-reek
|
146
|
+
licenses:
|
147
|
+
- MIT
|
148
|
+
post_install_message:
|
149
|
+
rdoc_options: []
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - ! '>='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 1.8.25
|
167
|
+
signing_key:
|
168
|
+
specification_version: 3
|
169
|
+
summary: Guard plugin for Reek
|
170
|
+
test_files: []
|