berkshelf 2.0.18 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/.ruby-version +1 -1
  2. data/.travis.yml +4 -1
  3. data/CHANGELOG.md +2 -26
  4. data/Gemfile +12 -2
  5. data/README.md +9 -1
  6. data/berkshelf.gemspec +9 -18
  7. data/bin/berks +3 -13
  8. data/features/apply_command.feature +11 -9
  9. data/features/berksfile.feature +8 -10
  10. data/features/config.feature +1 -2
  11. data/features/configure_command.feature +13 -14
  12. data/features/contingent_command.feature +13 -1
  13. data/features/cookbook_command.feature +2 -4
  14. data/features/groups_install.feature +10 -2
  15. data/features/help.feature +1 -1
  16. data/features/init_command.feature +5 -7
  17. data/features/install_command.feature +157 -228
  18. data/features/json_formatter.feature +27 -15
  19. data/features/licenses.feature +18 -12
  20. data/features/list_command.feature +6 -1
  21. data/features/lockfile.feature +116 -72
  22. data/features/outdated_command.feature +3 -47
  23. data/features/package_command.feature +10 -7
  24. data/features/shelf/show.feature +2 -2
  25. data/features/shelf/uninstall.feature +2 -2
  26. data/features/show_command.feature +10 -3
  27. data/features/step_definitions/chef/config_steps.rb +12 -0
  28. data/features/step_definitions/chef_server_steps.rb +16 -16
  29. data/features/step_definitions/cli_steps.rb +3 -79
  30. data/features/step_definitions/config_steps.rb +43 -0
  31. data/features/step_definitions/environment_steps.rb +7 -0
  32. data/features/step_definitions/filesystem_steps.rb +12 -57
  33. data/features/step_definitions/gem_steps.rb +1 -2
  34. data/features/step_definitions/json_steps.rb +3 -1
  35. data/features/step_definitions/lockfile_steps.rb +4 -0
  36. data/features/step_definitions/utility_steps.rb +0 -19
  37. data/features/support/aruba.rb +12 -0
  38. data/features/support/env.rb +52 -57
  39. data/features/update_command.feature +37 -23
  40. data/features/upload_command.feature +96 -160
  41. data/generator_files/Berksfile.erb +2 -1
  42. data/generator_files/Vagrantfile.erb +3 -0
  43. data/generator_files/default_test.rb.erb +1 -1
  44. data/generator_files/helpers.rb.erb +1 -1
  45. data/lib/berkshelf.rb +43 -24
  46. data/lib/berkshelf/api_client.rb +67 -0
  47. data/lib/berkshelf/api_client/remote_cookbook.rb +42 -0
  48. data/lib/berkshelf/berksfile.rb +232 -420
  49. data/lib/berkshelf/cached_cookbook.rb +22 -10
  50. data/lib/berkshelf/chef/config.rb +1 -0
  51. data/lib/berkshelf/cli.rb +66 -68
  52. data/lib/berkshelf/commands/shelf.rb +1 -1
  53. data/lib/berkshelf/community_rest.rb +10 -17
  54. data/lib/berkshelf/config.rb +23 -27
  55. data/lib/berkshelf/cookbook_generator.rb +3 -4
  56. data/lib/berkshelf/cookbook_store.rb +74 -17
  57. data/lib/berkshelf/core_ext/file.rb +2 -2
  58. data/lib/berkshelf/core_ext/pathname.rb +7 -5
  59. data/lib/berkshelf/{cookbook_source.rb → dependency.rb} +47 -67
  60. data/lib/berkshelf/downloader.rb +49 -106
  61. data/lib/berkshelf/errors.rb +64 -71
  62. data/lib/berkshelf/formatters.rb +11 -9
  63. data/lib/berkshelf/formatters/human_readable.rb +9 -9
  64. data/lib/berkshelf/formatters/json.rb +14 -4
  65. data/lib/berkshelf/init_generator.rb +3 -3
  66. data/lib/berkshelf/installer.rb +136 -0
  67. data/lib/berkshelf/location.rb +91 -131
  68. data/lib/berkshelf/locations/git_location.rb +9 -11
  69. data/lib/berkshelf/locations/github_location.rb +1 -1
  70. data/lib/berkshelf/locations/path_location.rb +10 -27
  71. data/lib/berkshelf/lockfile.rb +92 -70
  72. data/lib/berkshelf/logger.rb +4 -7
  73. data/lib/berkshelf/mixin/config.rb +21 -4
  74. data/lib/berkshelf/resolver.rb +60 -150
  75. data/lib/berkshelf/resolver/graph.rb +44 -0
  76. data/lib/berkshelf/source.rb +55 -0
  77. data/lib/berkshelf/source_uri.rb +38 -0
  78. data/lib/berkshelf/version.rb +1 -1
  79. data/spec/config/knife.rb +1 -1
  80. data/spec/fixtures/cassettes/Berkshelf_Resolver/_initialize/adds_the_dependencies_of_the_dependency_as_dependencies.yml +3694 -0
  81. data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +1 -1
  82. data/spec/fixtures/lockfiles/default.lock +1 -1
  83. data/spec/spec_helper.rb +20 -121
  84. data/spec/support/chef_api.rb +3 -4
  85. data/spec/support/chef_server.rb +20 -11
  86. data/spec/support/git.rb +127 -0
  87. data/spec/support/kitchen.rb +12 -0
  88. data/spec/support/path_helpers.rb +69 -0
  89. data/spec/unit/berkshelf/api_client/remote_cookbook_spec.rb +23 -0
  90. data/spec/unit/berkshelf/api_client_spec.rb +57 -0
  91. data/spec/unit/berkshelf/berksfile_spec.rb +206 -324
  92. data/spec/unit/berkshelf/cached_cookbook_spec.rb +73 -38
  93. data/spec/unit/berkshelf/community_rest_spec.rb +30 -71
  94. data/spec/unit/berkshelf/config_spec.rb +3 -14
  95. data/spec/unit/berkshelf/cookbook_generator_spec.rb +1 -2
  96. data/spec/unit/berkshelf/cookbook_store_spec.rb +12 -7
  97. data/spec/unit/berkshelf/dependency_spec.rb +285 -0
  98. data/spec/unit/berkshelf/downloader_spec.rb +4 -183
  99. data/spec/unit/berkshelf/formatters/null_spec.rb +1 -1
  100. data/spec/unit/berkshelf/formatters_spec.rb +4 -2
  101. data/spec/unit/berkshelf/git_spec.rb +15 -15
  102. data/spec/unit/berkshelf/installer_spec.rb +39 -0
  103. data/spec/unit/berkshelf/location_spec.rb +87 -114
  104. data/spec/unit/berkshelf/locations/git_location_spec.rb +41 -53
  105. data/spec/unit/berkshelf/locations/path_location_spec.rb +13 -23
  106. data/spec/unit/berkshelf/lockfile_spec.rb +38 -40
  107. data/spec/unit/berkshelf/resolver/graph_spec.rb +44 -0
  108. data/spec/unit/berkshelf/resolver_spec.rb +34 -83
  109. data/spec/unit/berkshelf/source_spec.rb +23 -0
  110. data/spec/unit/berkshelf/source_uri_spec.rb +29 -0
  111. metadata +149 -188
  112. checksums.yaml +0 -7
  113. data/features/default_locations.feature +0 -127
  114. data/features/step_definitions/berksfile_steps.rb +0 -8
  115. data/features/step_definitions/configure_cli_steps.rb +0 -19
  116. data/features/vendor_install.feature +0 -19
  117. data/lib/berkshelf/core_ext/openuri.rb +0 -36
  118. data/lib/berkshelf/core_ext/rbzip2.rb +0 -8
  119. data/lib/berkshelf/locations/chef_api_location.rb +0 -228
  120. data/lib/berkshelf/locations/site_location.rb +0 -92
  121. data/lib/berkshelf/test.rb +0 -35
  122. data/spec/knife.rb.sample +0 -12
  123. data/spec/support/test_generators.rb +0 -27
  124. data/spec/unit/berkshelf/cli_spec.rb +0 -16
  125. data/spec/unit/berkshelf/cookbook_source_spec.rb +0 -358
  126. data/spec/unit/berkshelf/core_ext/pathname_spec.rb +0 -46
  127. data/spec/unit/berkshelf/locations/chef_api_location_spec.rb +0 -139
  128. data/spec/unit/berkshelf/locations/site_location_spec.rb +0 -19
