Sha256: ae29ae932335df11b9bcc22b7ae68b747427c7c13881aa4d938861e9103fda90
Contents?: true
Size: 1.13 KB
Versions: 42
Compression:
Stored size: 1.13 KB
Contents
module FWToolkit module Executable class ThorRunner def run(command, config={}) Thor::Actions::run(command, config) end def report_error(command, command_output) command_output.gsub!(/e\[\d+m/, '') #Stripping colors say "An error has occured while running: \"#{command}\"", :red say 'Command output:' raise Thor::Error, "\n***\n#{command_output}***" end end class CliRunner def run(command, config={}) `#{command}` end def report_error(command, command_output) command_output.gsub!(/e\[\d+m/, '') puts "An error has occured while running: \"#{command}\"", :red puts 'Command output:' raise "\n***\n#{command_output}***" end end def self.runner=(runner) @@runner = runner end def run(command, options = {}) cmd_output = @@runner.run command, options @@runner.report_error(command, cmd_output) if options[:raise_errors] && !$?.success? end def run!(command, options = {}) config.merge!({ :raise_errors => true }) run command config end end end
Version data entries
42 entries across 42 versions & 1 rubygems