Sha256: a2b2cca4294ea11bb5f6ad47c4689f79b4e1d738296e856f59c34488c233b3ca
Contents?: true
Size: 1.22 KB
Versions: 4
Compression:
Stored size: 1.22 KB
Contents
require 'ec2ssh/ec2_instances' require 'erb' require 'stringio' module Ec2ssh class Builder def initialize(container) @container = container safe_level = nil erb_trim_mode = '%-' @host_lines_erb = ERB.new @container.host_line, safe_level, erb_trim_mode end def build_host_lines out = StringIO.new aws_keys.each do |name, key| out.puts "# section: #{name}" ec2s.instances(name).each do |instance| bind = instance.instance_eval { binding } next if @container.reject && @container.reject.call(instance) line = @host_lines_erb.result(bind).rstrip out.puts line unless line.empty? end end out.string.rstrip end def ec2s @ec2s ||= Ec2Instances.new aws_keys, @container.regions end def aws_keys @aws_keys ||= if @container.profiles keys = {} @container.profiles.each do |profile_name| keys[profile_name] = Ec2Instances.expand_profile_name_to_credential profile_name end keys else @container.aws_keys end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ec2ssh-3.1.1 | lib/ec2ssh/builder.rb |
ec2ssh-3.1.0 | lib/ec2ssh/builder.rb |
ec2ssh-3.1.0.rc2 | lib/ec2ssh/builder.rb |
ec2ssh-3.1.0.rc1 | lib/ec2ssh/builder.rb |