Class: Massa::Analyzier
- Inherits:
-
Object
- Object
- Massa::Analyzier
- Defined in:
- lib/massa/analyzer.rb
Instance Attribute Summary collapse
-
#verbose ⇒ Object
(also: #verbose?)
readonly
Returns the value of attribute verbose.
Class Method Summary collapse
Instance Method Summary collapse
- #execute(tool) ⇒ Object
- #gem_installed?(tool) ⇒ Boolean
-
#initialize(verbose: false) ⇒ Analyzier
constructor
A new instance of Analyzier.
- #run! ⇒ Object
Constructor Details
#initialize(verbose: false) ⇒ Analyzier
Returns a new instance of Analyzier.
18 19 20 |
# File 'lib/massa/analyzer.rb', line 18 def initialize(verbose: false) @verbose = verbose end |
Instance Attribute Details
#verbose ⇒ Object (readonly) Also known as: verbose?
Returns the value of attribute verbose.
10 11 12 |
# File 'lib/massa/analyzer.rb', line 10 def verbose @verbose end |
Class Method Details
.run!(options) ⇒ Object
14 15 16 |
# File 'lib/massa/analyzer.rb', line 14 def self.run!() new(**).run! end |
Instance Method Details
#execute(tool) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/massa/analyzer.rb', line 42 def execute(tool) command_output = '' if verbose? system(tool.command) else IO.popen(tool.command, err: %i[child out]) { |io| command_output = io.read } end return if $CHILD_STATUS.success? Massa::CLI.colorize :red, "¯\\_(ツ)_/¯ #{tool.description} failed:" Massa::CLI.colorize :yellow, "$ #{tool.command}" puts command_output if command_output.to_s != '' exit 1 if tool.required? end |