Module: Sunzi::Cli::Capistrano
Instance Attribute Summary collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/sunzi/cli/capistrano.rb', line 28
def method_missing(name, *args, &block)
if caller.join.include? 'load_env'
else
super
end
end
|
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
5
6
7
|
# File 'lib/sunzi/cli/capistrano.rb', line 5
def env
@env
end
|
Instance Method Details
#fetch(key, value = nil) ⇒ Object
20
21
22
23
24
25
26
|
# File 'lib/sunzi/cli/capistrano.rb', line 20
def fetch(key, value = nil)
if @env.has_key?(key)
@env[key]
else
@env[key] = value
end
end
|
#load_env(stage) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/sunzi/cli/capistrano.rb', line 8
def load_env(stage)
deploy_path = File.expand_path('config/deploy.rb')
stage_path = File.expand_path("config/deploy/#{stage}.rb")
instance_eval(File.read(deploy_path), deploy_path)
instance_eval(File.read(stage_path), stage_path)
@env = HashWithIndifferentAccess.new(@env)
end
|
#set(key, value) ⇒ Object
16
17
18
|
# File 'lib/sunzi/cli/capistrano.rb', line 16
def set(key, value)
@env[key] = value
end
|