Class: Dev::Template::Aws
- Inherits:
-
BaseInterface
- Object
- BaseInterface
- Dev::Template::Aws
- Defined in:
- lib/firespring_dev_commands/templates/aws.rb,
lib/firespring_dev_commands/templates/ci.rb
Overview
Class contains rake templates for managing your AWS settings and logging in
Defined Under Namespace
Classes: Ci
Instance Attribute Summary
Attributes inherited from BaseInterface
Instance Method Summary collapse
-
#create_ensure_credentials_task! ⇒ Object
Create the rake task which ensures active credentials are present.
-
#create_login_task! ⇒ Object
rubocop:disable Metrics/MethodLength Create the rake task for the aws credentials setup and login method.
-
#create_profile_task! ⇒ Object
Create the rake task for the aws profile method.
Methods inherited from BaseInterface
Constructor Details
This class inherits a constructor from Dev::Template::BaseInterface
Instance Method Details
#create_ensure_credentials_task! ⇒ Object
Create the rake task which ensures active credentials are present
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/firespring_dev_commands/templates/aws.rb', line 8 def create_ensure_credentials_task! # Have to set a local variable to be accessible inside of the instance_eval block exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do return if exclude.include?(:ensure_aws_credentials) task ensure_aws_credentials: %w(init) do raise 'AWS Credentials not found / expired' unless Dev::Aws::Credentials.new.active? end end end |
#create_login_task! ⇒ Object
rubocop:disable Metrics/MethodLength Create the rake task for the aws credentials setup and login method
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/firespring_dev_commands/templates/aws.rb', line 54 def create_login_task! # Have to set a local variable to be accessible inside of the instance_eval block exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace :aws do return if exclude.include?(:login) namespace :configure do desc 'Configure the default AWS login settings' task default: %w(init default:credentials default:config) do puts end namespace :default do desc 'Configure the default AWS login credentials' \ "\n\t(primarily used for rotating access keys)" task credentials: %w(init) do Dev::Aws::Credentials.new.base_setup! end task config: %w(init) do Dev::Aws::Account.new.base_setup! end end Dev::Aws::Account.new.children.each do |account| desc "Configure the #{account.name} account login settings" task account.id => %w(init) do Dev::Aws::Account.new.setup!(account.id) end end end desc 'Select the account you wish to log in to' task login: %w(init) do Dev::Aws::Login.new.login! end end end end |
#create_profile_task! ⇒ Object
Create the rake task for the aws profile method
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/firespring_dev_commands/templates/aws.rb', line 22 def create_profile_task! # Have to set a local variable to be accessible inside of the instance_eval block exclude = @exclude DEV_COMMANDS_TOP_LEVEL.instance_eval do namespace :aws do return if exclude.include?(:profile) desc 'Show the current profile/aws account you are configured to use' task profile: %w(init) do Dev::Aws::Profile.new.info end namespace :profile do desc 'Return the commands to export your AWS credentials into your environment' task :export do # Turn off all logging except for errors LOG.level = Logger::ERROR # Run the init Rake::Task[:init].invoke # Print the export info Dev::Aws::Profile.new.export_info end end end end end |