@@ -3,27 +3,36 @@ Feature: --format json
3
3
  I want to be able to get all output in JSON format
4
4
  So I can easily parse the output in scripts
5
5
 
6
+ Background:
7
+ Given the Berkshelf API server's cache is empty
8
+ And the Chef Server is empty
9
+ And the cookbook store is empty
10
+
6
11
  Scenario: JSON output installing a cookbook from the default location
7
12
  Given I write to "Berksfile" with:
8
13
  """
9
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
14
+ source "http://localhost:26210"
15
+
16
+ cookbook 'berkshelf', '1.0.0'
10
17
  """
18
+ And the Chef Server has cookbooks:
19
+ | berkshelf | 1.0.0 |
20
+ And the Berkshelf API server cache is up to date
11
21
  When I successfully run `berks install --format json`
12
- Then the stdout should contain JSON:
22
+ Then the output should contain JSON:
13
23
  """
14
24
  {
15
25
  "cookbooks": [
16
26
  {
17
27
  "version": "1.0.0",
18
- "location": "site: 'http://cookbooks.opscode.com/api/v1/cookbooks'",
19
- "name": "berkshelf-cookbook-fixture"
28
+ "name": "berkshelf"
20
29
  }
21
30
  ],
22
31
  "errors": [
23
32
 
24
33
  ],
25
34
  "messages": [
26
-
35
+ "building universe..."
27
36
  ]
28
37
  }
29
38
  """
