berkshelf 3.0.0.beta6 → 3.0.0.beta7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/features/berksfile.feature +2 -0
  3. data/features/commands/apply.feature +1 -1
  4. data/features/commands/contingent.feature +5 -3
  5. data/features/commands/install.feature +40 -40
  6. data/features/commands/list.feature +42 -20
  7. data/features/commands/outdated.feature +60 -16
  8. data/features/commands/show.feature +51 -8
  9. data/features/commands/update.feature +43 -15
  10. data/features/commands/upload.feature +4 -1
  11. data/features/commands/vendor.feature +27 -0
  12. data/features/json_formatter.feature +20 -8
  13. data/features/lockfile.feature +192 -71
  14. data/generator_files/CHANGELOG.md.erb +5 -0
  15. data/lib/berkshelf/berksfile.rb +166 -139
  16. data/lib/berkshelf/cli.rb +33 -30
  17. data/lib/berkshelf/cookbook_generator.rb +1 -0
  18. data/lib/berkshelf/dependency.rb +64 -14
  19. data/lib/berkshelf/downloader.rb +7 -10
  20. data/lib/berkshelf/errors.rb +59 -11
  21. data/lib/berkshelf/formatters/human_readable.rb +23 -36
  22. data/lib/berkshelf/formatters/json.rb +25 -29
  23. data/lib/berkshelf/installer.rb +111 -122
  24. data/lib/berkshelf/locations/git_location.rb +22 -9
  25. data/lib/berkshelf/locations/mercurial_location.rb +20 -5
  26. data/lib/berkshelf/locations/path_location.rb +22 -7
  27. data/lib/berkshelf/lockfile.rb +435 -203
  28. data/lib/berkshelf/resolver.rb +4 -2
  29. data/lib/berkshelf/source.rb +10 -1
  30. data/lib/berkshelf/version.rb +1 -1
  31. data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +3 -4
  32. data/spec/fixtures/lockfiles/2.0.lock +17 -0
  33. data/spec/fixtures/lockfiles/blank.lock +0 -0
  34. data/spec/fixtures/lockfiles/default.lock +18 -10
  35. data/spec/fixtures/lockfiles/empty.lock +3 -0
  36. data/spec/unit/berkshelf/berksfile_spec.rb +31 -74
  37. data/spec/unit/berkshelf/cookbook_generator_spec.rb +4 -0
  38. data/spec/unit/berkshelf/installer_spec.rb +4 -7
  39. data/spec/unit/berkshelf/lockfile_parser_spec.rb +124 -0
  40. data/spec/unit/berkshelf/lockfile_spec.rb +140 -163
  41. metadata +11 -6
  42. data/features/licenses.feature +0 -79
  43. data/features/step_definitions/lockfile_steps.rb +0 -57
@@ -6,8 +6,14 @@ Feature: berks show
6
6
  """
7
7
  cookbook 'fake', '1.0.0'
8
8
  """
9
- And the Lockfile has:
10
- | fake | 1.0.0 |
9
+ And I write to "Berksfile.lock" with:
10
+ """
11
+ DEPENDENCIES
12
+ fake (= 1.0.0)
13
+
14
+ GRAPH
15
+ fake (1.0.0)
16
+ """
11
17
  When I successfully run `berks show fake`
12
18
  Then the output should contain:
13
19
  """
@@ -19,12 +25,43 @@ Feature: berks show
19
25
  License: none
20
26
  """
21
27
 
28
+ Scenario: When the parameter is a transitive dependency
29
+ Given the cookbook store has the cookbooks:
30
+ | dep | 1.0.0 |
31
+ And the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
32
+ | dep | ~> 1.0.0 |
33
+ And I have a Berksfile pointing at the local Berkshelf API with:
34
+ """
35
+ cookbook 'fake', '1.0.0'
36
+ """
37
+ And I write to "Berksfile.lock" with:
38
+ """
39
+ DEPENDENCIES
40
+ fake (= 1.0.0)
41
+
42
+ GRAPH
43
+ dep (1.0.0)
44
+ fake (1.0.0)
45
+ dep (~> 1.0.0)
46
+ """
47
+ And I successfully run `berks install`
48
+ When I successfully run `berks show dep`
49
+ Then the output should contain:
50
+ """
51
+ Name: dep
52
+ Version: 1.0.0
53
+ Description: A fabulous new cookbook
54
+ Author: YOUR_COMPANY_NAME
55
+ Email: YOUR_EMAIL
56
+ License: none
57
+ """
58
+
22
59
  Scenario: When the cookbook is not in the Berksfile
