Module: Capistrano::DSL::Env
Defined Under Namespace
Classes: CurrentEnvironmentNotSetError, Store
Instance Method Summary
collapse
Instance Method Details
#any?(key) ⇒ Boolean
49
50
51
52
53
54
55
56
|
# File 'lib/capistrano_dsl.rb', line 49
def any?(key)
value = fetch(key)
if value && value.respond_to?(:any?)
value.any?
else
!fetch(key).nil?
end
end
|
#clear_env ⇒ Object
76
77
78
|
# File 'lib/capistrano_dsl.rb', line 76
def clear_env
env.clear
end
|
#current_environment ⇒ Object
71
72
73
74
|
# File 'lib/capistrano_dsl.rb', line 71
def current_environment
raise CurrentEnvironmentNotSetError.new('Must set current environment') unless env[:current_environment]
env[:current_environment]
end
|
#delete(key) ⇒ Object
62
63
64
|
# File 'lib/capistrano_dsl.rb', line 62
def delete(key)
env[current_environment].delete(key)
end
|
#env ⇒ Object
41
42
43
|
# File 'lib/capistrano_dsl.rb', line 41
def env
Store.instance
end
|
#fetch(key, default = nil, &block) ⇒ Object
45
46
47
|
# File 'lib/capistrano_dsl.rb', line 45
def fetch(key, default=nil, &block)
env[current_environment][key] || default
end
|
#set(key, value) ⇒ Object
58
59
60
|
# File 'lib/capistrano_dsl.rb', line 58
def set(key, value)
env[current_environment][key] = value
end
|
#set_current_environment(environment) ⇒ Object
66
67
68
69
|
# File 'lib/capistrano_dsl.rb', line 66
def set_current_environment(environment)
env[:current_environment] = environment
env[environment] ||= {}
end
|