Sha256: 414aa52d90ebb3a984595176ddb7a0b44adcdf4b07fcd3dd5e1683371977a7f4
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'bundler/setup' # Set up gems listed in the Gemfile. require 'ostruct' require 'yaml' module Massa class Analyzier attr_reader :verbose alias :verbose? :verbose def self.run!(options) new(options).run! end def initialize(verbose: false) @verbose = verbose end def run! Massa::Tool.list.each do |tool| Massa::CLI.colorize :blue, "➙ #{tool.description}" next unless gem_installed?(tool.gem_name, required: tool.required) execute(tool) end Massa::CLI.colorize :green, "~(‾▿‾)~ All good!" end def gem_installed?(name, required:) return true if `gem query -i #{name}`.chomp == 'true' Massa::CLI.colorize :yellow, "༼ つ ◕_◕ ༽つ '#{name}' is not installed" required ? exit(1) : false end def execute(tool) command_output = '' if verbose? system(tool.command) else IO.popen(tool.command, err: [:child, :out]) { |io| command_output = io.read } end unless $?.success? Massa::CLI.colorize :red, "¯\\_(ツ)_/¯ #{tool.description} failed." puts command_output if command_output.present? exit 1 if tool.required end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
massa-0.0.4 | lib/massa/analyzer.rb |
massa-0.0.3 | lib/massa/analyzer.rb |