23
60
  Given I have a Berksfile pointing at the local Berkshelf API
24
61
  When I run `berks show fake`
25
62
  Then the output should contain:
26
63
  """
27
- Could not find cookbook(s) 'fake' in any of the configured dependencies. Is it in your Berksfile?
64
+ Could not find cookbook 'fake'. Make sure it is in your Berksfile, then run `berks install` to download and install the missing dependencies.
28
65
  """
29
66
  And the exit status should be "DependencyNotFound"
30
67
 
@@ -36,9 +73,9 @@ Feature: berks show
36
73
  When I run `berks show fake`
37
74
  Then the output should contain:
38
75
  """
39
- Could not find cookbook 'fake (= 1.0.0)'. Try running `berks install` to download and install the missing dependencies.
76
+ Could not find cookbook 'fake'. Make sure it is in your Berksfile, then run `berks install` to download and install the missing dependencies.
40
77
  """
41
- And the exit status should be "CookbookNotFound"
78
+ And the exit status should be "DependencyNotFound"
42
79
 
43
80
  Scenario: When the cookbook is not installed
44
81
  Given the cookbook store is empty
@@ -46,11 +83,17 @@ Feature: berks show
46
83
  """
47
84
  cookbook 'fake', '1.0.0'
48
85
  """
49
- And the Lockfile has:
50
- | fake | 1.0.0 |
86
+ And I write to "Berksfile.lock" with:
87
+ """
88
+ DEPENDENCIES
89
+ fake (= 1.0.0)
90
+
91
+ GRAPH
92
+ fake (1.0.0)
93
+ """
51
94
  When I run `berks show fake`
52
95
  Then the output should contain:
53
96
  """
54
- Could not find cookbook 'fake (1.0.0)'. Try running `berks install` to download and install the missing dependencies.
97
+ Could not find cookbook 'fake (1.0.0)'. Run `berks install` to download and install the missing cookbook.
55
98
  """
56
99
  And the exit status should be "CookbookNotFound"
@@ -11,36 +11,64 @@ Feature: berks update
11
11
  Scenario: Without a cookbook specified
12
12
  And I have a Berksfile pointing at the local Berkshelf API with:
13
13
  """
14
- cookbook 'fake', '~> 0.1'
15
14
  cookbook 'ekaf', '~> 1.0.0'
15
+ cookbook 'fake', '~> 0.1'
16
+ """
17
+ And I write to "Berksfile.lock" with:
18
+ """
19
+ DEPENDENCIES
20
+ ekaf (~> 1.0.0)
21
+ fake (~> 0.1)
22
+
23
+ GRAPH
24
+ ekaf (1.0.0)
25
+ fake (0.1.0)
16
26
  """
17
- And the Lockfile has:
18
- | fake | 0.1.0 |
19
- | ekaf | 1.0.0 |
20
27
  When I successfully run `berks update`
21
- Then the Lockfile should have:
22
- | fake | 0.2.0 |
23
- | ekaf | 1.0.1 |
28
+ Then the file "Berksfile.lock" should contain:
29
+ """
30
+ DEPENDENCIES
31
+ ekaf (~> 1.0.0)
32
+ fake (~> 0.1)
33
+
34
+ GRAPH
35
+ ekaf (1.0.1)
36
+ fake (0.2.0)
37
+ """
24
38
 
25
39
  Scenario: With a single cookbook specified
26
40
  And I have a Berksfile pointing at the local Berkshelf API with:
27
41
  """
28
- cookbook 'fake', '~> 0.1'
29
42
  cookbook 'ekaf', '~> 1.0.0'
43
+ cookbook 'fake', '~> 0.1'
44
+ """
45
+ And I write to "Berksfile.lock" with:
46
+ """
47
+ DEPENDENCIES
48
+ ekaf (~> 1.0.0)
49
+ fake (~> 0.1)
50
+
51
+ GRAPH
52
+ ekaf (1.0.0)
53
+ fake (0.1.0)
30
54
  """
31
- And the Lockfile has:
32
- | fake | 0.1.0 |
33
- | ekaf | 1.0.0 |
34
55
  When I successfully run `berks update fake`
