engineyard-serverside 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside.rb +0 -1
- data/lib/engineyard-serverside/lockfile_parser.rb +56 -10
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/fixtures/gitrepo/foo +0 -0
- data/spec/lockfile_parser_spec.rb +21 -1
- data/spec/support/lockfiles/1.0.6-no-bundler +51 -0
- data/spec/support/lockfiles/1.0.6-with-any-bundler +52 -0
- data/spec/support/lockfiles/1.0.6-with-bundler +52 -0
- data/spec/support/lockfiles/evil-yaml +5 -0
- metadata +14 -4
@@ -5,14 +5,26 @@ module EY
|
|
5
5
|
attr_reader :bundler_version, :lockfile_version
|
6
6
|
|
7
7
|
def initialize(lockfile_contents)
|
8
|
-
@
|
9
|
-
@lockfile_version, @bundler_version = parse
|
8
|
+
@lockfile_version, @bundler_version = Parse106.new(lockfile_contents).parse
|
10
9
|
end
|
11
10
|
|
12
11
|
private
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
|
13
|
+
class BaseParser
|
14
|
+
def initialize(contents)
|
15
|
+
@contents = contents
|
16
|
+
end
|
17
|
+
def parse
|
18
|
+
raise "Unknown lockfile format #{@contents[0,50]}..."
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Parse09 < BaseParser
|
23
|
+
def parse
|
24
|
+
from_yaml = safe_yaml_load(@contents)
|
25
|
+
unless from_yaml.is_a?(Hash)
|
26
|
+
return super
|
27
|
+
end
|
16
28
|
bundler_version = from_yaml['specs'].map do |spec|
|
17
29
|
# spec is a one-element hash: the key is the gem name, and
|
18
30
|
# the value is {"version" => the-version}.
|
@@ -21,7 +33,19 @@ module EY
|
|
21
33
|
end
|
22
34
|
end.compact.first
|
23
35
|
[:bundler09, bundler_version]
|
24
|
-
|
36
|
+
end
|
37
|
+
def safe_yaml_load(loadable)
|
38
|
+
YAML.load(loadable) #won't always raise... soemtimes parses the contents as 1 big string
|
39
|
+
rescue ArgumentError => e # not yaml
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class Parse10 < Parse09
|
45
|
+
def parse
|
46
|
+
unless @contents.index(/^DEPENDENCIES/)
|
47
|
+
return super
|
48
|
+
end
|
25
49
|
dep_section = ""
|
26
50
|
in_dependencies_section = false
|
27
51
|
@contents.each_line do |line|
|
@@ -45,10 +69,32 @@ module EY
|
|
45
69
|
end
|
46
70
|
end
|
47
71
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
72
|
+
class Parse106 < Parse10
|
73
|
+
def parse
|
74
|
+
unless @contents.index(/^METADATA/)
|
75
|
+
return super
|
76
|
+
end
|
77
|
+
meta_section = ""
|
78
|
+
in_meta_section = false
|
79
|
+
@contents.each_line do |line|
|
80
|
+
if line =~ /^METADATA/
|
81
|
+
in_meta_section = true
|
82
|
+
elsif line =~ /^\S/
|
83
|
+
in_meta_section = false
|
84
|
+
elsif in_meta_section
|
85
|
+
meta_section << line
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
unless meta_section.length > 0
|
90
|
+
raise "Couldn't parse #{@contents}; exiting"
|
91
|
+
exit(1)
|
92
|
+
end
|
93
|
+
|
94
|
+
result = meta_section.scan(/^\s*version:\s*(.*)$/).first
|
95
|
+
bundler_version = result ? result.first : nil
|
96
|
+
[:bundler10, bundler_version]
|
97
|
+
end
|
52
98
|
end
|
53
99
|
|
54
100
|
end
|
File without changes
|
@@ -24,7 +24,27 @@ describe "the bundler version retrieved from the lockfile" do
|
|
24
24
|
get_version('1.0.0.rc.1-with-bundler').should == '1.0.0.rc.1'
|
25
25
|
end
|
26
26
|
|
27
|
+
it "gets the version from a 1.0.6 lockfile w/dependency on 1.0.6" do
|
28
|
+
# This is a real, customer-generated lockfile
|
29
|
+
get_version('1.0.6-with-bundler').should == '1.0.6'
|
30
|
+
end
|
31
|
+
|
32
|
+
it "gets the version from a 1.0.6 lockfile w/dependency on 1.0.6 (bundled ~> 1.0.0)" do
|
33
|
+
# This is a real, customer-generated lockfile
|
34
|
+
get_version('1.0.6-with-any-bundler').should == '1.0.6'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "gets the version from a 1.0.6 lockfile w/o dependency" do
|
38
|
+
# This is a real, customer-generated lockfile
|
39
|
+
get_version('1.0.6-no-bundler').should == '1.0.6'
|
40
|
+
end
|
41
|
+
|
27
42
|
it "raises an error if it can't parse the file" do
|
28
|
-
lambda { get_version('not-a-lockfile') }.should raise_error
|
43
|
+
lambda { get_version('not-a-lockfile') }.should raise_error(RuntimeError, /Unknown lockfile format/)
|
29
44
|
end
|
45
|
+
|
46
|
+
it "raises an error if it can't parse evil yaml" do
|
47
|
+
lambda { get_version('evil-yaml') }.should raise_error(RuntimeError, /Unknown lockfile format/)
|
48
|
+
end
|
49
|
+
|
30
50
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fog (0.3.7)
|
5
|
+
builder
|
6
|
+
excon (>= 0.2.3)
|
7
|
+
formatador (>= 0.0.15)
|
8
|
+
json
|
9
|
+
mime-types
|
10
|
+
net-ssh (~> 2.0.23)
|
11
|
+
nokogiri (~> 1.4.3.1)
|
12
|
+
ruby-hmac
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: http://rubygems.org/
|
16
|
+
specs:
|
17
|
+
builder (2.1.2)
|
18
|
+
excon (0.2.3)
|
19
|
+
formatador (0.0.15)
|
20
|
+
gestalt (0.0.11)
|
21
|
+
formatador (>= 0.0.12)
|
22
|
+
json (1.4.6)
|
23
|
+
mime-types (1.16)
|
24
|
+
net-ssh (2.0.23)
|
25
|
+
nokogiri (1.4.3.1)
|
26
|
+
rake (0.8.7)
|
27
|
+
rspec (1.3.0)
|
28
|
+
ruby-hmac (0.4.0)
|
29
|
+
shindo (0.1.6)
|
30
|
+
formatador (>= 0.0.14)
|
31
|
+
gestalt (>= 0.0.11)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
builder
|
38
|
+
excon (>= 0.2.3)
|
39
|
+
fog!
|
40
|
+
formatador (>= 0.0.15)
|
41
|
+
json
|
42
|
+
mime-types
|
43
|
+
net-ssh (~> 2.0.23)
|
44
|
+
nokogiri (~> 1.4.3.1)
|
45
|
+
rake
|
46
|
+
rspec
|
47
|
+
ruby-hmac
|
48
|
+
shindo (= 0.1.6)
|
49
|
+
|
50
|
+
METADATA
|
51
|
+
version: 1.0.6
|
@@ -0,0 +1,52 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fog (0.3.7)
|
5
|
+
builder
|
6
|
+
excon (>= 0.2.3)
|
7
|
+
formatador (>= 0.0.15)
|
8
|
+
json
|
9
|
+
mime-types
|
10
|
+
net-ssh (~> 2.0.23)
|
11
|
+
nokogiri (~> 1.4.3.1)
|
12
|
+
ruby-hmac
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: http://rubygems.org/
|
16
|
+
specs:
|
17
|
+
builder (2.1.2)
|
18
|
+
excon (0.2.3)
|
19
|
+
formatador (0.0.15)
|
20
|
+
gestalt (0.0.11)
|
21
|
+
formatador (>= 0.0.12)
|
22
|
+
json (1.4.6)
|
23
|
+
mime-types (1.16)
|
24
|
+
net-ssh (2.0.23)
|
25
|
+
nokogiri (1.4.3.1)
|
26
|
+
rake (0.8.7)
|
27
|
+
rspec (1.3.0)
|
28
|
+
ruby-hmac (0.4.0)
|
29
|
+
shindo (0.1.6)
|
30
|
+
formatador (>= 0.0.14)
|
31
|
+
gestalt (>= 0.0.11)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
builder
|
38
|
+
bundler (~> 1.0.0)
|
39
|
+
excon (>= 0.2.3)
|
40
|
+
fog!
|
41
|
+
formatador (>= 0.0.15)
|
42
|
+
json
|
43
|
+
mime-types
|
44
|
+
net-ssh (~> 2.0.23)
|
45
|
+
nokogiri (~> 1.4.3.1)
|
46
|
+
rake
|
47
|
+
rspec
|
48
|
+
ruby-hmac
|
49
|
+
shindo (= 0.1.6)
|
50
|
+
|
51
|
+
METADATA
|
52
|
+
version: 1.0.6
|
@@ -0,0 +1,52 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
fog (0.3.7)
|
5
|
+
builder
|
6
|
+
excon (>= 0.2.3)
|
7
|
+
formatador (>= 0.0.15)
|
8
|
+
json
|
9
|
+
mime-types
|
10
|
+
net-ssh (~> 2.0.23)
|
11
|
+
nokogiri (~> 1.4.3.1)
|
12
|
+
ruby-hmac
|
13
|
+
|
14
|
+
GEM
|
15
|
+
remote: http://rubygems.org/
|
16
|
+
specs:
|
17
|
+
builder (2.1.2)
|
18
|
+
excon (0.2.3)
|
19
|
+
formatador (0.0.15)
|
20
|
+
gestalt (0.0.11)
|
21
|
+
formatador (>= 0.0.12)
|
22
|
+
json (1.4.6)
|
23
|
+
mime-types (1.16)
|
24
|
+
net-ssh (2.0.23)
|
25
|
+
nokogiri (1.4.3.1)
|
26
|
+
rake (0.8.7)
|
27
|
+
rspec (1.3.0)
|
28
|
+
ruby-hmac (0.4.0)
|
29
|
+
shindo (0.1.6)
|
30
|
+
formatador (>= 0.0.14)
|
31
|
+
gestalt (>= 0.0.11)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
builder
|
38
|
+
bundler (= 1.0.6)
|
39
|
+
excon (>= 0.2.3)
|
40
|
+
fog!
|
41
|
+
formatador (>= 0.0.15)
|
42
|
+
json
|
43
|
+
mime-types
|
44
|
+
net-ssh (~> 2.0.23)
|
45
|
+
nokogiri (~> 1.4.3.1)
|
46
|
+
rake
|
47
|
+
rspec
|
48
|
+
ruby-hmac
|
49
|
+
shindo (= 0.1.6)
|
50
|
+
|
51
|
+
METADATA
|
52
|
+
version: 1.0.6
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-serverside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 7
|
10
|
+
version: 1.3.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- EY Cloud Team
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-17 00:00:00 -08:00
|
19
19
|
default_executable: engineyard-serverside
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -235,6 +235,7 @@ files:
|
|
235
235
|
- LICENSE
|
236
236
|
- spec/custom_deploy_spec.rb
|
237
237
|
- spec/deploy_hook_spec.rb
|
238
|
+
- spec/fixtures/gitrepo/foo
|
238
239
|
- spec/fixtures/gitrepo.tar.gz
|
239
240
|
- spec/fixtures/invalid_hook.rb
|
240
241
|
- spec/fixtures/valid_hook.rb
|
@@ -248,6 +249,10 @@ files:
|
|
248
249
|
- spec/support/lockfiles/0.9-with-bundler
|
249
250
|
- spec/support/lockfiles/1.0-no-bundler
|
250
251
|
- spec/support/lockfiles/1.0.0.rc.1-with-bundler
|
252
|
+
- spec/support/lockfiles/1.0.6-no-bundler
|
253
|
+
- spec/support/lockfiles/1.0.6-with-any-bundler
|
254
|
+
- spec/support/lockfiles/1.0.6-with-bundler
|
255
|
+
- spec/support/lockfiles/evil-yaml
|
251
256
|
- spec/support/lockfiles/not-a-lockfile
|
252
257
|
has_rdoc: true
|
253
258
|
homepage: http://github.com/engineyard/engineyard-serverside
|
@@ -286,6 +291,7 @@ summary: A gem that deploys ruby applications on EY Cloud instances
|
|
286
291
|
test_files:
|
287
292
|
- spec/custom_deploy_spec.rb
|
288
293
|
- spec/deploy_hook_spec.rb
|
294
|
+
- spec/fixtures/gitrepo/foo
|
289
295
|
- spec/fixtures/gitrepo.tar.gz
|
290
296
|
- spec/fixtures/invalid_hook.rb
|
291
297
|
- spec/fixtures/valid_hook.rb
|
@@ -299,4 +305,8 @@ test_files:
|
|
299
305
|
- spec/support/lockfiles/0.9-with-bundler
|
300
306
|
- spec/support/lockfiles/1.0-no-bundler
|
301
307
|
- spec/support/lockfiles/1.0.0.rc.1-with-bundler
|
308
|
+
- spec/support/lockfiles/1.0.6-no-bundler
|
309
|
+
- spec/support/lockfiles/1.0.6-with-any-bundler
|
310
|
+
- spec/support/lockfiles/1.0.6-with-bundler
|
311
|
+
- spec/support/lockfiles/evil-yaml
|
302
312
|
- spec/support/lockfiles/not-a-lockfile
|