Class: Capistrano::DSL::Ec2::Minimal::Instances
- Inherits:
-
Object
- Object
- Capistrano::DSL::Ec2::Minimal::Instances
- Includes:
- Enumerable
- Defined in:
- lib/capistrano/ec2/minimal.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize ⇒ Instances
constructor
A new instance of Instances.
Constructor Details
#initialize ⇒ Instances
Returns a new instance of Instances.
11 12 13 14 15 16 17 18 19 |
# File 'lib/capistrano/ec2/minimal.rb', line 11 def initialize ec2 = Aws::EC2::Client.new filters = [ { name: 'tag:Project', values: [fetch(:application)] }, { name: 'tag:Stage', values: [fetch(:stage)] }, { name: 'instance-state-name', values: %w(running) }, ] @reservations = ec2.describe_instances(filters: filters).reservations end |
Instance Method Details
#each ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/capistrano/ec2/minimal.rb', line 21 def each @reservations.each do |reservation| reservation.instances.each do |instance| yield(instance) end end end |