35
- Then the Lockfile should have:
36
- | fake | 0.2.0 |
37
- | ekaf | 1.0.0 |
56
+ Then the file "Berksfile.lock" should contain:
57
+ """
58
+ DEPENDENCIES
59
+ ekaf (~> 1.0.0)
60
+ fake (~> 0.1)
61
+
62
+ GRAPH
63
+ ekaf (1.0.0)
64
+ fake (0.2.0)
65
+ """
38
66
 
39
67
  Scenario: With a cookbook that does not exist
40
68
  Given I have a Berksfile pointing at the local Berkshelf API
41
69
  When I run `berks update not_real`
42
70
  Then the output should contain:
43
71
  """
44
- Could not find cookbook(s) 'not_real' in any of the configured dependencies. Is it in your Berksfile?
72
+ Could not find cookbook 'not_real'. Make sure it is in your Berksfile, then run `berks install` to download and install the missing dependencies.
45
73
  """
46
74
  And the exit status should be "DependencyNotFound"
@@ -49,7 +49,7 @@ Feature: berks upload
49
49
  When I run `berks upload reset`
50
50
  Then the output should contain:
51
51
  """
52
- Could not find cookbook(s) 'reset' in any of the configured dependencies. Is it in your Berksfile?
52
+ Could not find cookbook 'reset'. Make sure it is in your Berksfile, then run `berks install` to download and install the missing dependencies.
53
53
  """
54
54
  And the exit status should be "DependencyNotFound"
55
55
 
@@ -169,6 +169,7 @@ Feature: berks upload
169
169
  Given a cookbook named "fake"
170
170
  And the cookbook "fake" has the file "Berksfile" with:
171
171
  """
172
+ source 'https://api.berkshelf.com'
172
173
  metadata
173
174
  """
174
175
  And the Chef Server has frozen cookbooks:
@@ -182,6 +183,7 @@ Feature: berks upload
182
183
 
183
184
  * fake (0.0.0)
184
185
  """
186
+
185
187
  Scenario: When the syntax check is skipped
186
188
  Given a cookbook named "fake"
187
189
  And the cookbook "fake" has the file "recipes/default.rb" with:
@@ -200,6 +202,7 @@ Feature: berks upload
200
202
  """
201
203
  And the cookbook "fake" has the file "Berksfile" with:
202
204
  """
205
+ source 'https://api.berkshelf.com'
203
206
  metadata
204
207
  """
205
208
  And I cd to "fake"
@@ -30,6 +30,24 @@ Feature: Vendoring cookbooks to a directory
30
30
  When I successfully run `berks vendor cukebooks`
31
31
  And the directory "cukebooks/fake" should contain version "0.0.0" of the "fake" cookbook
32
32
 
33
+ Scenario: vendoring a cookbook with transitive dependencies
34
+ Given I have a Berksfile pointing at the local Berkshelf API with:
35
+ """
36
+ metadata
37
+ """
38
+ And I write to "metadata.rb" with:
39
+ """
40
+ name 'bacon'
41
+ version '1.0.0'
42
+
43
+ depends 'fake'
44
+ depends 'ekaf'
45
+ """
46
+ When I successfully run `berks vendor vendor`
47
+ Then the directory "vendor/bacon" should contain version "1.0.0" of the "bacon" cookbook
48
+ And the directory "vendor/fake" should contain version "1.0.0" of the "fake" cookbook
49
+ And the directory "vendor/ekaf" should contain version "2.0.0" of the "ekaf" cookbook
50
+
33
51
  Scenario: vendoring without an explicit path to vendor into
34
52
  Given I have a Berksfile pointing at the local Berkshelf API with:
35
53
  """
@@ -46,3 +64,12 @@ Feature: Vendoring cookbooks to a directory
46
64
  And a directory named "cukebooks"
47
65
  When I run `berks vendor cukebooks`
48
66
  And the exit status should be "VendorError"
67
+
68
+ Scenario: vendoring into a nested directory
69
+ Given I have a Berksfile pointing at the local Berkshelf API with:
70
+ """
71
+ cookbook 'fake'
72
+ """
73
+ When I successfully run `berks vendor path/to/cukebooks`
74
+ Then the directory "path/to/cukebooks/fake" should contain version "1.0.0" of the "fake" cookbook
75
+
@@ -28,14 +28,14 @@ Feature: --format json
28
28
 
29
29
  ],
30
30
  "messages": [
31
- "building universe..."
31
+ "Fetching cookbook index from http://0.0.0.0:26210..."
32
32
  ]
33
33
  }
34
34
  """
