Class: Capistrano::Configuration
- Inherits:
-
Object
- Object
- Capistrano::Configuration
show all
- Defined in:
- lib/capistrano/configuration.rb,
lib/capistrano/configuration/server.rb,
lib/capistrano/configuration/servers.rb,
lib/capistrano/configuration/question.rb,
lib/capistrano/configuration/servers/host_filter.rb,
lib/capistrano/configuration/servers/role_filter.rb
Defined Under Namespace
Classes: Question, Server, Servers
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#backend ⇒ Object
59
60
61
|
# File 'lib/capistrano/configuration.rb', line 59
def backend
@backend ||= SSHKit
end
|
Class Method Details
.env ⇒ Object
9
10
11
|
# File 'lib/capistrano/configuration.rb', line 9
def env
@env ||= new
end
|
.reset! ⇒ Object
13
14
15
|
# File 'lib/capistrano/configuration.rb', line 13
def reset!
@env = new
end
|
Instance Method Details
#ask(key, default = nil) ⇒ Object
18
19
20
21
|
# File 'lib/capistrano/configuration.rb', line 18
def ask(key, default=nil)
question = Question.new(self, key, default)
set(key, question)
end
|
65
66
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/capistrano/configuration.rb', line 65
def configure_backend
backend.configure do |sshkit|
sshkit.format = fetch(:format)
sshkit.output_verbosity = fetch(:log_level)
sshkit.default_env = fetch(:default_env)
sshkit.backend = fetch(:sshkit_backend, SSHKit::Backend::Netssh)
sshkit.backend.configure do |backend|
backend.pty = fetch(:pty)
backend.connection_timeout = fetch(:connection_timeout)
backend.ssh_options = fetch(:ssh_options) if fetch(:ssh_options)
end
end
end
|
#delete(key) ⇒ Object
27
28
29
|
# File 'lib/capistrano/configuration.rb', line 27
def delete(key)
config.delete(key)
end
|
#fetch(key, default = nil, &block) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/capistrano/configuration.rb', line 31
def fetch(key, default=nil, &block)
value = fetch_for(key, default, &block)
while callable_without_parameters?(value)
value = set(key, value.call)
end
return value
end
|
#primary(role) ⇒ Object
55
56
57
|
# File 'lib/capistrano/configuration.rb', line 55
def primary(role)
servers.fetch_primary(role)
end
|
#role(name, hosts, options = {}) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/capistrano/configuration.rb', line 39
def role(name, hosts, options={})
if name == :all
raise ArgumentError.new("#{name} reserved name for role. Please choose another name")
end
servers.add_role(name, hosts, options)
end
|
#roles_for(names) ⇒ Object
51
52
53
|
# File 'lib/capistrano/configuration.rb', line 51
def roles_for(names)
servers.roles_for(names)
end
|
#server(name, properties = {}) ⇒ Object
47
48
49
|
# File 'lib/capistrano/configuration.rb', line 47
def server(name, properties={})
servers.add_host(name, properties)
end
|
#set(key, value) ⇒ Object
23
24
25
|
# File 'lib/capistrano/configuration.rb', line 23
def set(key, value)
config[key] = value
end
|
#timestamp ⇒ Object
79
80
81
|
# File 'lib/capistrano/configuration.rb', line 79
def timestamp
@timestamp ||= Time.now.utc
end
|