Sha256: 4e225157f263b9c3bc040033b763b63d6301a7856e1aa627d64133e97c6ada8c
Contents?: true
Size: 976 Bytes
Versions: 3
Compression:
Stored size: 976 Bytes
Contents
require 'thor' require 'awspec/setup' module Awspec class Generate < Thor types = %w( vpc ec2 rds security_group ) types.each do |type| desc type + ' [vpc_id]', 'Generate VPC spec from VPC ID (or VPC "Name" tag)' define_method type do |*args| load_secrets vpc_id = args.first eval "puts Awspec::Generator::Spec::#{type.to_camel_case}.new.generate_from_vpc(vpc_id)" end end no_commands do def load_secrets creds = YAML.load_file('spec/secrets.yml') if File.exist?('spec/secrets.yml') creds = YAML.load_file('secrets.yml') if File.exist?('secrets.yml') Aws.config.update({ region: creds['region'], credentials: Aws::Credentials.new( creds['aws_access_key_id'], creds['aws_secret_access_key']) }) if creds end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
awspec-0.2.2 | lib/awspec/command/generate.rb |
awspec-0.2.1 | lib/awspec/command/generate.rb |
awspec-0.2.0 | lib/awspec/command/generate.rb |