35
35
 
36
36
  Scenario: JSON output installing a cookbook we already have
37
37
  Given the cookbook store has the cookbooks:
38
- | berkshelf-cookbook-fixture | 1.0.0 |
38
+ | berkshelf-cookbook-fixture | 1.0.0 |
39
39
  And I have a Berksfile pointing at the local Berkshelf API with:
40
40
  """
41
41
  cookbook 'berkshelf-cookbook-fixture', '1.0.0'
@@ -54,7 +54,7 @@ Feature: --format json
54
54
 
55
55
  ],
56
56
  "messages": [
57
- "building universe..."
57
+ "Fetching cookbook index from http://0.0.0.0:26210..."
58
58
  ]
59
59
  }
60
60
  """
@@ -66,8 +66,14 @@ Feature: --format json
66
66
  """
67
67
  cookbook 'fake', '1.0.0'
68
68
  """
69
- And the Lockfile has:
70
- | fake | 1.0.0 |
69
+ And I write to "Berksfile.lock" with:
70
+ """
71
+ DEPENDENCIES
72
+ fake (= 1.0.0)
73
+
74
+ GRAPH
75
+ fake (1.0.0)
76
+ """
71
77
  When I successfully run `berks show fake --format json`
72
78
  Then the output should contain JSON:
73
79
  """
@@ -111,7 +117,7 @@ Feature: --format json
111
117
 
112
118
  ],
113
119
  "messages": [
114
- "building universe..."
120
+ "Fetching cookbook index from http://0.0.0.0:26210..."
115
121
  ]
116
122
  }
117
123
  """
@@ -128,8 +134,14 @@ Feature: --format json
128
134
  """
129
135
  cookbook 'seth', '~> 0.1'
130
136
  """
131
- And the Lockfile has:
132
- | seth | 0.1.0 |
137
+ And I write to "Berksfile.lock" with:
138
+ """
139
+ DEPENDENCIES
140
+ seth (~> 0.1)
141
+
142
+ GRAPH
143
+ seth (0.1.0)
144
+ """
133
145
  And I successfully run `berks outdated --format json`
134
146
  Then the output should contain JSON:
135
147
  """
@@ -17,37 +17,14 @@ Feature: Creating and reading the Berkshelf lockfile
17
17
  cookbook 'fake', '1.0.0'
18
18
  """
19
19
  When I successfully run `berks install`
20
- Then the Lockfile should have:
21
- | fake | 1.0.0 |
22
-
23
- Scenario: Writing the Berksfile.lock when a 1.0 lockfile is present
24
- Given I have a Berksfile pointing at the local Berkshelf API with:
25
- """
26
- cookbook 'fake', '1.0.0'
27
- """
28
- And I write to "Berksfile.lock" with:
20
+ Then the file "Berksfile.lock" should contain:
29
21
  """
30
- cookbook 'fake', :locked_version => '1.0.0'
31
- """
32
- When I successfully run `berks install`
33
- Then the output should warn about the old lockfile format
34
- And the Lockfile should have:
35
- | fake | 1.0.0 |
22
+ DEPENDENCIES
23
+ fake (= 1.0.0)
36
24
 
37
- Scenario: Writing the Berksfile.lock when a 1.0 lockfile is present and contains a full path
38
- Given a cookbook named "fake"
39
- And I have a Berksfile pointing at the local Berkshelf API with:
40
- """
41
- cookbook 'fake', '0.0.0', path: './fake'
25
+ GRAPH
26
+ fake (1.0.0)
42
27
  """
43
- And I write to "Berksfile.lock" with:
44
- """
45
- cookbook 'fake', :locked_version => '0.0.0', path: '../../tmp/aruba/fake'
46
- """
47
- When I successfully run `berks install`
48
- Then the output should warn about the old lockfile format
49
- Then the Lockfile should have:
50
- | fake | ./fake |
51
28
 
52
29
  Scenario: Writing the Berksfile.lock when a 2.0 lockfile is present
53
30
  Given I have a Berksfile pointing at the local Berkshelf API with:
@@ -65,19 +42,39 @@ Feature: Creating and reading the Berkshelf lockfile
65
42
  }