@@ -33,10 +42,12 @@ Feature: --format json
33
42
  | berkshelf-cookbook-fixture | 1.0.0 |
34
43
  And I write to "Berksfile" with:
35
44
  """
45
+ source "http://localhost:26210"
46
+
36
47
  cookbook 'berkshelf-cookbook-fixture', '1.0.0'
37
48
  """
38
49
  When I successfully run `berks install --format json`
39
- Then the stdout should contain JSON:
50
+ Then the output should contain JSON:
40
51
  """
41
52
  {
42
53
  "cookbooks": [
@@ -49,19 +60,20 @@ Feature: --format json
49
60
 
50
61
  ],
51
62
  "messages": [
52
-
63
+ "building universe..."
53
64
  ]
54
65
  }
55
66
  """
56
67
 
57
- @chef_server
58
68
  Scenario: JSON output when running the upload command
59
- Given a Berksfile with path location sources to fixtures:
60
- | example_cookbook | example_cookbook-0.5.0 |
61
- And the Chef server does not have the cookbooks:
62
- | example_cookbook | 0.5.0 |
69
+ Given I write to "Berksfile" with:
70
+ """
71
+ source "http://localhost:26210"
72
+
73
+ cookbook 'example_cookbook', path: '../../spec/fixtures/cookbooks/example_cookbook-0.5.0'
74
+ """
63
75
  When I successfully run `berks upload --format json`
64
- Then the stdout should contain JSON:
76
+ Then the output should contain JSON:
65
77
  """
66
78
  {
67
79
  "cookbooks": [
@@ -69,14 +81,14 @@ Feature: --format json
69
81
  "name": "example_cookbook",
70
82
  "version": "0.5.0",
71
83
  "location": "../../spec/fixtures/cookbooks/example_cookbook-0.5.0",
72
- "uploaded_to": "http://localhost:4000/"
84
+ "uploaded_to": "http://localhost:26310/"
73
85
  }
74
86
  ],
75
87
  "errors": [
76
88
 
77
89
  ],
78
90
  "messages": [
79
-
91
+ "building universe..."
80
92
  ]
81
93
  }
82
94
  """
@@ -3,12 +3,18 @@ Feature: Installing cookbooks with specific licenses
3
3
  I want to ensure my company only uses cookbooks that fall in our legal realm
4
4
  So that I can safely install and legally use community cookbooks
5
5
 
6
+ Background:
7
+ Given the Berkshelf API server's cache is empty
8
+ And the Chef Server is empty
9
+ And the cookbook store is empty
10
+
6
11
  Scenario: With licenses defined
7
12
  Given the cookbook store has the cookbooks:
8
13
  | berkshelf-cookbook-fixture | 0.1.0 | mit |
9
14
  And I write to "Berksfile" with:
10
15
  """
11
- site :opscode
16
+ source "http://localhost:26210"
17
+
12
18
  cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
13
19
  """
14
20
  And I have a Berkshelf config file containing:
@@ -22,14 +28,14 @@ Feature: Installing cookbooks with specific licenses
22
28
  """
23
29
  is not in your list of allowed licenses
24
30
  """
25
- And the exit status should be 0
26
31
 
27
32
  Scenario: With a license that is not listed
28
33
  Given the cookbook store has the cookbooks:
29
34
  | berkshelf-cookbook-fixture | 0.1.0 | mit |
30
35
  And I write to "Berksfile" with:
31
36
  """
32
- site :opscode
37
+ source "http://localhost:26210"
38
+
33
39
  cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
34
40
  """
35
41
  And I have a Berkshelf config file containing:
@@ -43,14 +49,14 @@ Feature: Installing cookbooks with specific licenses
43
49
  """
44
50
  'mit' is not in your list of allowed licenses
45
51
  """
46
- And the exit status should be 0
47
52
 
