Class: Capistrano::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/super_mega_ultra_capistrano_extensions.rb

Instance Method Summary collapse

Instance Method Details

#environmentObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/super_mega_ultra_capistrano_extensions.rb', line 9

def environment
  return if options[:env].nil? || options[:env].empty?

  @environment ||= if String === options[:env]
    "env #{options[:env]}"
  else
    options[:env][:environment] ? ". #{options[:env][:environment]}; " : '' +
    options[:env].reject do |key, value|
      key == :environment
    end.inject("env") do |string, (name, value)|
      value = value.to_s.gsub(/[ "]/) { |m| "\\#{m}" }
      string << " #{name}=#{value}"
    end
  end
end