elastic-beanstalk 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -164,18 +164,12 @@ module Elastic
164
164
  end
165
165
 
166
166
  def resolve_path(relative_path)
167
- if defined?(Rails)
168
167
 
169
- #puts '**********************Using Rails.root'
168
+ if defined?(Rails)
170
169
  Rails.root.join(relative_path)
171
170
  elsif defined?(Rake.original_dir)
172
-
173
- #puts '**********************Using Rake.original_dir'
174
171
  Rake.original_dir.join(relative_path)
175
172
  else
176
-
177
- #puts '**********************Using Last resort Dir.pwd'
178
- #raise 'I have no idea what the root dir is yet.'
179
173
  File.expand_path(relative_path, Dir.pwd)
180
174
  end
181
175
  end
@@ -67,7 +67,7 @@ namespace :eb do
67
67
  # root of the archive, not under a top level folder. Include this package task to make
68
68
  # sure we don't need to learn about this again through long deploy cycles!
69
69
  #
70
- desc 'Package zip source bundle for Elastic Beanstalk'
70
+ desc 'Package zip source bundle for Elastic Beanstalk and generate external Rakefile'
71
71
  task :package => [:clobber, :config] do |t, args|
72
72
 
73
73
  begin
@@ -109,7 +109,7 @@ namespace :eb do
109
109
 
110
110
  # write Rakefile for external CI/CD package deployment
111
111
  File.open(package_rakefile, "w+") do |f|
112
- f.write("spec = Gem::Specification.find_by_name('elastic-beanstalk', '#{Elastic::Beanstalk::VERSION}')\n")
112
+ f.write("spec = Gem::Specification.find_by_name('elastic-beanstalk', '>= #{Elastic::Beanstalk::VERSION}')\n")
113
113
  f.write("load \"\#{spec.gem_dir}/lib/elastic/beanstalk/tasks/eb.rake\"")
114
114
  end
115
115
 
@@ -133,8 +133,10 @@ namespace :eb do
133
133
  # ensure credentials
134
134
  credentials!
135
135
 
136
+ package = resolve_absolute_package_file
137
+
136
138
  # check package file
137
- raise "Package file not found (#{absolute_package_file}). Be sure to run the :package task subsequent to any :deploy attempts." if !File.exists? absolute_package_file
139
+ raise "Package file not found #{package} (also checked current dir). Be sure to run the :package task subsequent to any :deploy attempts." if !File.exists? package
138
140
 
139
141
  # Don't deploy to test or cucumber (or whatever is specified by :disallow_environments)
140
142
  raise "#{EbConfig.environment} is one of the #{EbConfig.disallow_environments} disallowed environments. Configure it by changing the :disallow_environments in the eb.yml" if EbConfig.disallow_environments.include? EbConfig.environment
@@ -156,7 +158,7 @@ namespace :eb do
156
158
  solution_stack_name: EbConfig.solution_stack_name,
157
159
  settings: EbConfig.option_settings,
158
160
  strategy: EbConfig.strategy.to_sym,
159
- package: absolute_package_file
161
+ package: package
160
162
  }
161
163
 
162
164
  unless EbConfig.smoke_test.nil?
@@ -252,8 +254,22 @@ namespace :eb do
252
254
  EbConfig.package[:verbose] || false
253
255
  end
254
256
 
257
+ def resolve_absolute_package_file
258
+
259
+ # first see if it is in the current dir, i.e. CI environment where the generated rakefile and pkg is dropped in the same place
260
+ file = EbConfig.resolve_path(package_file_name)
261
+ return file if File.exists? file
262
+
263
+ file = EbConfig.resolve_path(package_file)
264
+ return file
265
+ end
266
+
255
267
  def package_file
256
- "#{EbConfig.package[:dir]}/#{EbConfig.app}.zip"
268
+ "#{EbConfig.package[:dir]}/#{package_file_name}"
269
+ end
270
+
271
+ def package_file_name
272
+ "#{EbConfig.app}.zip"
257
273
  end
258
274
 
259
275
  def package_rakefile
@@ -263,13 +279,4 @@ namespace :eb do
263
279
  def aws_secrets_file
264
280
  File.expand_path("~/.aws.#{EbConfig.app}.yml")
265
281
  end
266
-
267
- def absolute_package_file
268
- filename = package_file()
269
- unless filename.start_with? '/'
270
- filename = filename.gsub('[', '').gsub(']', '')
271
- filename = EbConfig.resolve_path(filename)
272
- end
273
- filename
274
- end
275
282
  end
@@ -1,5 +1,5 @@
1
1
  module Elastic
2
2
  module Beanstalk
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic-beanstalk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
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: 2013-08-19 00:00:00.000000000 Z
12
+ date: 2013-08-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  version: '0'
186
186
  segments:
187
187
  - 0
188
- hash: 1603262801538237267
188
+ hash: 2377796499627488334
189
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  none: false
191
191
  requirements:
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
194
  version: '0'
195
195
  segments:
196
196
  - 0
197
- hash: 1603262801538237267
197
+ hash: 2377796499627488334
198
198
  requirements: []
199
199
  rubyforge_project:
200
200
  rubygems_version: 1.8.25