Sha256: 145b433eb44e65b1c22139e3c95525d9a1eea8781ca46037553c086acb98fba7

Contents?: true

Size: 865 Bytes

Versions: 26

Compression:

Stored size: 865 Bytes

Contents

require 'thor'

class Thor
  module Actions
    alias_method :run_base, :run
    def run(command, config={})
      command_output = run_base(command, config)
      if config[:raise_errors] && !$?.success?
        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

    def run!(command, config={})
      config.merge!({ :raise_errors => true })
      run command, config
    end
  end
end


class Thor
  module Actions
    class EmptyDirectory
      protected
      def convert_encoded_instructions(filename)
        filename.gsub(/%(.*?)%/) do |initial_string|
          config[$1.strip.to_sym] or call_public_method($1.strip) or initial_string
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
fwtoolkit-2.2.2 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.2.1 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.2.0 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.10 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.9 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.8 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.7 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.6 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.5 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.4 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.3 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.1.1 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.0.7 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.0.6 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.0.5 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.0.4 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.0.3 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.0.2 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.0.1 lib/fwtoolkit/cli/ext/thor.rb
fwtoolkit-2.0.0 lib/fwtoolkit/cli/ext/thor.rb