ey-deploy 1.0.1 → 1.0.2

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.
@@ -15,6 +15,7 @@ require 'task'
15
15
  require 'server'
16
16
  require 'deploy'
17
17
  require 'deploy_hook'
18
+ require 'lockfile_parser'
18
19
  require 'cli'
19
20
  require 'configuration'
20
21
 
@@ -2,7 +2,6 @@
2
2
  require 'base64'
3
3
  require 'fileutils'
4
4
  require 'json'
5
- require 'yaml'
6
5
 
7
6
  module EY
8
7
  class DeployBase < Task
@@ -269,14 +268,8 @@ module EY
269
268
  sudo "rm -rf #{c.release_path}"
270
269
  end
271
270
 
272
- def safe_yaml_load(loadable)
273
- YAML.load(loadable)
274
- rescue ArgumentError # not yaml
275
- nil
276
- end
277
-
278
271
  DEFAULT_09_BUNDLER = '0.9.26'
279
- DEFAULT_10_BUNDLER = '1.0.0.beta.5'
272
+ DEFAULT_10_BUNDLER = '1.0.0.rc.1'
280
273
 
281
274
  def warn_about_missing_lockfile
282
275
  info "!>"
@@ -293,25 +286,15 @@ module EY
293
286
  end
294
287
 
295
288
  def get_bundler_version(lockfile)
296
- contents = File.open(lockfile, 'r') { |f| f.read }
297
- from_yaml = safe_yaml_load(contents)
298
-
299
- if from_yaml # 0.9
300
- from_yaml['specs'].map do |spec|
301
- # spec is a one-element hash: the key is the gem name, and
302
- # the value is {"version" => the-version}.
303
- if spec.keys.first == "bundler"
304
- spec.values.first["version"]
305
- end
306
- end.compact.first || DEFAULT_09_BUNDLER
307
- else # 1.0 or bust
308
- gem_section = contents.scan(/GEM\s*\n(.*?)\n\S/m).first
309
- unless gem_section
310
- raise "Couldn't parse #{lockfile}; exiting"
311
- exit(1)
312
- end
313
- result = gem_section.first.scan(/^\s*bundler\s*\((\S+)\)/).first
314
- result ? result.first : DEFAULT_10_BUNDLER
289
+ parser = LockfileParser.new(File.read(lockfile))
290
+ return parser.bundler_version if parser.bundler_version
291
+ case parser.lockfile_version
292
+ when :bundler09
293
+ DEFAULT_09_BUNDLER
294
+ when :bundler10
295
+ DEFAULT_10_BUNDLER
296
+ else
297
+ raise "Unknown lockfile version #{parser.lockfile_version}"
315
298
  end
316
299
  end
317
300
  public :get_bundler_version
@@ -0,0 +1,55 @@
1
+ require 'yaml'
2
+ module EY
3
+ class LockfileParser
4
+
5
+ attr_reader :bundler_version, :lockfile_version
6
+
7
+ def initialize(lockfile_contents)
8
+ @contents = lockfile_contents
9
+ @lockfile_version, @bundler_version = parse
10
+ end
11
+
12
+ private
13
+ def parse
14
+ from_yaml = safe_yaml_load(@contents)
15
+ if from_yaml # 0.9
16
+ bundler_version = from_yaml['specs'].map do |spec|
17
+ # spec is a one-element hash: the key is the gem name, and
18
+ # the value is {"version" => the-version}.
19
+ if spec.keys.first == "bundler"
20
+ spec.values.first["version"]
21
+ end
22
+ end.compact.first
23
+ [:bundler09, bundler_version]
24
+ else # 1.0 or bust
25
+ dep_section = ""
26
+ in_dependencies_section = false
27
+ @contents.each_line do |line|
28
+ if line =~ /^DEPENDENCIES/
29
+ in_dependencies_section = true
30
+ elsif line =~ /^\S/
31
+ in_dependencies_section = false
32
+ elsif in_dependencies_section
33
+ dep_section << line
34
+ end
35
+ end
36
+
37
+ unless dep_section.length > 0
38
+ raise "Couldn't parse #{lockfile}; exiting"
39
+ exit(1)
40
+ end
41
+
42
+ result = dep_section.scan(/^\s*bundler\s*\(=\s*([^\)]+)\)/).first
43
+ bundler_version = result ? result.first : nil
44
+ [:bundler10, bundler_version]
45
+ end
46
+ end
47
+
48
+ def safe_yaml_load(loadable)
49
+ YAML.load(loadable)
50
+ rescue ArgumentError # not yaml
51
+ nil
52
+ end
53
+
54
+ end
55
+ end
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
File without changes
@@ -18,8 +18,9 @@ describe "the bundler version retrieved from the lockfile" do
18
18
  get_version('1.0-no-bundler').should == EY::DeployBase::DEFAULT_10_BUNDLER
