Class: Scanny::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Scanny::RakeTask
- Defined in:
- lib/scanny/rake_task.rb
Instance Attribute Summary collapse
-
#disable ⇒ Object
list of disabled checks.
-
#fail_on_error ⇒ Object
raise exception on error.
-
#format ⇒ Object
output format.
-
#include ⇒ Object
paths to custom checks.
-
#name ⇒ Object
name of rake task.
-
#path ⇒ Object
custom path to scan.
-
#ruby_mode ⇒ Object
ruby mode.
-
#strict ⇒ Object
strict mode.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name = :scanny) {|_self| ... } ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(name = :scanny) {|_self| ... } ⇒ RakeTask
Returns a new instance of RakeTask.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/scanny/rake_task.rb', line 23 def initialize(name=:scanny) @name = name @include = [] @disable = [] @format = nil @strict = nil @path = nil @fail_on_error = nil @ruby_mode = nil yield self if block_given? define end |
Instance Attribute Details
#disable ⇒ Object
list of disabled checks
11 12 13 |
# File 'lib/scanny/rake_task.rb', line 11 def disable @disable end |
#fail_on_error ⇒ Object
raise exception on error
19 20 21 |
# File 'lib/scanny/rake_task.rb', line 19 def fail_on_error @fail_on_error end |
#format ⇒ Object
output format
13 14 15 |
# File 'lib/scanny/rake_task.rb', line 13 def format @format end |
#include ⇒ Object
paths to custom checks
9 10 11 |
# File 'lib/scanny/rake_task.rb', line 9 def include @include end |
#name ⇒ Object
name of rake task
7 8 9 |
# File 'lib/scanny/rake_task.rb', line 7 def name @name end |
#path ⇒ Object
custom path to scan
17 18 19 |
# File 'lib/scanny/rake_task.rb', line 17 def path @path end |
#ruby_mode ⇒ Object
ruby mode
21 22 23 |
# File 'lib/scanny/rake_task.rb', line 21 def ruby_mode @ruby_mode end |
#strict ⇒ Object
strict mode
15 16 17 |
# File 'lib/scanny/rake_task.rb', line 15 def strict @strict end |
Instance Method Details
#define ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/scanny/rake_task.rb', line 37 def define desc("Run scanny security scanner") task name do cmd = ["scanny"] cmd << ["-i"] + [@include] unless @include.empty? cmd << ["-d"] + [@disable] unless @disable.empty? cmd << ["-f #{@format}"] if @format cmd << ["-s"] if @strict cmd << ["-m #{@ruby_mode}"] if @ruby_mode cmd << [@path] if @path cmd = cmd.flatten.join(" ") unless system(cmd) raise("Command #{cmd} failed") if fail_on_error end end end |