Class: Deployer::Stage
- Inherits:
-
Object
- Object
- Deployer::Stage
- Defined in:
- lib/deployer/stage.rb
Instance Attribute Summary collapse
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #host(host, port, user) ⇒ Object
-
#initialize(name) ⇒ Stage
constructor
A new instance of Stage.
Constructor Details
#initialize(name) ⇒ Stage
Returns a new instance of Stage.
4 5 6 7 |
# File 'lib/deployer/stage.rb', line 4 def initialize(name) @name = name @hosts = [] end |
Instance Attribute Details
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
2 3 4 |
# File 'lib/deployer/stage.rb', line 2 def hosts @hosts end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/deployer/stage.rb', line 2 def name @name end |
Class Method Details
.load(file) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/deployer/stage.rb', line 17 def self.load(file) data = YAML.load_file(file) data.map do |name, config| stage = Deployer::Stage.new(name) config['hosts'].each do |host| stage.host(host['host'], host['port'], host['user']) end stage end.first end |
Instance Method Details
#host(host, port, user) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/deployer/stage.rb', line 9 def host(host, port, user) @hosts << { host: host, port: port, user: user } end |