19
19
  end
20
20
 
21
- it "gets the version from a 1.0 lockfile with a bundler dependency" do
22
- get_version('1.0-with-bundler').should == '1.0.0.beta.1'
21
+ it "gets the version from a 1.0.0.rc.1 lockfile w/dependency on 1.0.0.rc.1" do
22
+ # This is a real, customer-generated lockfile
23
+ get_version('1.0.0.rc.1-with-bundler').should == '1.0.0.rc.1'
23
24
  end
24
25
 
25
26
  it "raises an error if it can't parse the file" do
@@ -0,0 +1,162 @@
1
+ GIT
2
+ remote: git://github.com/bensie/aws-s3.git
3
+ revision: 00831fe
4
+ specs:
5
+ aws-s3 (0.6.2)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ abstract (1.0.0)
11
+ actionmailer (3.0.0.rc)
12
+ actionpack (= 3.0.0.rc)
13
+ mail (~> 2.2.5)
14
+ actionpack (3.0.0.rc)
15
+ activemodel (= 3.0.0.rc)
16
+ activesupport (= 3.0.0.rc)
17
+ builder (~> 2.1.2)
18
+ erubis (~> 2.6.6)
19
+ i18n (~> 0.4.1)
20
+ rack (~> 1.2.1)
21
+ rack-mount (~> 0.6.9)
22
+ rack-test (~> 0.5.4)
23
+ tzinfo (~> 0.3.22)
24
+ activemodel (3.0.0.rc)
25
+ activesupport (= 3.0.0.rc)
26
+ builder (~> 2.1.2)
27
+ i18n (~> 0.4.1)
28
+ activerecord (3.0.0.rc)
29
+ activemodel (= 3.0.0.rc)
30
+ activesupport (= 3.0.0.rc)
31
+ arel (~> 0.4.0)
32
+ tzinfo (~> 0.3.22)
33
+ activeresource (3.0.0.rc)
34
+ activemodel (= 3.0.0.rc)
35
+ activesupport (= 3.0.0.rc)
36
+ activesupport (3.0.0.rc)
37
+ acts_as_list (0.1.2)
38
+ acts_as_tree (0.1.1)
39
+ arel (0.4.0)
40
+ activesupport (>= 3.0.0.beta)
41
+ bcrypt-ruby (2.1.2)
42
+ builder (2.1.2)
43
+ configuration (1.1.0)
44
+ daemons (1.1.0)
45
+ delayed_job (2.0.3)
46
+ daemons
47
+ devise (1.1.1)
48
+ bcrypt-ruby (~> 2.1.2)
49
+ warden (~> 0.10.7)
50
+ erubis (2.6.6)
51
+ abstract (>= 1.0.0)
52
+ escape (0.0.4)
53
+ exifr (1.0.1)
54
+ factory_girl (1.3.1)
55
+ factory_girl_rails (1.0)
56
+ factory_girl (~> 1.3)
57
+ rails (>= 3.0.0.beta4)
58
+ haml (3.0.14)
59
+ heroku (1.9.11)
60
+ json_pure (>= 1.2.0, < 1.5.0)
61
+ launchy (~> 0.3.2)
62
+ rest-client (~> 1.4.0)
63
+ hoptoad_notifier (2.3.2)
64
+ activesupport
65
+ i18n (0.4.1)
66
+ json_pure (1.4.3)
67
+ launchy (0.3.7)
68
+ configuration (>= 0.0.5)
69
+ rake (>= 0.8.1)
70
+ less (1.2.21)
71
+ mutter (>= 0.4.2)
72
+ treetop (>= 1.4.2)
73
+ liquid (2.1.2)
74
+ mail (2.2.5)
75
+ activesupport (>= 2.3.6)
76
+ mime-types
77
+ treetop (>= 1.4.5)
78
+ mime-types (1.16)
79
+ mutter (0.5.3)
80
+ mysql (2.8.1)
81
+ paperclip (2.3.3)
82
+ activerecord
83
+ activesupport
84
+ permalink_fu (1.0.0)
85
+ polyglot (0.3.1)
86
+ rack (1.2.1)
87
+ rack-mount (0.6.9)
88
+ rack (>= 1.0.0)
89
+ rack-test (0.5.4)
90
+ rack (>= 1.0)
91
+ rails (3.0.0.rc)
92
+ actionmailer (= 3.0.0.rc)
93
+ actionpack (= 3.0.0.rc)
94
+ activerecord (= 3.0.0.rc)
95
+ activeresource (= 3.0.0.rc)
96
+ activesupport (= 3.0.0.rc)
97
+ bundler (>= 1.0.0.rc.1)
98
+ railties (= 3.0.0.rc)
99
+ railties (3.0.0.rc)
100
+ actionpack (= 3.0.0.rc)
101
+ activesupport (= 3.0.0.rc)
102
+ rake (>= 0.8.3)
103
+ thor (~> 0.14.0)
104
+ rake (0.8.7)
105
+ redis (2.0.3)
106
+ refraction (0.2.0)
107
+ rest-client (1.4.2)
108
+ mime-types (>= 1.16)
109
+ rsolr (0.12.1)
110
+ builder (>= 2.1.2)
111
+ shoulda (2.11.1)
112
+ sinatra (1.0)
113
+ rack (>= 1.0)
114
+ sunspot (1.1.0)
115
+ escape (= 0.0.4)
116
+ rsolr (= 0.12.1)
117
+ sunspot_rails (1.1.0)
118
+ sunspot (= 1.1.0)
119
+ thor (0.14.0)
120
+ treetop (1.4.8)
121
+ polyglot (>= 0.3.1)
122
+ tzinfo (0.3.22)
123
+ vestal_versions (1.0.2)
124
+ activerecord (>= 2.1.0)
125
+ warden (0.10.7)
126
+ rack (>= 1.0.0)
127
+ will_paginate (3.0.pre2)
128
+ xml-simple (1.0.12)
129
+
130
+ PLATFORMS
131
+ ruby
132
+
133
+ DEPENDENCIES
134
+ acts_as_list (= 0.1.2)
135
+ acts_as_tree (= 0.1.1)
136
+ aws-s3 (= 0.6.2)!
137
+ builder
138
+ bundler (= 1.0.0.rc.1)
139
+ delayed_job (= 2.0.3)
140
+ devise (= 1.1.1)
141
+ exifr (= 1.0.1)
142
+ factory_girl_rails (= 1.0)
143
+ haml (= 3.0.14)
144
+ heroku (= 1.9.11)
145
+ hoptoad_notifier (= 2.3.2)
146
+ less (= 1.2.21)
147
+ liquid (= 2.1.2)
148
+ mime-types (= 1.16)
149
+ mysql (= 2.8.1)
150
+ paperclip (= 2.3.3)
151
+ permalink_fu (= 1.0.0)
152
+ rails (= 3.0.0.rc)
153
+ redis (= 2.0.3)
154
+ refraction (= 0.2.0)
155
+ rsolr (= 0.12.1)
156
+ shoulda (= 2.11.1)
157
+ sinatra (= 1.0)
158
+ sunspot (= 1.1.0)
159
+ sunspot_rails (= 1.1.0)
160
+ vestal_versions (= 1.0.2)
161
+ will_paginate (= 3.0.pre2)
162
+ xml-simple
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ey-deploy
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 0
8
- - 1
9
- version: 1.0.1
9
+ - 2
10
+ version: 1.0.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - EY Cloud Team
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-07-22 00:00:00 -07:00
18
+ date: 2010-07-29 00:00:00 -07:00
18
19
  default_executable: ey-deploy
