Class: EC2Launcher::DSL::Environment
- Inherits:
-
Object
- Object
- EC2Launcher::DSL::Environment
- Includes:
- EmailNotifications, SecurityGroupHandler
- Defined in:
- lib/ec2launcher/dsl/environment.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#postcommands ⇒ Object
readonly
Returns the value of attribute postcommands.
-
#precommands ⇒ Object
readonly
Returns the value of attribute precommands.
Attributes included from EmailNotifications
Class Method Summary collapse
Instance Method Summary collapse
- #environment(name) {|_self| ... } ⇒ Object
-
#initialize ⇒ Environment
constructor
A new instance of Environment.
- #load(dsl) ⇒ Object
-
#merge(other_env) ⇒ Object
Takes values from the other environment and merges them into this one.
Methods included from SecurityGroupHandler
#security_groups, #security_groups_for_environment
Methods included from EmailNotifications
Constructor Details
#initialize ⇒ Environment
Returns a new instance of Environment.
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ec2launcher/dsl/environment.rb', line 46 def initialize() @aliases = [] @email_notifications = nil @gems = [] @packages = [] @precommand = [] @postcommand = [] @roles = [] @security_groups = {} @use_rvm = true end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/ec2launcher/dsl/environment.rb', line 14 def name @name end |
#postcommands ⇒ Object (readonly)
Returns the value of attribute postcommands.
16 17 18 |
# File 'lib/ec2launcher/dsl/environment.rb', line 16 def postcommands @postcommands end |
#precommands ⇒ Object (readonly)
Returns the value of attribute precommands.
15 16 17 |
# File 'lib/ec2launcher/dsl/environment.rb', line 15 def precommands @precommands end |
Class Method Details
.load(dsl) ⇒ Object
105 106 107 108 |
# File 'lib/ec2launcher/dsl/environment.rb', line 105 def self.load(dsl) env = EC2Launcher::DSL::Environment.new.instance_eval(dsl) env end |
Instance Method Details
#environment(name) {|_self| ... } ⇒ Object
59 60 61 62 63 |
# File 'lib/ec2launcher/dsl/environment.rb', line 59 def environment(name) @name = name yield self self end |
#load(dsl) ⇒ Object
100 101 102 103 |
# File 'lib/ec2launcher/dsl/environment.rb', line 100 def load(dsl) self.instance_eval(dsl) self end |
#merge(other_env) ⇒ Object
Takes values from the other environment and merges them into this one
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 95 96 97 98 |
# File 'lib/ec2launcher/dsl/environment.rb', line 66 def merge(other_env) @name =other_env.name @gems += other_env.gems unless other_env.gems.nil? @packages += other_env.packages unless other_env.packages.nil? @roles += other_env.roles unless other_env.roles.nil? @precommand += other_env.precommand unless other_env.precommand.nil? @postcommand += other_env.postcommand unless other_env.postcommand.nil? unless other_env.security_groups.nil? other_env.security_groups.keys.each do |key| @security_groups[key] = [] if @security_groups[key].nil? @security_groups[key] += other_env.security_groups[key] end end @aliases = other_env.aliases.nil? ? nil : other_env.aliases @ami_name = other_env.ami_name unless other_env.ami_name.nil? @aws_keyfile = other_env.aws_keyfile unless other_env.aws_keyfile.nil? @availability_zone = other_env.availability_zone unless other_env.availability_zone.nil? @chef_path = other_env.chef_path unless other_env.chef_path.nil? @chef_server_url = other_env.chef_server_url unless other_env.chef_server_url.nil? @chef_validation_pem_url = other_env.chef_validation_pem_url unless other_env.chef_validation_pem_url.nil? @domain_name = other_env.domain_name unless other_env.domain_name.nil? @email_notifications = other_env.email_notifications unless other_env.email_notifications.nil? @gem_path = other_env.gem_path unless other_env.gem_path.nil? @key_name = other_env.key_name unless other_env.key_name.nil? @knife_path = other_env.knife_path unless other_env.knife_path.nil? @ruby_path = other_env.ruby_path unless other_env.ruby_path.nil? @subnet = other_env.subnet unless other_env.subnet.nil? @short_name = other_env.short_name unless other_env.short_name.nil? @use_rvm = other_env.use_rvm unless other_env.use_rvm.nil? end |