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.
-
#single_host_stage ⇒ Object
returns a new stage which only contains one host.
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(name, file) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/deployer/stage.rb', line 26 def self.load(name, file) data = YAML.load_file(file) data.map do |_, 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 16 |
# File 'lib/deployer/stage.rb', line 9 def host(host, port, user) @hosts << { host: host, port: port, user: user } self end |