Class: AwsEnvironment
- Inherits:
-
Object
- Object
- AwsEnvironment
- Defined in:
- lib/ebx/aws_environment.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
- #create ⇒ Object
- #describe ⇒ Object
-
#initialize(settings) ⇒ AwsEnvironment
constructor
A new instance of AwsEnvironment.
- #name ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(settings) ⇒ AwsEnvironment
Returns a new instance of AwsEnvironment.
4 5 6 |
# File 'lib/ebx/aws_environment.rb', line 4 def initialize(settings) @settings = settings end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
2 3 4 |
# File 'lib/ebx/aws_environment.rb', line 2 def settings @settings end |
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ebx/aws_environment.rb', line 8 def create begin if describe[:environments].empty? ElasticBeanstalk.instance.client.create_environment( application_name: settings['name'], version_label: version, environment_name: name, solution_stack_name: settings['solution_stack'], #option_settings: [{ # namespace: 'aws:autoscaling:launchconfiguration', # option_name: 'IamInstanceProfile', # option_value: 'ElasticBeanstalkProfile' #}] ) end rescue Exception raise $! # TODO end end |
#describe ⇒ Object
36 37 38 39 40 41 |
# File 'lib/ebx/aws_environment.rb', line 36 def describe binding.pry ElasticBeanstalk.instance.client.describe_environments({ environment_names: [name] }) end |
#name ⇒ Object
32 33 34 |
# File 'lib/ebx/aws_environment.rb', line 32 def name "#{ENV['AWS_ENV']}-#{`git rev-parse --abbrev-ref HEAD`}".strip.gsub(/\s/, '-')[0..23] end |
#version ⇒ Object
28 29 30 |
# File 'lib/ebx/aws_environment.rb', line 28 def version `git rev-parse HEAD` end |