guard-brakeman 0.1 → 0.1.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.
data/README.md CHANGED
@@ -32,43 +32,20 @@ Guard::Brakeman can be adapted to all kind of projects and comes with a default
32
32
 
33
33
  ```ruby
34
34
  guard 'brakeman' do
35
- TODO
35
+ watch(%r{^app/.+\.(erb|haml|rhtml|rb)$})
36
+ watch(%r{^config/.+\.rb$})
37
+ watch(%r{^lib/.+\.rb$})
38
+ watch('Gemfile')
36
39
  end
37
40
  ```
38
41
 
39
42
  Please read the [Guard documentation](http://github.com/guard/guard#readme) for more information about the Guardfile DSL.
40
43
 
41
- ## Options
42
44
 
43
- You can pass any of the standard Brakeman CLI options using the :cli option:
44
-
45
- ```ruby
46
- guard 'brakeman', :cli => '-o output.tabs --message-limit -1 -q -x DefaultRoutes,Redirect'
47
- ```
48
-
49
- Former `:color`, `:drb`, `:port` and `:profile` options are thus deprecated and have no effect anymore.
50
45
 
51
46
  ### List of available options
52
47
 
53
48
  ```ruby
54
- :cli => '-o output.tabs -q' # Pass arbitrary Brakeman CLI arguments,
55
- # default: nil (print everything to the screen)
56
-
57
- :output => 'output.tabs' # Specify the output file (.tabs, .csv specify the format)
58
- # default: nil
59
-
60
- :format => 'csv' # Specify the report format
61
- # default: nil
62
-
63
- :disabled => ['DefaultRoutes','Redirect'] # Disable certain tests
64
- # default: nil
65
-
66
- :config => 'config/brakeman' # Use the specified brakeman configuraiton file
67
- # default: '.brakeman'
68
-
69
-
70
- :rvm => ['1.8.7', '1.9.2'] # Directly run your features on multiple ruby versions
71
- # default: nil
72
49
 
73
50
  ```
74
51
 
@@ -77,7 +54,7 @@ Former `:color`, `:drb`, `:port` and `:profile` options are thus deprecated and
77
54
  Issues
78
55
  ------
79
56
 
80
- You can report issues and feature requests to [GitHub Issues](https://github.com/netzpirat/guard-brakeman/issues). Try to figure out
57
+ You can report issues and feature requests to [GitHub Issues](https://github.com/oreoshake/guard-brakeman/issues). Try to figure out
81
58
  where the issue belongs to: Is it an issue with Guard itself or with Guard::Brakeman? Please don't
82
59
  ask the question in the issue tracker, instead join us in our [Google group](http://groups.google.com/group/guard-dev) or on
83
60
  `#guard` (irc.freenode.net).
@@ -1,6 +1,7 @@
1
1
  require 'guard'
2
2
  require 'guard/guard'
3
3
  require 'brakeman'
4
+ require 'brakeman/tracker'
4
5
 
5
6
  module Guard
6
7
 
@@ -36,11 +37,7 @@ module Guard
36
37
  print_failed @tracker
37
38
  end
38
39
 
39
- def tracker=tracker
40
- @tracker = tracker
41
- end
42
-
43
- # Gets called when all specs should be run.
40
+ # Gets called when all checks should be run.
44
41
  #
45
42
  # @raise [:task_has_failed] when stop has failed
46
43
  #
@@ -48,7 +45,7 @@ module Guard
48
45
  puts 'running all'
49
46
  @tracker = ::Brakeman.run :app_path => '.'
50
47
 
51
- passed = @tracker.checks.all_warnings.empty? && @tracker.errors.empty?
48
+ passed = clean_report?(@tracker)
52
49
 
53
50
  print_failed @tracker
54
51
 
@@ -78,30 +75,24 @@ module Guard
78
75
  #
79
76
  def run_on_change(paths)
80
77
  report = Runner.run(paths, @tracker, options)
81
- passed = !report.all_warnings.any?
82
-
83
78
  print_failed report
84
79
 
85
- if passed
86
- @failed_paths -= paths if @options[:keep_failed]
87
- else
88
- @failed_paths += get_failed_paths if @options[:keep_failed]
89
- @last_failed = true
90
- end
80
+ passed = !report.all_warnings.any?
91
81
 
92
82
  throw :task_has_failed unless passed
93
83
  end
94
84
 
95
85
  private
96
86
 
97
- def get_failed_paths tracker
98
- end
99
-
100
87
  def print_failed tracker
101
88
  checks = tracker.is_a?(::Brakeman::Tracker) ? tracker.checks.all_warnings : tracker.all_warnings
102
89
  checks.each do |w|
103
90
  puts w.to_row
104
91
  end
105
92
  end
93
+
94
+ def clean_report? tracker
95
+ tracker.checks.all_warnings.empty? && tracker.errors.empty?
96
+ end
106
97
  end
107
98
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-brakeman
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
16
- requirement: &70104236797260 !ruby/object:Gem::Requirement
16
+ requirement: &70310374822380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.2.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70104236797260
24
+ version_requirements: *70310374822380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70104236796560 !ruby/object:Gem::Requirement
27
+ requirement: &70310374840700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70104236796560
35
+ version_requirements: *70310374840700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: brakeman
38
- requirement: &70104236795520 !ruby/object:Gem::Requirement
38
+ requirement: &70310374840120 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.2'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70104236795520
46
+ version_requirements: *70310374840120
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70104236794920 !ruby/object:Gem::Requirement
49
+ requirement: &70310374839540 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.6.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70104236794920
57
+ version_requirements: *70310374839540
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: guard-rspec
60
- requirement: &70104236794340 !ruby/object:Gem::Requirement
60
+ requirement: &70310374838900 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 0.3.1
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70104236794340
68
+ version_requirements: *70310374838900
69
69
  description: Guard::Brakeman automatically scans your Rails app for vulnerabilities
70
70
  email:
71
71
  - neil@matatall.com
@@ -76,7 +76,6 @@ files:
76
76
  - lib/guard/brakeman/inspector.rb
77
77
  - lib/guard/brakeman/runner.rb
78
78
  - lib/guard/brakeman/templates/Guardfile
79
- - lib/guard/brakeman/version.rb
80
79
  - lib/guard/brakeman.rb
81
80
  - LICENSE
82
81
  - README.md
@@ -1,5 +0,0 @@
1
- require 'guard'
2
-
3
- module Guard::Brakeman
4
- VERSION = "0.1"
5
- end