lib/capistrano/command.rb
# prepare a space-separated sequence of variables assignments
# intended to be prepended to a command, so the shell sets
# the environment before running the command.
# i.e.: options[:env] = {'PATH' => '/opt/ruby/bin:$PATH',
#                        'TEST' => '( "quoted" )'}
# environment returns:
# "env TEST=(\ \"quoted\"\ ) PATH=/opt/ruby/bin:$PATH"
prepare a space-separated sequence of variables assignments
intended to be prepended to a command, so the shell sets
the environment before running the command.
prepare a space - separated sequence of variables assignments intended to be prepended to a command so the shell sets the environment before running the command .
def environment
        return if options[:env].nil? || options[:env].empty?
        @environment ||= if String === options[:env]
            "env #{options[:env]}"
          else
            options[:env].inject("env") do |string, (name, value)|
              value = value.to_s.gsub(/[ "]/) { |m| "\\#{m}" }
              string << " #{name}=#{value}"
            end
          end
      end
def environment return if options [ :env ] . nil? || options [ :env ] . empty? @environment ||= if String === options [ :env ] "env #{options[:env]}" else options [ :env ] . inject ( "env" ) do | string , ( name , value ) | value = value . to_s . gsub ( / [ "] / ) { | m | "\\#{m}" } string << " #{name}=#{value}" end end end
prepare a space-separated sequence of variables assignments
intended to be prepended to a command, so the shell sets
the environment before running the command.
prepare a space - separated sequence of variables assignments intended to be prepended to a command so the shell sets the environment before running the command .