48
53
  Scenario: With raise_license_exception defined
49
54
  Given the cookbook store has the cookbooks:
50
55
  | berkshelf-cookbook-fixture | 0.1.0 | mit |
51
56
  And I write to "Berksfile" with:
52
57
  """
53
- site :opscode
58
+ source "http://localhost:26210"
59
+
54
60
  cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
55
61
  """
56
62
  And I have a Berkshelf config file containing:
@@ -65,14 +71,14 @@ Feature: Installing cookbooks with specific licenses
65
71
  """
66
72
  is not in your list of allowed licenses
67
73
  """
68
- And the exit status should be 0
69
74
 
70
75
  Scenario: With a license that is not listed
71
76
  Given the cookbook store has the cookbooks:
72
77
  | berkshelf-cookbook-fixture | 0.1.0 | mit |
73
78
  And I write to "Berksfile" with:
74
79
  """
75
- site :opscode
80
+ source "http://localhost:26210"
81
+
76
82
  cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
77
83
  """
78
84
  And I have a Berkshelf config file containing:
@@ -87,15 +93,16 @@ Feature: Installing cookbooks with specific licenses
87
93
  """
88
94
  'mit' is not in your list of allowed licenses
89
95
  """
90
- And the CLI should exit with the status code for error "LicenseNotAllowed"
96
+ And the exit status should be "LicenseNotAllowed"
91
97
 
92
98
  Scenario: With a :path location
93
99
  Given the cookbook store has the cookbooks:
94
100
  | fake | 0.1.0 | mit |
95
101
  And I write to "Berksfile" with:
96
102
  """
97
- site :opscode
98
- cookbook 'fake', path: '../berkshelf/cookbooks/fake-0.1.0'
103
+ source "http://localhost:26210"
104
+
105
+ cookbook 'fake', path: '../../spec/tmp/berkshelf/cookbooks/fake-0.1.0'
99
106
  """
100
107
  And I have a Berkshelf config file containing:
101
108
  """
@@ -104,9 +111,8 @@ Feature: Installing cookbooks with specific licenses
104
111
  "raise_license_exception": true
105
112
  }
106
113
  """
107
- When I run `berks install`
114
+ When I successfully run `berks install`
108
115
  Then the output should not contain:
109
116
  """
110
117
  'mit' is not in your list of allowed licenses
111
118
  """
112
- And the exit status should be 0
@@ -9,6 +9,8 @@ Feature: Listing cookbooks defined by a Berksfile
9
9
  | fake2 | 1.0.1 |
10
10
  Given I write to "Berksfile" with:
11
11
  """
12
+ source "http://localhost:26210"
13
+
12
14
  cookbook 'fake1', '1.0.0'
13
15
  cookbook 'fake2', '1.0.1'
14
16
  """
@@ -22,7 +24,10 @@ Feature: Listing cookbooks defined by a Berksfile
22
24
  And the exit status should be 0
23
25
 
24
26
  Scenario: Running the list command with no sources defined
25
- Given an empty file named "Berksfile"
27
+ Given I write to "Berksfile" with:
28
+ """
29
+ source "http://localhost:26210"
30
+ """
26
31
  When I successfully run `berks list`
27
32
  Then the output should contain:
28
33
  """
@@ -8,26 +8,30 @@ Feature: Creating and reading the Berkshelf lockfile
8
8
  | fake | 1.0.0 |
9
9
  And I write to "Berksfile" with:
10
10
  """
11
+ source "http://localhost:26210"
12
+
11
13
  cookbook 'fake', '1.0.0'
12
14
  """
13
15
  When I successfully run `berks install`
14
16
  Then the file "Berksfile.lock" should contain JSON:
15
17
  """