66
43
  """
67
44
  When I successfully run `berks install`
68
- Then the Lockfile should have:
69
- | fake | 1.0.0 |
45
+ Then the output should contain:
46
+ """
47
+ It looks like you are using an older version of the lockfile.
48
+ """
49
+ And the file "Berksfile.lock" should contain:
50
+ """
51
+ DEPENDENCIES
52
+ fake (= 1.0.0)
53
+
54
+ GRAPH
55
+ fake (1.0.0)
56
+ """
70
57
 
71
58
  Scenario: Reading the Berksfile.lock when it contains an invalid path location
72
59
  Given I have a Berksfile pointing at the local Berkshelf API with:
73
60
  """
74
61
  cookbook 'fake'
75
62
  """
76
- And the Lockfile has:
77
- | non-existent | /this/path/does/not/exist |
63
+ And I write to "Berksfile.lock" with:
64
+ """
65
+ DEPENDENCIES
66
+ non-existent (~> 0.1)
67
+ path: /this/path/does/not/exist
68
+ """
78
69
  When I successfully run `berks install`
79
- Then the Lockfile should have:
80
- | fake | 1.0.0 |
70
+ And the file "Berksfile.lock" should contain:
71
+ """
72
+ DEPENDENCIES
73
+ fake
74
+
75
+ GRAPH
76
+ fake (1.0.0)
77
+ """
81
78
 
82
79
  Scenario: Installing a cookbook with dependencies
83
80
  Given the cookbook store has the cookbooks:
@@ -89,42 +86,85 @@ Feature: Creating and reading the Berkshelf lockfile
89
86
  cookbook 'fake', '1.0.0'
90
87
  """
91
88
  When I successfully run `berks install`
92
- Then the Lockfile should have:
93
- | fake | 1.0.0 |
94
- | dep | 1.0.0 |
89
+ Then the file "Berksfile.lock" should contain:
90
+ """
91
+ DEPENDENCIES
92
+ fake (= 1.0.0)
93
+
94
+ GRAPH
95
+ dep (1.0.0)
96
+ fake (1.0.0)
97
+ dep (~> 1.0.0)
98
+ """
95
99
 
96
100
  Scenario: Writing the Berksfile.lock with a pessimistic lock
97
101
  And I have a Berksfile pointing at the local Berkshelf API with:
98
102
  """
99
103
  cookbook 'fake', '~> 1.0.0'
100
104
  """
101
- And the Lockfile has:
102
- | fake | 1.0.0 |
105
+ And I write to "Berksfile.lock" with:
106
+ """
107
+ DEPENDENCIES
108
+ fake (~> 1.0.0)
109
+
110
+ GRAPH
111
+ fake (1.0.0)
112
+ """
103
113
  When I successfully run `berks install`
104
- Then the Lockfile should have:
105
- | fake | 1.0.0 |
114
+ Then the file "Berksfile.lock" should contain:
115
+ """
116
+ DEPENDENCIES
117
+ fake (~> 1.0.0)
118
+
119
+ GRAPH
120
+ fake (1.0.0)
121
+ """
106
122
 
107
123
  Scenario: Updating with a Berksfile.lock with pessimistic lock
108
124
  Given I have a Berksfile pointing at the local Berkshelf API with:
109
125
  """
110
126
  cookbook 'fake', '~> 0.1'
111
127
  """
112
- And the Lockfile has:
113
- | fake | 0.1.0 |
128
+ And I write to "Berksfile.lock" with:
129
+ """
130
+ DEPENDENCIES
131
+ fake (~> 0.1)
132
+
133
+ GRAPH
134
+ fake (0.1.0)
135
+ """
114
136
  When I successfully run `berks update fake`
115
- Then the Lockfile should have:
116
- | fake | 0.2.0 |
137
+ Then the file "Berksfile.lock" should contain:
138
+ """
139
+ DEPENDENCIES
140
+ fake (~> 0.1)
141
+
142
+ GRAPH
143
+ fake (0.2.0)
144
+ """
117
145
 
118
146
  Scenario: Updating with a Berksfile.lock with hard lock
119
147
  And I have a Berksfile pointing at the local Berkshelf API with:
120
148
  """
121
149
  cookbook 'fake', '0.1.0'
122
150
  """
123
- And the Lockfile has:
124
- | fake | 0.1.0 |
151
+ And I write to "Berksfile.lock" with:
152
+ """
153
+ DEPENDENCIES
154
+ fake (= 0.1.0)
155
+
156
+ GRAPH
157
+ fake (0.1.0)
158
+ """
125
159
  When I successfully run `berks update fake`