19
20
  dependencies: []
20
21
 
@@ -33,6 +34,7 @@ files:
33
34
  - lib/ey-deploy/default_maintenance_page.html
34
35
  - lib/ey-deploy/deploy.rb
35
36
  - lib/ey-deploy/deploy_hook.rb
37
+ - lib/ey-deploy/lockfile_parser.rb
36
38
  - lib/ey-deploy/logged_output.rb
37
39
  - lib/ey-deploy/server.rb
38
40
  - lib/ey-deploy/strategies/git.rb
@@ -230,6 +232,21 @@ files:
230
232
  - lib/vendor/thor/thor.gemspec
231
233
  - lib/vendor/thor/Thorfile
232
234
  - LICENSE
235
+ - spec/custom_deploy_spec.rb
236
+ - spec/deploy_hook_spec.rb
237
+ - spec/fixtures/gitrepo/bar
238
+ - spec/fixtures/gitrepo/foo
239
+ - spec/fixtures/gitrepo.tar.gz
240
+ - spec/fixtures/invalid_hook.rb
241
+ - spec/fixtures/valid_hook.rb
242
+ - spec/git_strategy_spec.rb
243
+ - spec/lockfile_parser_spec.rb
244
+ - spec/spec_helper.rb
245
+ - spec/support/lockfiles/0.9-no-bundler
246
+ - spec/support/lockfiles/0.9-with-bundler
247
+ - spec/support/lockfiles/1.0-no-bundler
248
+ - spec/support/lockfiles/1.0.0.rc.1-with-bundler
249
+ - spec/support/lockfiles/not-a-lockfile
233
250
  has_rdoc: true
