code_hunter 0.1.2 → 0.1.3
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.
- data/README.md +5 -2
- data/lib/code_hunter/option_parser.rb +5 -2
- data/lib/code_hunter/runner.rb +5 -5
- data/lib/code_hunter/version.rb +1 -1
- data/spec/code_hunter/runner_spec.rb +61 -0
- metadata +5 -2
data/README.md
CHANGED
@@ -15,8 +15,11 @@ $ gem install code_hunter
|
|
15
15
|
```
|
16
16
|
$ code_hunter --help
|
17
17
|
Usage: code_hunter [options]
|
18
|
-
--application-path= (default:
|
19
|
-
--format= (default:
|
18
|
+
--application-path= (default: ./) rails application root path
|
19
|
+
--format= (default: yaml) output format (yaml or json)
|
20
|
+
--no-brakeman (default: false) disable brakeman
|
21
|
+
--no-pendaxes (default: false) disable pendaxes
|
22
|
+
--no-rails-best-practices (default: false) disable rails-best-practices
|
20
23
|
|
21
24
|
$ code_hunter --application-path /path/to/rails/root
|
22
25
|
...
|
@@ -3,8 +3,11 @@ require "optparse"
|
|
3
3
|
module CodeHunter
|
4
4
|
class OptionParser < ::OptionParser
|
5
5
|
OPTIONS = [
|
6
|
-
"--application-path=",
|
7
|
-
"--format=",
|
6
|
+
"--application-path=", "(default: ./) rails application root path",
|
7
|
+
"--format=", "(default: yaml) output format (yaml or json)",
|
8
|
+
"--no-brakeman", "(default: false) disable brakeman",
|
9
|
+
"--no-pendaxes", "(default: false) disable pendaxes",
|
10
|
+
"--no-rails-best-practices", "(default: false) disable rails-best-practices",
|
8
11
|
]
|
9
12
|
|
10
13
|
def self.parse!(argv)
|
data/lib/code_hunter/runner.rb
CHANGED
@@ -31,11 +31,11 @@ module CodeHunter
|
|
31
31
|
private
|
32
32
|
|
33
33
|
def services
|
34
|
-
[
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
array = []
|
35
|
+
array << Pendaxes if options[:pendaxes] != false
|
36
|
+
array << RailsBestPractices if options[:rails_best_practices] != false
|
37
|
+
array << Brakeman if options[:brakeman] != false
|
38
|
+
array.map {|klass| klass.new(options) }
|
39
39
|
end
|
40
40
|
|
41
41
|
def run_with_application_path
|
data/lib/code_hunter/version.rb
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module CodeHunter
|
4
|
+
describe Runner do
|
5
|
+
let(:instance) do
|
6
|
+
described_class.new(argv)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:argv) do
|
10
|
+
[]
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#services" do
|
14
|
+
subject(:services) do
|
15
|
+
instance.send(:services)
|
16
|
+
end
|
17
|
+
|
18
|
+
context "by default" do
|
19
|
+
it "returns all service instances" do
|
20
|
+
services.should have(3).services
|
21
|
+
services[0].should be_a Pendaxes
|
22
|
+
services[1].should be_a RailsBestPractices
|
23
|
+
services[2].should be_a Brakeman
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context "with --no-pendaxes option" do
|
28
|
+
before do
|
29
|
+
argv << "--no-pendaxes"
|
30
|
+
end
|
31
|
+
it "returns services without pendaxes" do
|
32
|
+
services.should have(2).services
|
33
|
+
services[0].should be_a RailsBestPractices
|
34
|
+
services[1].should be_a Brakeman
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "with --no-rails-best-practices option" do
|
39
|
+
before do
|
40
|
+
argv << "--no-rails-best-practices"
|
41
|
+
end
|
42
|
+
it "returns services without rails-best-practices" do
|
43
|
+
services.should have(2).services
|
44
|
+
services[0].should be_a Pendaxes
|
45
|
+
services[1].should be_a Brakeman
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "with --no-brakeman option" do
|
50
|
+
before do
|
51
|
+
argv << "--no-brakeman"
|
52
|
+
end
|
53
|
+
it "returns services without brakeman" do
|
54
|
+
services.should have(2).services
|
55
|
+
services[0].should be_a Pendaxes
|
56
|
+
services[1].should be_a RailsBestPractices
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_hunter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- lib/code_hunter/version.rb
|
154
154
|
- spec/code_hunter/pendaxes_spec.rb
|
155
155
|
- spec/code_hunter/renderer_spec.rb
|
156
|
+
- spec/code_hunter/runner_spec.rb
|
156
157
|
- spec/spec_helper.rb
|
157
158
|
homepage: https://github.com/r7kamura/code_hunter
|
158
159
|
licenses: []
|
@@ -181,4 +182,6 @@ summary: Code hunter
|
|
181
182
|
test_files:
|
182
183
|
- spec/code_hunter/pendaxes_spec.rb
|
183
184
|
- spec/code_hunter/renderer_spec.rb
|
185
|
+
- spec/code_hunter/runner_spec.rb
|
184
186
|
- spec/spec_helper.rb
|
187
|
+
has_rdoc:
|