ec2launcher 1.0.34 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 1.1.0
2
+
3
+ * Backward imcompatible change. Now defaults to running "ruby", "gem", "chef-client" and "knife" based on the environment.
4
+ * Automatically attempts to the load RVM (https://rvm.io/) profile data from /etc/profile.d/rvm.sh.
5
+ * Added new "use_rvm" environment and application setting to control loading RVM profile. Defaults to true.
6
+
7
+ ## 1.0.35
8
+
9
+ * Fixed mistake when launching instances with a specified hostname.
10
+
1
11
  ## 1.0.34
2
12
 
3
13
  * Added missing config loader files.
data/lib/ec2launcher.rb CHANGED
@@ -214,7 +214,7 @@ module EC2Launcher
214
214
  long_hostname = hostname_generator.generate_long_name(short_hostname, @environment.domain_name)
215
215
  else
216
216
  long_hostname = @options.hostname
217
- short_hostname = hostname_generator.generate_short_name(short_hostname, @environment.domain_name)
217
+ short_hostname = hostname_generator.generate_short_name(long_hostname, @environment.domain_name)
218
218
  if long_hostname == short_hostname
219
219
  long_hostname = hostname_generator.generate_long_name(short_hostname, @environment.domain_name)
220
220
  end
@@ -646,16 +646,25 @@ module EC2Launcher
646
646
 
647
647
  ##############################
648
648
  # Build launch command
649
- user_data = "#!/bin/sh"
650
- user_data += "\nexport HOME=/root"
651
- user_data += "\necho '#{setup_json.to_json}' > /tmp/setup.json"
649
+ user_data = <<EOF
650
+ #!/bin/sh
651
+ cat > /tmp/setup.json <<End-Of-Message-JSON
652
+ #{setup_json.to_json}
653
+ End-Of-Message-JSON
654
+ EOF
655
+ if @environment.use_rvm or @application.use_rvm
656
+ user_data += <<-EOF
657
+ export HOME=/root
658
+ if [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
659
+ source "/usr/local/rvm/scripts/rvm"
660
+ fi
661
+ EOF
662
+ end
652
663
 
653
664
  # pre-commands, if necessary
654
665
  user_data += build_commands(@environment.precommand)
655
666
  user_data += build_commands(@application.precommand)
656
667
 
657
- user_data += "\n"
658
-
659
668
  unless @options.skip_setup
660
669
  if @run_url_script_cache.nil?
661
670
  puts "Downloading runurl script from #{RUN_URL_SCRIPT}"
@@ -44,6 +44,7 @@ module EC2Launcher
44
44
  dsl_accessor :instance_type
45
45
  dsl_accessor :name_suffix
46
46
  dsl_accessor :subnet
47
+ dsl_accessor :use_rvm
47
48
 
48
49
  dsl_array_accessor :gems
49
50
  dsl_array_accessor :packages
@@ -60,6 +61,8 @@ module EC2Launcher
60
61
  def initialize(name)
61
62
  @name = name
62
63
  @email_notifications = nil
64
+
65
+ @use_rvm = true
63
66
  end
64
67
 
65
68
  def application(name)
@@ -171,6 +174,8 @@ module EC2Launcher
171
174
  other_server.security_groups[env_name].each {|sg| @security_groups[env_name] << sg }
172
175
  end
173
176
  end
177
+
178
+ @use_rvm = other_server.use_rvm unless other_server.use_rvm.nil?
174
179
  end
175
180
 
176
181
  def roles_for_environment(environment)
@@ -28,6 +28,7 @@ module EC2Launcher
28
28
  dsl_accessor :ruby_path
29
29
  dsl_accessor :short_name
30
30
  dsl_accessor :subnet
31
+ dsl_accessor :use_rvm
31
32
 
32
33
  dsl_array_accessor :aliases
33
34
  dsl_array_accessor :gems
@@ -51,6 +52,8 @@ module EC2Launcher
51
52
  @postcommand = []
52
53
  @roles = []
53
54
  @security_groups = {}
55
+
56
+ @use_rvm = true
54
57
  end
55
58
 
56
59
  def environment(name)
@@ -91,6 +94,7 @@ module EC2Launcher
91
94
  @ruby_path = other_env.ruby_path unless other_env.ruby_path.nil?
92
95
  @subnet = other_env.subnet unless other_env.subnet.nil?
93
96
  @short_name = other_env.short_name unless other_env.short_name.nil?
97
+ @use_rvm = other_env.use_rvm unless other_env.use_rvm.nil?
94
98
  end
95
99
 
96
100
  def load(dsl)
@@ -7,10 +7,10 @@ module EC2Launcher
7
7
  attr_reader :gem_path, :ruby_path, :chef_path, :knife_path
8
8
 
9
9
  def initialize(environment)
10
- @gem_path = build_path(environment.gem_path, "gem", "/usr/bin/gem")
11
- @ruby_path = build_path(environment.ruby_path, "ruby", "/usr/bin/ruby")
12
- @chef_path = build_path(environment.chef_path, "chef-client", "/usr/bin/chef-client")
13
- @knife_path = build_path(environment.knife_path, "knife", "/usr/bin/knife")
10
+ @gem_path = build_path(environment.gem_path, "gem", "gem")
11
+ @ruby_path = build_path(environment.ruby_path, "ruby", "ruby")
12
+ @chef_path = build_path(environment.chef_path, "chef-client", "chef-client")
13
+ @knife_path = build_path(environment.knife_path, "knife", "knife")
14
14
  end
15
15
 
16
16
  private
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2012 Sean Laurent
3
3
  #
4
4
  module EC2Launcher
5
- VERSION = "1.0.34"
5
+ VERSION = "1.1.0"
6
6
  end
@@ -371,7 +371,7 @@ def run_chef_client(chef_path)
371
371
  stdout.each do |line|
372
372
  puts line
373
373
  end
374
- result = wait_thr.value
374
+ result = wait_thr.value if wait_thr
375
375
  end
376
376
  result
377
377
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.34
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-28 00:00:00.000000000 Z
12
+ date: 2012-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk