lib/fulmar/shell.rb in fulmar-shell-1.6.6 vs lib/fulmar/shell.rb in fulmar-shell-1.6.7
- old
+ new
@@ -3,18 +3,18 @@
# This shell is part of the fulmar deployment tools
# it can be used stand-alone, though
module Fulmar
# Implements simple access to shell commands
class Shell
- VERSION = '1.6.6'
+ VERSION = '1.6.7'
attr_accessor :debug, :last_output, :last_error, :quiet, :strict
attr_reader :path
DEFAULT_OPTIONS = {
login: false,
- bundler: true #
+ escape_bundler: false
}
def initialize(path = '.', host = 'localhost')
@host = host.nil? ? 'no_hostname_set' : host
@path = (path.nil? || path.empty?) ? '.' : path
@@ -81,10 +81,11 @@
bundler_variable_parts = %w(ruby gem_ bundle)
# Remove any variables which contain the words above
env.delete_if { |key| bundler_variable_parts.select { |part| key.downcase.include?(part) }.any? }
env['PATH'] = path_without_bundler
end
+ puts "Environment: #{env.inspect}" if @debug
env
end
def path_without_bundler
ENV['PATH'].split(':').reject { |path| path.include?('ruby') || path.include?('gems') }.join(':')
@@ -113,16 +114,18 @@
_stdin.close
return_value = wait_thread.value
- if @strict and return_value != 0
+ if @strict and return_value.exitstatus != 0
dump_error_message(command)
fail error_message
end
end
- return_value == 0
+ puts "Program exited with status #{return_value.exitstatus}." if @debug
+
+ return_value.exitstatus == 0
end
def escape_for_sh(text)
text.gsub('\\', '\\\\').gsub("'", "'\\\\''")
end