126
- Then the Lockfile should have:
127
- | fake | 0.1.0 |
160
+ Then the file "Berksfile.lock" should contain:
161
+ """
162
+ DEPENDENCIES
163
+ fake (= 0.1.0)
164
+
165
+ GRAPH
166
+ fake (0.1.0)
167
+ """
128
168
 
129
169
  Scenario: Updating a Berksfile.lock with a git location
130
170
  Given I have a Berksfile pointing at the local Berkshelf API with:
@@ -132,8 +172,16 @@ Feature: Creating and reading the Berkshelf lockfile
132
172
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', ref: '919afa0c4'
133
173
  """
134
174
  When I successfully run `berks install`
135
- Then the Lockfile should have:
136
- | berkshelf-cookbook-fixture | 1.0.0 | 919afa0c402089df23ebdf36637f12271b8a96b4 |
175
+ Then the file "Berksfile.lock" should contain:
176
+ """
177
+ DEPENDENCIES
178
+ berkshelf-cookbook-fixture
179
+ git: git://github.com/RiotGames/berkshelf-cookbook-fixture.git
180
+ ref: 919afa0c402089df23ebdf36637f12271b8a96b4
181
+
182
+ GRAPH
183
+ berkshelf-cookbook-fixture (1.0.0)
184
+ """
137
185
 
138
186
  Scenario: Updating a Berksfile.lock with a git location and a branch
139
187
  Given I have a Berksfile pointing at the local Berkshelf API with:
@@ -141,8 +189,17 @@ Feature: Creating and reading the Berkshelf lockfile
141
189
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', branch: 'master'
142
190
  """
143
191
  When I successfully run `berks install`
144
- Then the Lockfile should have:
145
- | berkshelf-cookbook-fixture | 1.0.0 | a97b9447cbd41a5fe58eee2026e48ccb503bd3bc |
192
+ Then the file "Berksfile.lock" should contain:
193
+ """
194
+ DEPENDENCIES
195
+ berkshelf-cookbook-fixture
196
+ git: git://github.com/RiotGames/berkshelf-cookbook-fixture.git
197
+ branch: master
198
+ ref: a97b9447cbd41a5fe58eee2026e48ccb503bd3bc
199
+
200
+ GRAPH
201
+ berkshelf-cookbook-fixture (1.0.0)
202
+ """
146
203
 
147
204
  Scenario: Updating a Berksfile.lock with a git location and a branch
148
205
  Given I have a Berksfile pointing at the local Berkshelf API with:
@@ -150,8 +207,17 @@ Feature: Creating and reading the Berkshelf lockfile
150
207
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', tag: 'v0.2.0'
151
208
  """
152
209
  When I successfully run `berks install`
153
- Then the Lockfile should have:
154
- | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
210
+ Then the file "Berksfile.lock" should contain:
211
+ """
212
+ DEPENDENCIES
213
+ berkshelf-cookbook-fixture
214
+ git: git://github.com/RiotGames/berkshelf-cookbook-fixture.git
215
+ branch: v0.2.0
216
+ ref: 70a527e17d91f01f031204562460ad1c17f972ee
217
+
218
+ GRAPH
219
+ berkshelf-cookbook-fixture (0.2.0)
220
+ """
155
221
 
156
222
  Scenario: Updating a Berksfile.lock with a GitHub location
157
223
  Given I have a Berksfile pointing at the local Berkshelf API with:
@@ -159,8 +225,16 @@ Feature: Creating and reading the Berkshelf lockfile
159
225
  cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', ref: '919afa0c4'
160
226
  """
161
227
  When I successfully run `berks install`
162
- Then the Lockfile should have:
163
- | berkshelf-cookbook-fixture | 1.0.0 | 919afa0c402089df23ebdf36637f12271b8a96b4 |
228
+ Then the file "Berksfile.lock" should contain:
229
+ """
230
+ DEPENDENCIES
231
+ berkshelf-cookbook-fixture
232
+ git: git://github.com/RiotGames/berkshelf-cookbook-fixture.git
233
+ ref: 919afa0c402089df23ebdf36637f12271b8a96b4
234
+
235
+ GRAPH
236
+ berkshelf-cookbook-fixture (1.0.0)
237
+ """
164
238
 