16
18
  {
17
- "sources":{
19
+ "dependencies":{
18
20
  "fake":{
21
+ "constraint":"= 1.0.0",
19
22
  "locked_version":"1.0.0"
20
23
  }
21
24
  }
22
25
  }
23
26
  """
24
27
 
25
- Scenario: Wiring the Berksfile.lock when an old lockfile is present
28
+ Scenario: Wiring the Berksfile.lock when a 1.0 lockfile is present
26
29
  Given the cookbook store has the cookbooks:
27
30
  | fake | 1.0.0 |
28
31
  And I write to "Berksfile" with:
29
32
  """
30
- site :opscode
33
+ source "http://localhost:26210"
34
+
31
35
  cookbook 'fake', '1.0.0'
32
36
  """
33
37
  And I write to "Berksfile.lock" with:
@@ -35,12 +39,46 @@ Feature: Creating and reading the Berkshelf lockfile
35
39
  cookbook 'fake', :locked_version => '1.0.0'
36
40
  """
37
41
  When I successfully run `berks install`
38
- Then the output should contain "You are using the old lockfile format. Attempting to convert..."
42
+ Then the output should warn about the old lockfile format
43
+ Then the file "Berksfile.lock" should contain JSON:
44
+ """
45
+ {
46
+ "dependencies": {
47
+ "fake": {
48
+ "constraint": "= 1.0.0",
49
+ "locked_version": "1.0.0"
50
+ }
51
+ }
52
+ }
53
+ """
54
+
55
+ Scenario: Wiring the Berksfile.lock when a 2.0 lockfile is present
56
+ Given the cookbook store has the cookbooks:
57
+ | fake | 1.0.0 |
58
+ And I write to "Berksfile" with:
59
+ """
60
+ source "http://localhost:26210"
61
+
62
+ cookbook 'fake', '1.0.0'
63
+ """
64
+ And I write to "Berksfile.lock" with:
65
+ """
66
+ {
67
+ "dependencies": {
68
+ "fake": {
69
+ "constraint": "= 1.0.0",
70
+ "locked_version": "1.0.0"
71
+ }
72
+ }
73
+ }
74
+ """
75
+ When I successfully run `berks install`
39
76
  Then the file "Berksfile.lock" should contain JSON:
40
77
  """
41
78
  {
42
- "sources": {
79
+ "dependencies": {
43
80
  "fake": {
81
+ "constraint": "= 1.0.0",
44
82
  "locked_version": "1.0.0"
45
83
  }
46
84
  }
@@ -51,19 +89,22 @@ Feature: Creating and reading the Berkshelf lockfile
51
89
  Given a cookbook named "fake"
52
90
  And I write to "Berksfile" with:
53
91
  """
92
+ source "http://localhost:26210"
93
+
54
94
  cookbook 'fake', '0.0.0', path: './fake'
55
95
  """
56
- And I dynamically write to "Berksfile.lock" with:
96
+ And I write to "Berksfile.lock" with:
57
97
  """
58
- cookbook 'fake', :locked_version => '0.0.0', path: '<%= File.expand_path('tmp/aruba/fake') %>'
98
+ cookbook 'fake', :locked_version => '0.0.0', path: '../../tmp/aruba/fake'
59
99
  """
60
100
  When I successfully run `berks install`
61
- Then the output should contain "You are using the old lockfile format. Attempting to convert..."
101
+ Then the output should warn about the old lockfile format
62
102
  Then the file "Berksfile.lock" should contain JSON:
63
103
  """
64
104
  {
65
- "sources":{
105
+ "dependencies":{
66
106
  "fake":{
107
+ "constraint":"= 0.0.0",
67
108
  "path":"./fake"
68
109
  }
69
110
  }
@@ -75,12 +116,14 @@ Feature: Creating and reading the Berkshelf lockfile
75
116
  | fake | 1.0.0 |
76
117
  And I write to "Berksfile" with:
77
118
  """
119
+ source "http://localhost:26210"
120
+
78
121
  cookbook 'fake'
79
122
  """
80
123
  And I write to "Berksfile.lock" with:
81
124
  """
82
125
  {
83
- "sources":{
126
+ "dependencies":{
84
127
  "non-existent":{
85
128
  "path":"/this/path/does/not/exist"
86
129
  }
@@ -91,14 +134,13 @@ Feature: Creating and reading the Berkshelf lockfile
91
134
  Then the file "Berksfile.lock" should contain JSON:
92
135
  """
93
136
  {
94
- "sources":{
137
+ "dependencies":{
95
138
  "fake":{
96
139
  "locked_version":"1.0.0"
97
140
  }
98
141
  }
99
142
  }
100
143
  """
101
- And the exit status should be 0
102
144
 
103
145
  Scenario: Installing a cookbook with dependencies
104
146
  Given the cookbook store has the cookbooks:
@@ -107,18 +149,21 @@ Feature: Creating and reading the Berkshelf lockfile
107
149
  | dep | ~> 1.0.0 |
108
150
  And I write to "Berksfile" with:
109
151
  """
152
+ source "http://localhost:26210"
153
+
110
154
  cookbook 'fake', '1.0.0'
111
155
  """
112
156
  When I successfully run `berks install`
113
157
  Then the file "Berksfile.lock" should contain JSON:
114
158
  """
115
159
  {
116
- "sources":{
160
+ "dependencies": {
117
161
  "fake":{
118
- "locked_version":"1.0.0"
162
+ "constraint": "= 1.0.0",
163
+ "locked_version": "1.0.0"
119
164
  },
120
165
  "dep":{
121
- "locked_version":"1.0.0"
166
+ "locked_version": "1.0.0"
122
167
  }
123
168
  }
124
169
  }
@@ -129,14 +174,16 @@ Feature: Creating and reading the Berkshelf lockfile
129
174
  | berkshelf-cookbook-fixture | 1.0.0 |
130
175
  And I write to "Berksfile" with:
131
176
  """
132
- site :opscode
177
+ source "http://localhost:26210"
178
+
133
179
  cookbook 'berkshelf-cookbook-fixture', '~> 1.0.0'
134
180
  """
135
181
  And I write to "Berksfile.lock" with:
136
182
  """
137
183
  {
138
- "sources":{
184
+ "dependencies":{
139
185
  "berkshelf-cookbook-fixture":{
186
+ "constraint":"~> 1.0.0",
140
187
  "locked_version":"1.0.0"
141
188
  }
142
189
  }
@@ -146,8 +193,9 @@ Feature: Creating and reading the Berkshelf lockfile
146
193
  Then the file "Berksfile.lock" should contain JSON:
147
194
  """
148
195
  {
149
- "sources":{
196
+ "dependencies":{
150
197
  "berkshelf-cookbook-fixture":{
198
+ "constraint":"~> 1.0.0",
151
199
  "locked_version":"1.0.0"
152
200
  }
153
201
  }
@@ -160,14 +208,16 @@ Feature: Creating and reading the Berkshelf lockfile
160
208
  | berkshelf-cookbook-fixture | 1.0.0 |
161
209
  And I write to "Berksfile" with:
162
210
  """
163
- site :opscode
211
+ source "http://localhost:26210"
212
+
164
213
  cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
165
214
  """
166
215
  And I write to "Berksfile.lock" with:
167
216
  """
168
217
  {
169
- "sources":{
218
+ "dependencies":{
170
219
  "berkshelf-cookbook-fixture":{
220
+ "constraint":"~> 0.1",
171
221
  "locked_version":"0.1.0"
172
222
  }
173
223
  }
@@ -177,8 +227,9 @@ Feature: Creating and reading the Berkshelf lockfile
177
227
  Then the file "Berksfile.lock" should contain JSON:
178
228
  """
179
229
  {
180
- "sources":{
230
+ "dependencies":{
181
231
  "berkshelf-cookbook-fixture":{
232
+ "constraint":"~> 0.1",
182
233
  "locked_version":"0.2.0"
183
234
  }
184
235
  }
@@ -190,14 +241,16 @@ Feature: Creating and reading the Berkshelf lockfile
190
241
  | berkshelf-cookbook-fixture | 1.0.0 |
191
242
  And I write to "Berksfile" with:
192
243
  """
193
- site :opscode
244
+ source "http://localhost:26210"
245
+
194
246
  cookbook 'berkshelf-cookbook-fixture', '1.0.0'
195
247
  """
196
248
  And I write to "Berksfile.lock" with:
197
249
  """
198
250
  {
199
- "sources":{
251
+ "dependencies":{
200
252
  "berkshelf-cookbook-fixture":{
253
+ "constraint":"= 1.0.0",
201
254
  "locked_version":"1.0.0"
202
255
  }
203
256
  }
@@ -207,8 +260,9 @@ Feature: Creating and reading the Berkshelf lockfile
207
260
  Then the file "Berksfile.lock" should contain JSON:
208
261
  """
209
262
  {
210
- "sources":{
263
+ "dependencies":{
211
264
  "berkshelf-cookbook-fixture":{
265
+ "constraint":"= 1.0.0",
212
266
  "locked_version":"1.0.0"
213
267
  }
214
268
  }
@@ -217,17 +271,18 @@ Feature: Creating and reading the Berkshelf lockfile
217
271
 
218
272
  Scenario: Updating a Berksfile.lock with a git location
219
273
  Given the cookbook store has the cookbooks:
220
- | berkshelf-cookbook-fixture | 919afa0c402089df23ebdf36637f12271b8a96b4 |
274
+ | berkshelf-cookbook-fixture | 1.0.0 |
221
275
  And I write to "Berksfile" with:
222
276
  """
223
- site :opscode
277
+ source "http://localhost:26210"
278
+
224
279
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', ref: '919afa0c4'
225
280
  """
226
281
  When I successfully run `berks install`
227
282
  Then the file "Berksfile.lock" should contain JSON:
228
283
  """
229
284
  {
230
- "sources":{
285
+ "dependencies":{
231
286
  "berkshelf-cookbook-fixture":{
232
287
  "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
233
288
  "ref":"919afa0c402089df23ebdf36637f12271b8a96b4",
@@ -239,17 +294,18 @@ Feature: Creating and reading the Berkshelf lockfile
239
294
 
240
295
  Scenario: Updating a Berksfile.lock with a git location and a branch
241
296
  Given the cookbook store has the cookbooks:
242
- | berkshelf-cookbook-fixture | master |
297
+ | berkshelf-cookbook-fixture | 1.0.0 |
243
298
  And I write to "Berksfile" with:
244
299
  """
245
- site :opscode
300
+ source "http://localhost:26210"
301
+
246
302
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', branch: 'master'
247
303
  """
248
304
  When I successfully run `berks install`
249
305
  Then the file "Berksfile.lock" should contain JSON:
250
306
  """
251
307
  {
252
- "sources":{
308
+ "dependencies":{
253
309
  "berkshelf-cookbook-fixture":{
254
310
  "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
255
311
  "ref":"a97b9447cbd41a5fe58eee2026e48ccb503bd3bc",
@@ -264,14 +320,15 @@ Feature: Creating and reading the Berkshelf lockfile
264
320
  | berkshelf-cookbook-fixture | 70a527e17d91f01f031204562460ad1c17f972ee |
265
321
  And I write to "Berksfile" with:
266
322
  """
267
- site :opscode
323
+ source "http://localhost:26210"
324
+
268
325
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', tag: 'v0.2.0'
269
326
  """
270
327
  When I successfully run `berks install`
271
328
  Then the file "Berksfile.lock" should contain JSON:
272
329
  """
273
330
  {
274
- "sources":{
331
+ "dependencies":{
275
332
  "berkshelf-cookbook-fixture":{
276
333
  "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
277
334
  "ref":"70a527e17d91f01f031204562460ad1c17f972ee",
@@ -286,14 +343,15 @@ Feature: Creating and reading the Berkshelf lockfile
286
343
  | berkshelf-cookbook-fixture | 919afa0c402089df23ebdf36637f12271b8a96b4 |
287
344
  And I write to "Berksfile" with:
288
345
  """
289
- site :opscode
346
+ source "http://localhost:26210"
347
+
290
348
  cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', ref: '919afa0c4'
291
349
  """
292
350
  When I successfully run `berks install`
293
351
  Then the file "Berksfile.lock" should contain JSON:
294
352
  """
295
353
  {
296
- "sources":{
354
+ "dependencies":{
297
355
  "berkshelf-cookbook-fixture":{
298
356
  "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
299
357
  "ref":"919afa0c402089df23ebdf36637f12271b8a96b4",
@@ -306,14 +364,15 @@ Feature: Creating and reading the Berkshelf lockfile
306
364
  Scenario: Updating a Berksfile.lock when a git location with :rel
307
365
  Given I write to "Berksfile" with:
308
366
  """
309
- site :opscode
367
+ source "http://localhost:26210"
368
+
310
369
  cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
311
370
  """
312
371
  When I successfully run `berks install`
313
372
  Then the file "Berksfile.lock" should contain JSON:
314
373
  """
315
374
  {
316
- "sources":{
375
+ "dependencies":{
317
376
  "berkshelf-cookbook-fixture":{
318
377
  "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
319
378
  "ref":"93f5768b7d14df45e10d16c8bf6fe98ba3ff809a",
@@ -328,14 +387,15 @@ Feature: Creating and reading the Berkshelf lockfile
328
387
  Given a cookbook named "fake"
329
388
  And I write to "Berksfile" with:
330
389
  """
331
- site :opscode
390
+ source "http://localhost:26210"
391
+
332
392
  cookbook 'fake', path: './fake'
333
393
  """
334
394
  When I successfully run `berks install`
335
395
  Then the file "Berksfile.lock" should contain JSON:
336
396
  """
337
397
  {
338
- "sources":{
398
+ "dependencies":{
339
399
  "fake":{
340
400
  "path":"./fake"
341
401
  }
@@ -347,7 +407,8 @@ Feature: Creating and reading the Berkshelf lockfile
347
407
  Given a cookbook named "fake"
348
408
  And the cookbook "fake" has the file "Berksfile" with:
349
409
  """
350
- site :opscode
410
+ source "http://localhost:26210"
411
+
351
412
  metadata
352
413
  """
353
414
  When I cd to "fake"
@@ -355,7 +416,7 @@ Feature: Creating and reading the Berkshelf lockfile
355
416
  Then the file "Berksfile.lock" should contain JSON:
356
417
  """
357
418
  {
358
- "sources": {
419
+ "dependencies": {
359
420
  "fake": {
360
421
  "path": "."
361
422
  }
@@ -367,13 +428,14 @@ Feature: Creating and reading the Berkshelf lockfile
367
428
  Given a cookbook named "fake"
368
429
  And the cookbook "fake" has the file "Berksfile" with:
369
430
  """
370
- site :opscode
431
+ source "http://localhost:26210"
432
+
371
433
  metadata
372
434
  """
373
435
  And the cookbook "fake" has the file "Berksfile.lock" with:
374
436
  """
375
437
  {
376
- "sources": {
438
+ "dependencies": {
377
439
  "fake": {
378
440
  "path": "."
379
441
  }
@@ -385,46 +447,28 @@ Feature: Creating and reading the Berkshelf lockfile
385
447
  Then the file "Berksfile.lock" should contain JSON:
386
448
  """
387
449
  {
388
- "sources": {
450
+ "dependencies": {
389
451
  "fake": {
390
452
  "path": "."
391
453
  }
392
454
  }
393
455
  }
394
456
  """
395
- And the exit status should be 0
396
-
397
- Scenario: Updating a Berksfile.lock with a different site location
398
- Given pending we have a reliable non-opscode site to test
399
- # Given I write to "Berksfile" with:
400
- # """
401
- # cookbook 'fake', site: 'example.com'
402
- # """
403
- # When I successfully run `berks install`
404
- # Then the file "Berksfile.lock" should contain JSON:
405
- # """
406
- # {
407
- # "sources":{
408
- # "sudo":{
409
- # "site":"opscode",
410
- # "locked_version":"2.0.4"
411
- # }
412
- # }
413
- # }
414
- # """
415
457
 
416
458
  Scenario: Installing when the locked version is no longer satisfied
417
459
  Given the cookbook store has the cookbooks:
418
460
  | berkshelf-cookbook-fixture | 1.0.0 |
419
461
  Given I write to "Berksfile" with:
420
462
  """
421
- site :opscode
463
+ source "http://localhost:26210"
464
+
422
465
  cookbook 'berkshelf-cookbook-fixture', '1.0.0'
423
466
  """
424
467
  And I successfully run `berks install`
425
468
  And I write to "Berksfile" with:
426
469
  """
427
- site :opscode
470
+ source "http://localhost:26210"
471
+
428
472
  cookbook 'berkshelf-cookbook-fixture', '~> 1.3.0'
429
473
  """
430
474
  When I run `berks install`
@@ -437,16 +481,17 @@ Feature: Creating and reading the Berkshelf lockfile
437
481
  In Berksfile.lock:
438
482
  berkshelf-cookbook-fixture (1.0.0)
439
483
 
440
- Try running `berks update berkshelf-cookbook-fixture, which will try to find 'berkshelf-cookbook-fixture' matching '~> 1.3.0'
484
+ Try running `berks update berkshelf-cookbook-fixture, which will try to find 'berkshelf-cookbook-fixture' matching '~> 1.3.0'
441
485
  """
442
- And the CLI should exit with the status code for error "OutdatedCookbookSource"
486
+ And the exit status should be "OutdatedDependency"
443
487
 
444
488
  Scenario: Installing when the Lockfile is empty
445
489
  Given the cookbook store has the cookbooks:
446
490
  | fake | 1.0.0 |
447
491
  And I write to "Berksfile" with:
448
492
  """
449
- site :opscode
493
+ source "http://localhost:26210"
494
+
450
495
  cookbook 'fake', '1.0.0'
451
496
  """
452
497
  And an empty file named "Berksfile.lock"
@@ -455,12 +500,12 @@ Feature: Creating and reading the Berkshelf lockfile
455
500
  """
456
501
  Using fake (1.0.0)
457
502
  """
458
- And the exit status should be 0
459
503
 
460
504
  Scenario: Installing when the Lockfile is in a bad state
461
505
  Given I write to "Berksfile" with:
462
506
  """
463
- site :opscode
507
+ source "http://localhost:26210"
508
+
464
509
  cookbook 'fake', '1.0.0'
465
510
  """
466
511
  Given I write to "Berksfile.lock" with:
@@ -472,5 +517,4 @@ Feature: Creating and reading the Berkshelf lockfile
472
517
  """
473
518
  Error reading the Berkshelf lockfile `Berksfile.lock` (JSON::ParserError)
474
519
  """
475
- And the CLI should exit with the status code for error "LockfileParserError"
476
-
520
+ And the exit status should be "LockfileParserError"