Class: Phare::CheckSuite
- Inherits:
-
Object
- Object
- Phare::CheckSuite
- Defined in:
- lib/phare/check_suite.rb
Constant Summary collapse
- DEFAULT_CHECKS =
{ rubocop: Check::Rubocop, scsslint: Check::ScssLint, jshint: Check::JSHint, jscs: Check::JSCS }
Instance Attribute Summary collapse
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #checks ⇒ Object
-
#initialize(options = {}) ⇒ CheckSuite
constructor
A new instance of CheckSuite.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CheckSuite
Returns a new instance of CheckSuite.
12 13 14 15 16 17 18 19 20 |
# File 'lib/phare/check_suite.rb', line 12 def initialize( = {}) @options = @directory = [:directory] @directory << '/' unless @directory.end_with?('/') @options[:skip] ||= [] @options[:only] ||= [] end |
Instance Attribute Details
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/phare/check_suite.rb', line 3 def status @status end |
Instance Method Details
#checks ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/phare/check_suite.rb', line 22 def checks checks = DEFAULT_CHECKS.keys if @options[:only].any? checks &= @options[:only] elsif @options[:skip] checks - @options[:skip] else checks end end |
#run ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/phare/check_suite.rb', line 34 def run @checks = checks.map do |check| check = DEFAULT_CHECKS[check] check.new(@directory, @options).tap(&:run).status end @status = @checks.find { |status| status > 0 } || 0 end |