234
251
  homepage: http://engineyard.com
235
252
  licenses: []
@@ -240,29 +257,34 @@ rdoc_options: []
240
257
  require_paths:
241
258
  - lib
242
259
  required_ruby_version: !ruby/object:Gem::Requirement
260
+ none: false
243
261
  requirements:
244
262
  - - ">="
245
263
  - !ruby/object:Gem::Version
264
+ hash: 3
246
265
  segments:
247
266
  - 0
248
267
  version: "0"
249
268
  required_rubygems_version: !ruby/object:Gem::Requirement
269
+ none: false
250
270
  requirements:
251
271
  - - ">="
252
272
  - !ruby/object:Gem::Version
273
+ hash: 3
253
274
  segments:
254
275
  - 0
255
276
  version: "0"
256
277
  requirements: []
257
278
 
258
279
  rubyforge_project:
259
- rubygems_version: 1.3.6
280
+ rubygems_version: 1.3.7
260
281
  signing_key:
261
282
  specification_version: 3
262
283
  summary: A gem that deploys ruby applications on EY Cloud instances
263
284
  test_files:
264
285
  - spec/custom_deploy_spec.rb
265
286
  - spec/deploy_hook_spec.rb
287
+ - spec/fixtures/gitrepo/bar
266
288
  - spec/fixtures/gitrepo/foo
267
289
  - spec/fixtures/gitrepo.tar.gz
268
290
  - spec/fixtures/invalid_hook.rb
@@ -273,5 +295,5 @@ test_files:
273
295
  - spec/support/lockfiles/0.9-no-bundler
274
296
  - spec/support/lockfiles/0.9-with-bundler
275
297
  - spec/support/lockfiles/1.0-no-bundler
276
- - spec/support/lockfiles/1.0-with-bundler
298
+ - spec/support/lockfiles/1.0.0.rc.1-with-bundler
277
299
  - spec/support/lockfiles/not-a-lockfile
@@ -1,56 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- bundler (1.0.0.beta.1)
5
- columnize (0.3.1)
6
- escape (0.0.4)
7
- fakefs (0.2.1)
8
- fakeweb (1.2.8)
9
- fakeweb-matcher (1.1.0)
10
- fakeweb (>= 1.2.5)
11
- rspec (>= 1.2.0)
12
- highline (1.5.2)
13
- json (1.4.3)
14
- json (1.4.3-x86-mingw32)
15
- json (1.4.3-x86-mswin32)
16
- linecache (0.43)
17
- linecache (0.43-mswin32)
18
- mime-types (1.16)
19
- open4 (1.0.1)
20
- rack (1.2.1)
21
- rake (0.8.7)
22
- realweb (0.1.6)
23
- rack (>= 1.1.0)
24
- rest-client (1.5.1)
25
- mime-types (>= 1.16)
26
- rspec (1.3.0)
27
- ruby-debug (0.10.3)
28
- columnize (>= 0.1)
29
- ruby-debug-base (~> 0.10.3.0)
30
- ruby-debug-base (0.10.3)
31
- linecache (>= 0.3)
32
- sinatra (1.0)
33
- rack (>= 1.0)
34
- termios (0.9.4)
35
- thor (0.13.6)
36
-
37
- PLATFORMS
38
- ruby
39
-
40
- DEPENDENCIES
41
- bundler
42
- escape (~> 0.0.4)
43
- fakefs
44
- fakeweb
45
- fakeweb-matcher
46
- highline (~> 1.5.2)
47
- json (~> 1.4.0)
48
- open4
49
- rake
50
- realweb (~> 0.1.6)
51
- rest-client (~> 1.4)
52
- rspec
53
- ruby-debug
54
- sinatra
55
- termios
56
- thor (~> 0.13.6)