guard-brakeman 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/guard/brakeman.rb +11 -4
  2. metadata +3 -3
@@ -9,6 +9,13 @@ module Guard
9
9
  # Guard events: `start`, `stop`, `reload`, `run_all` and `run_on_change`.
10
10
  #
11
11
  class Brakeman < Guard
12
+ def initialize(watchers = [], options = { })
13
+ super
14
+ @options = {
15
+ :notifications => true
16
+ }.update(options)
17
+ end
18
+
12
19
  # Gets called once when Guard starts.
13
20
  #
14
21
  # @raise [:task_has_failed] when stop has failed
@@ -49,7 +56,7 @@ module Guard
49
56
  def print_failed report
50
57
  UI.warning "\n------ brakeman warnings --------\n"
51
58
 
52
- Notifier.notify("#{report.all_warnings.count} brakeman findings", :title => "Brakeman results", :image => :pending)
59
+ Notifier.notify("#{report.all_warnings.count} brakeman findings", :title => "Brakeman results", :image => :pending) if @options[:notifications]
53
60
  puts report.all_warnings.sort_by { |w| w.confidence }
54
61
  end
55
62
 
@@ -58,7 +65,7 @@ module Guard
58
65
 
59
66
  unless report.fixed_warnings.empty?
60
67
  message = "#{report.fixed_warnings.length} fixed warning(s)"
61
- Notifier.notify(message, :title => "Brakeman results", :image => :success)
68
+ Notifier.notify(message, :title => "Brakeman results", :image => :success) if @options[:notifications]
62
69
  UI.info(message + ":")
63
70
  puts report.fixed_warnings.sort_by { |w| w.confidence }
64
71
  puts
@@ -66,7 +73,7 @@ module Guard
66
73
 
67
74
  unless report.new_warnings.empty?
68
75
  message = "#{report.new_warnings.length} new warning(s)"
69
- Notifier.notify(message, :title => "Brakeman results", :image => :failed)
76
+ Notifier.notify(message, :title => "Brakeman results", :image => :failed) if @options[:notifications]
70
77
  UI.warning message + ":"
71
78
  puts report.new_warnings.sort_by { |w| w.confidence }
72
79
  puts
@@ -74,7 +81,7 @@ module Guard
74
81
 
75
82
  unless report.existing_warnings.empty?
76
83
  message = "#{report.existing_warnings.length} previous warning(s)"
77
- Notifier.notify(message, :title => "Brakeman results", :image => :pending)
84
+ Notifier.notify(message, :title => "Brakeman results", :image => :pending) if @options[:notifications]
78
85
  UI.warning message + ":"
79
86
  puts report.existing_warnings.sort_by { |w| w.confidence }
80
87
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-brakeman
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 6
10
- version: 0.1.6
9
+ - 7
10
+ version: 0.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Neil Matatall