Sha256: 42f6ae533afbdbae3afa9a03baf8986fe66bed45a3ce7e7ed39489d54868d3ac

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

require 'instance_selector'

Capistrano::Configuration.instance(:must_exist).load do
  # Yes, this is a hack
  @instance_selector_instances = {}

  def instance_selector(cap_role, provider, args={})
    client = InstanceSelector::Connection.factory(provider)
    instances = client.instances(client.args_to_filters(args))
    role(cap_role, *instances.keys)

    @instance_selector_instances.merge!(instances)
  end

  # Not namespaced due to collision with the above method.
  desc "List all cloud instances for a stage"
  task :instance_selector_list do
    puts
    @instance_selector_instances.sort_by {|k,v| v[:name].to_s}.each do |k, v|
      puts k + "\t" + v.values.join("\t")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
instance_selector-0.0.19 lib/instance_selector/capistrano.rb
instance_selector-0.0.18 lib/instance_selector/capistrano.rb
instance_selector-0.0.17 lib/instance_selector/capistrano.rb
instance_selector-0.0.16 lib/instance_selector/capistrano.rb