165
239
  Scenario: Updating a Berksfile.lock when a git location with :rel
166
240
  Given I have a Berksfile pointing at the local Berkshelf API with:
@@ -168,8 +242,18 @@ Feature: Creating and reading the Berkshelf lockfile
168
242
  cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
169
243
  """
170
244
  When I successfully run `berks install`
171
- Then the Lockfile should have:
172
- | berkshelf-cookbook-fixture | 1.0.0 | 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a | cookbooks/berkshelf-cookbook-fixture |
245
+ Then the file "Berksfile.lock" should contain:
246
+ """
247
+ DEPENDENCIES
248
+ berkshelf-cookbook-fixture
249
+ git: git://github.com/RiotGames/berkshelf-cookbook-fixture.git
250
+ branch: rel
251
+ ref: 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a
252
+ rel: cookbooks/berkshelf-cookbook-fixture
253
+
254
+ GRAPH
255
+ berkshelf-cookbook-fixture (1.0.0)
256
+ """
173
257
 
174
258
  Scenario: Updating a Berksfile.lock with a path location
175
259
  Given a cookbook named "fake"
@@ -178,8 +262,15 @@ Feature: Creating and reading the Berkshelf lockfile
178
262
  cookbook 'fake', path: './fake'
179
263
  """
180
264
  When I successfully run `berks install`
181
- Then the Lockfile should have:
182
- | fake | ./fake |
265
+ Then the file "Berksfile.lock" should contain:
266
+ """
267
+ DEPENDENCIES
268
+ fake
269
+ path: ./fake
270
+
271
+ GRAPH
272
+ fake (0.0.0)
273
+ """
183
274
 
184
275
  Scenario: Installing a Berksfile with a metadata location
185
276
  Given a cookbook named "fake"
@@ -189,29 +280,59 @@ Feature: Creating and reading the Berkshelf lockfile
189
280
  metadata
190
281
  """
191
282
  When I successfully run `berks install`
192
- Then the Lockfile should have:
193
- | fake | . |
283
+ Then the file "Berksfile.lock" should contain:
284
+ """
285
+ DEPENDENCIES
286
+ fake
287
+ path: .
288
+ metadata: true
194
289
 
195
- Scenario: Installing a Berksfile with a metadata location
290
+ GRAPH
291
+ fake (0.0.0)
292
+ """
293
+
294
+ Scenario: Installing a Berksfile with a locked metadata location
196
295
  Given a cookbook named "fake"
197
296
  And I cd to "fake"
198
297
  And I have a Berksfile pointing at the local Berkshelf API with:
199
298
  """
200
299
  metadata
201
300
  """
202
- And the Lockfile has:
203
- | fake | . |
301
+ And I write to "Berksfile.lock" with:
302
+ """
303
+ DEPENDENCIES
304
+ fake
305
+ path: .
306
+ metadata: true
307
+
308
+ GRAPH
309
+ fake (0.0.0)
310
+ """
204
311
  When I successfully run `berks install`
205
- Then the Lockfile should have:
206
- | fake | . |
312
+ Then the file "Berksfile.lock" should contain:
313
+ """
314
+ DEPENDENCIES
315
+ fake
316
+ path: .
317
+ metadata: true
318
+
319
+ GRAPH
320
+ fake (0.0.0)
321
+ """
207
322
 
208
323
  Scenario: Installing when the locked version is no longer satisfied
209
324
  Given I have a Berksfile pointing at the local Berkshelf API with:
210
325
  """
211
326
  cookbook 'fake', '~> 1.3.0'
212
327
  """
213
- And the Lockfile has:
214
- | fake | 1.0.0 |
328
+ And I write to "Berksfile.lock" with:
329
+ """
330
+ DEPENDENCIES
331
+ fake (~> 1.3.0)
332
+
333
+ GRAPH
334
+ fake (1.0.0)
335
+ """
215
336
  When I run `berks install`
216
337
  Then the output should contain:
217
338
  """
@@ -250,6 +371,6 @@ Feature: Creating and reading the Berkshelf lockfile
250
371
  When I run `berks install`
251
372
  Then the output should contain:
252
373
  """
253
- Error reading the Berkshelf lockfile `Berksfile.lock` (JSON::ParserError)
374
+ Error reading the Berkshelf lockfile:
254
375
  """
255
376
  And the exit status should be "LockfileParserError"