berkshelf 3.0.0.beta2 → 3.0.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/CHANGELOG.md +8 -0
  4. data/Gemfile +0 -1
  5. data/Guardfile +0 -4
  6. data/README.md +1 -1
  7. data/Thorfile +2 -11
  8. data/berkshelf.gemspec +2 -5
  9. data/features/berksfile.feature +2 -10
  10. data/features/commands/apply.feature +31 -0
  11. data/features/{configure_command.feature → commands/configure.feature} +9 -11
  12. data/features/{contingent_command.feature → commands/contingent.feature} +10 -20
  13. data/features/{cookbook_command.feature → commands/cookbook.feature} +4 -11
  14. data/features/{init_command.feature → commands/init.feature} +10 -19
  15. data/features/{install_command.feature → commands/install.feature} +161 -82
  16. data/features/{list_command.feature → commands/list.feature} +4 -14
  17. data/features/{outdated_command.feature → commands/outdated.feature} +21 -63
  18. data/features/{package_command.feature → commands/package.feature} +11 -22
  19. data/features/{shelf → commands/shelf}/list.feature +3 -8
  20. data/features/{shelf → commands/shelf}/show.feature +5 -9
  21. data/features/{shelf → commands/shelf}/uninstall.feature +6 -10
  22. data/features/{show_command.feature → commands/show.feature} +13 -38
  23. data/features/commands/update.feature +48 -0
  24. data/features/commands/upload.feature +197 -0
  25. data/features/commands/vendor.feature +53 -0
  26. data/features/community_site.feature +39 -0
  27. data/features/config.feature +79 -9
  28. data/features/help.feature +10 -19
  29. data/features/json_formatter.feature +19 -44
  30. data/features/licenses.feature +27 -61
  31. data/features/lockfile.feature +120 -354
  32. data/features/resolver.feature +28 -0
  33. data/features/step_definitions/berksfile_steps.rb +39 -0
  34. data/features/step_definitions/chef/config_steps.rb +1 -1
  35. data/features/step_definitions/chef_server_steps.rb +27 -27
  36. data/features/step_definitions/config_steps.rb +3 -0
  37. data/features/step_definitions/filesystem_steps.rb +10 -0
  38. data/features/step_definitions/json_steps.rb +0 -7
  39. data/features/step_definitions/lockfile_steps.rb +53 -0
  40. data/features/step_definitions/utility_steps.rb +4 -4
  41. data/features/support/env.rb +1 -0
  42. data/generator_files/Berksfile.erb +1 -1
  43. data/generator_files/README.md.erb +62 -6
  44. data/generator_files/Vagrantfile.erb +15 -4
  45. data/lib/berkshelf.rb +2 -4
  46. data/lib/berkshelf/api_client.rb +5 -7
  47. data/lib/berkshelf/berksfile.rb +24 -20
  48. data/lib/berkshelf/cached_cookbook.rb +8 -1
  49. data/lib/berkshelf/cli.rb +5 -10
  50. data/lib/berkshelf/community_rest.rb +4 -5
  51. data/lib/berkshelf/config.rb +8 -2
  52. data/lib/berkshelf/cookbook_store.rb +9 -14
  53. data/lib/berkshelf/dependency.rb +16 -13
  54. data/lib/berkshelf/errors.rb +15 -1
  55. data/lib/berkshelf/formatters/json.rb +1 -1
  56. data/lib/berkshelf/init_generator.rb +17 -3
  57. data/lib/berkshelf/installer.rb +12 -1
  58. data/lib/berkshelf/logger.rb +7 -4
  59. data/lib/berkshelf/resolver.rb +1 -1
  60. data/lib/berkshelf/version.rb +1 -1
  61. data/spec/spec_helper.rb +0 -9
  62. data/spec/support/chef_server.rb +24 -7
  63. data/spec/unit/berkshelf/api_client/remote_cookbook_spec.rb +3 -3
  64. data/spec/unit/berkshelf/berksfile_spec.rb +35 -1
  65. data/spec/unit/berkshelf/cached_cookbook_spec.rb +8 -0
  66. data/spec/unit/berkshelf/community_rest_spec.rb +76 -25
  67. data/spec/unit/berkshelf/cookbook_generator_spec.rb +9 -3
  68. data/spec/unit/berkshelf/dependency_spec.rb +16 -1
  69. data/spec/unit/berkshelf/init_generator_spec.rb +71 -7
  70. metadata +44 -116
  71. data/.cane +0 -4
  72. data/features/apply_command.feature +0 -40
  73. data/features/groups_install.feature +0 -113
  74. data/features/update_command.feature +0 -136
  75. data/features/upload_command.feature +0 -327
  76. data/features/vendor_command.feature +0 -83
  77. data/lib/berkshelf/chef.rb +0 -7
  78. data/lib/berkshelf/chef/cookbook.rb +0 -5
  79. data/lib/berkshelf/chef/cookbook/chefignore.rb +0 -75
  80. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_download/unpacks_the_archive.json +0 -1
  81. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_find/raises_a_CommunitySiteError_error_on_any_non_200_or_404_response.json +0 -1
  82. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_find/raises_a_CookbookNotFound_error_on_a_404_response_for_a_non-existent_cookbook.json +0 -1
  83. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_find/raises_a_CookbookNotFound_error_on_a_404_response_for_a_non-existent_version.json +0 -1
  84. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_find/returns_the_cookbook_and_version_information.json +0 -1
  85. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_latest_version/raises_a_CommunitySiteError_error_on_any_non_200_or_404_response.json +0 -1
  86. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_latest_version/raises_a_CookbookNotFound_error_on_a_404_response.json +0 -1
  87. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_latest_version/returns_the_version_number_of_the_latest_version_of_the_cookbook.json +0 -1
  88. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_satisfy/returns_the_version_number_of_the_best_solution.json +0 -1
  89. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_versions/raises_a_CommunitySiteError_error_on_any_non_200_or_404_response.json +0 -1
  90. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_versions/raises_a_CookbookNotFound_error_on_a_404_response.json +0 -1
  91. data/spec/fixtures/cassettes/Berkshelf_CommunityREST/_versions/returns_an_array_containing_an_item_for_each_version.json +0 -1
  92. data/spec/fixtures/cassettes/Berkshelf_Resolver/_initialize/adds_the_dependencies_of_the_dependency_as_dependencies.yml +0 -3694
  93. data/spec/fixtures/cassettes/Berkshelf_Resolver/_initialize/adds_the_dependencies_of_the_source_as_sources.yml +0 -3829
  94. data/spec/unit/berkshelf/chef/cookbook/chefignore_spec.rb +0 -19
@@ -1,20 +1,11 @@
1
1
  Feature: Appending -h or --help to a command
2
- As a user
3
- I want to be able to run berkshelf like my existing Unix CLI tools
4
- So that I don't have remember thor's stupid argument ordering
5
-
6
- Scenario: Specifying the --help option
7
- Given I successfully run `berks --help`
8
- Then the output should be the same as `berks help`
9
-
10
- Scenario: Specifying the -h option
11
- Given I successfully run `berks -h`
12
- Then the output should be the same as `berks help`
13
-
14
- Scenario: Specifying the --help option to a sub-command
15
- Given I successfully run `berks cookbook --help`
16
- Then the output should be the same as `berks help cookbook`
17
-
18
- Scenario: Specifying the -h option to a sub-command
19
- Given I successfully run `berks cookbook -h`
20
- Then the output should be the same as `berks help cookbook`
2
+ Scenario Outline: Using various help switches
3
+ Then the output from `<actual>` should be the same as `<expected>`
4
+ Examples:
5
+ | actual | expected |
6
+ | berks --help | berks help |
7
+ | berks -h | berks help |
8
+ | berks cookbook --help | berks help cookbook |
9
+ | berks cookbook -h | berks help cookbook |
10
+ | berks shelf --help | berks shelf help |
11
+ | berks shelf -h | berks shelf help |
@@ -1,18 +1,13 @@
1
1
  Feature: --format json
2
- As a user
3
- I want to be able to get all output in JSON format
4
- So I can easily parse the output in scripts
5
-
6
2
  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
3
+ * the Berkshelf API server's cache is empty
4
+ * the Chef Server is empty
5
+ * the cookbook store is empty
6
+
10
7
 
11
8
  Scenario: JSON output installing a cookbook from the default location
12
- Given I write to "Berksfile" with:
9
+ Given I have a Berksfile pointing at the local Berkshelf API with:
13
10
  """
14
- source "http://localhost:26210"
15
-
16
11
  cookbook 'berkshelf', '1.0.0'
17
12
  """
18
13
  And the Chef Server has cookbooks:
@@ -37,13 +32,12 @@ Feature: --format json
37
32
  }
38
33
  """
39
34
 
35
+
40
36
  Scenario: JSON output installing a cookbook we already have
41
37
  Given the cookbook store has the cookbooks:
42
38
  | berkshelf-cookbook-fixture | 1.0.0 |
43
- And I write to "Berksfile" with:
39
+ And I have a Berksfile pointing at the local Berkshelf API with:
44
40
  """
45
- source "http://localhost:26210"
46
-
47
41
  cookbook 'berkshelf-cookbook-fixture', '1.0.0'
48
42
  """
49
43
  When I successfully run `berks install --format json`
@@ -65,25 +59,16 @@ Feature: --format json
65
59
  }
66
60
  """
67
61
 
62
+
68
63
  Scenario: JSON output when running the show command
69
64
  Given the cookbook store has the cookbooks:
70
65
  | fake | 1.0.0 |
71
- And I write to "Berksfile" with:
66
+ And I have a Berksfile pointing at the local Berkshelf API with:
72
67
  """
73
- source "http://localhost:26210"
74
-
75
68
  cookbook 'fake', '1.0.0'
76
69
  """
77
- And I write to "Berksfile.lock" with:
78
- """
79
- {
80
- "dependencies": {
81
- "fake": {
82
- "locked_version": "1.0.0"
83
- }
84
- }
85
- }
86
- """
70
+ And the Lockfile has:
71
+ | fake | 1.0.0 |
87
72
  When I successfully run `berks show fake --format json`
88
73
  Then the output should contain JSON:
89
74
  """
@@ -106,11 +91,10 @@ Feature: --format json
106
91
  }
107
92
  """
108
93
 
94
+
109
95
  Scenario: JSON output when running the upload command
110
- Given I write to "Berksfile" with:
96
+ Given I have a Berksfile pointing at the local Berkshelf API with:
111
97
  """
112
- source "http://localhost:26210"
113
-
114
98
  cookbook 'example_cookbook', path: '../../fixtures/cookbooks/example_cookbook-0.5.0'
115
99
  """
116
100
  When I successfully run `berks upload --format json`
@@ -134,6 +118,7 @@ Feature: --format json
134
118
  }
135
119
  """
136
120
 
121
+
137
122
  Scenario: JSON output when running the outdated command
138
123
  Given the cookbook store has the cookbooks:
139
124
  | seth | 0.1.0 |
@@ -142,31 +127,21 @@ Feature: --format json
142
127
  | seth | 0.2.9 |
143
128
  | seth | 1.0.0 |
144
129
  And the Berkshelf API server's cache is up to date
145
- And I write to "Berksfile" with:
130
+ And I have a Berksfile pointing at the local Berkshelf API with:
146
131
  """
147
- source "http://localhost:26210"
148
-
149
132
  cookbook 'seth', '~> 0.1'
150
133
  """
151
- And I write to "Berksfile.lock" with:
152
- """
153
- {
154
- "dependencies": {
155
- "seth": {
156
- "locked_version": "0.1.0"
157
- }
158
- }
159
- }
160
- """
134
+ And the Lockfile has:
135
+ | seth | 0.1.0 |
161
136
  And I successfully run `berks outdated --format json`
162
- Then the output should contain:
137
+ Then the output should contain JSON:
163
138
  """
164
139
  {
165
140
  "cookbooks": [
166
141
  {
167
142
  "version": "0.2.9",
168
143
  "sources": {
169
- "http://localhost:26210": {
144
+ "http://0.0.0.0:26210": {
170
145
  "name": "seth",
171
146
  "version": "0.2.9"
172
147
  }
@@ -1,27 +1,20 @@
1
1
  Feature: Installing cookbooks with specific licenses
2
- As a user
3
- I want to ensure my company only uses cookbooks that fall in our legal realm
4
- So that I can safely install and legally use community cookbooks
5
-
6
2
  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
-
11
- Scenario: With licenses defined
12
- Given the cookbook store has the cookbooks:
13
- | berkshelf-cookbook-fixture | 0.1.0 | mit |
14
- And I write to "Berksfile" with:
3
+ * the Berkshelf API server's cache is empty
4
+ * the Chef Server is empty
5
+ * the cookbook store is empty
6
+ * I have a Berksfile pointing at the local Berkshelf API with:
15
7
  """
16
- source "http://localhost:26210"
17
-
18
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
8
+ cookbook 'fake', '1.0.0'
19
9
  """
10
+
11
+
12
+ Scenario: when licenses is defined
13
+ Given the cookbook store has the cookbooks:
14
+ | fake | 1.0.0 | mit |
20
15
  And I have a Berkshelf config file containing:
21
16
  """
22
- {
23
- "allowed_licenses": ["mit"]
24
- }
17
+ { "allowed_licenses": ["mit"] }
25
18
  """
26
19
  When I successfully run `berks install`
27
20
  Then the output should not contain:
@@ -29,20 +22,13 @@ Feature: Installing cookbooks with specific licenses
29
22
  is not in your list of allowed licenses
30
23
  """
31
24
 
32
- Scenario: With a license that is not listed
33
- Given the cookbook store has the cookbooks:
34
- | berkshelf-cookbook-fixture | 0.1.0 | mit |
35
- And I write to "Berksfile" with:
36
- """
37
- source "http://localhost:26210"
38
25
 
39
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
40
- """
26
+ Scenario: when a license is not listed
27
+ Given the cookbook store has the cookbooks:
28
+ | fake | 1.0.0 | mit |
41
29
  And I have a Berkshelf config file containing:
42
30
  """
43
- {
44
- "allowed_licenses": ["apache2"]
45
- }
31
+ { "allowed_licenses": ["apache2"] }
46
32
  """
47
33
  When I successfully run `berks install`
48
34
  Then the output should contain:
@@ -50,21 +36,13 @@ Feature: Installing cookbooks with specific licenses
50
36
  'mit' is not in your list of allowed licenses
51
37
  """
52
38
 
53
- Scenario: With raise_license_exception defined
54
- Given the cookbook store has the cookbooks:
55
- | berkshelf-cookbook-fixture | 0.1.0 | mit |
56
- And I write to "Berksfile" with:
57
- """
58
- source "http://localhost:26210"
59
39
 
60
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
61
- """
40
+ Scenario: when raise_license_exception is defined
41
+ Given the cookbook store has the cookbooks:
42
+ | fake | 1.0.0 | mit |
62
43
  And I have a Berkshelf config file containing:
63
44
  """
64
- {
65
- "allowed_licenses": ["mit"],
66
- "raise_license_exception": true
67
- }
45
+ { "allowed_licenses": ["mit"], "raise_license_exception": true }
68
46
  """
69
47
  When I successfully run `berks install`
70
48
  Then the output should not contain:
@@ -72,21 +50,13 @@ Feature: Installing cookbooks with specific licenses
72
50
  is not in your list of allowed licenses
73
51
  """
74
52
 
75
- Scenario: With a license that is not listed
76
- Given the cookbook store has the cookbooks:
77
- | berkshelf-cookbook-fixture | 0.1.0 | mit |
78
- And I write to "Berksfile" with:
79
- """
80
- source "http://localhost:26210"
81
53
 
82
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
83
- """
54
+ Scenario: when raise_license_exception is defined and a license is not listed
55
+ Given the cookbook store has the cookbooks:
56
+ | fake | 1.0.0 | mit |
84
57
  And I have a Berkshelf config file containing:
85
58
  """
86
- {
87
- "allowed_licenses": ["apache2"],
88
- "raise_license_exception": true
89
- }
59
+ { "allowed_licenses": ["apache2"], "raise_license_exception": true }
90
60
  """
91
61
  When I run `berks install`
92
62
  Then the output should contain:
@@ -95,21 +65,17 @@ Feature: Installing cookbooks with specific licenses
95
65
  """
96
66
  And the exit status should be "LicenseNotAllowed"
97
67
 
98
- Scenario: With a :path location
68
+
69
+ Scenario: when the cookbook is a path location
99
70
  Given the cookbook store has the cookbooks:
100
71
  | fake | 0.1.0 | mit |
101
- And I write to "Berksfile" with:
72
+ And I have a Berksfile pointing at the local Berkshelf API with:
102
73
  """
103
- source "http://localhost:26210"
104
-
105
74
  cookbook 'fake', path: '../../tmp/berkshelf/cookbooks/fake-0.1.0'
106
75
  """
107
76
  And I have a Berkshelf config file containing:
108
77
  """
109
- {
110
- "allowed_licenses": ["apache2"],
111
- "raise_license_exception": true
112
- }
78
+ { "allowed_licenses": ["apache2"], "raise_license_exception": true }
113
79
  """
114
80
  When I successfully run `berks install`
115
81
  Then the output should not contain:
@@ -1,36 +1,29 @@
1
1
  Feature: Creating and reading the Berkshelf lockfile
2
- As a user
3
- I want my versions to be locked even when I don't specify versions in my Berksfile
4
- So when I share my repository, all other developers get the same versions that I did when I installed.
2
+ Background:
3
+ * the cookbook store has the cookbooks:
4
+ | fake | 0.1.0 |
5
+ | fake | 0.2.0 |
6
+ | fake | 1.0.0 |
7
+ * the cookbook store has the git cookbooks:
8
+ | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
9
+ | berkshelf-cookbook-fixture | 1.0.0 | 919afa0c402089df23ebdf36637f12271b8a96b4 |
10
+ | berkshelf-cookbook-fixture | 1.0.0 | a97b9447cbd41a5fe58eee2026e48ccb503bd3bc |
11
+ | berkshelf-cookbook-fixture | 1.0.0 | 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a |
12
+
5
13
 
6
14
  Scenario: Writing the Berksfile.lock
7
- Given the cookbook store has the cookbooks:
8
- | fake | 1.0.0 |
9
- And I write to "Berksfile" with:
15
+ Given I have a Berksfile pointing at the local Berkshelf API with:
10
16
  """
11
- source "http://localhost:26210"
12
-
13
17
  cookbook 'fake', '1.0.0'
14
18
  """
15
19
  When I successfully run `berks install`
16
- Then the file "Berksfile.lock" should contain JSON:
17
- """
18
- {
19
- "dependencies":{
20
- "fake":{
21
- "locked_version":"1.0.0"
22
- }
23
- }
24
- }
25
- """
26
-
27
- Scenario: Wiring the Berksfile.lock when a 1.0 lockfile is present
28
- Given the cookbook store has the cookbooks:
20
+ Then the Lockfile should have:
29
21
  | fake | 1.0.0 |
30
- And I write to "Berksfile" with:
31
- """
32
- source "http://localhost:26210"
33
22
 
23
+
24
+ Scenario: Writing the Berksfile.lock when a 1.0 lockfile is present
25
+ Given I have a Berksfile pointing at the local Berkshelf API with:
26
+ """
34
27
  cookbook 'fake', '1.0.0'
35
28
  """
36
29
  And I write to "Berksfile.lock" with:
@@ -39,54 +32,14 @@ Feature: Creating and reading the Berkshelf lockfile
39
32
  """
40
33
  When I successfully run `berks install`
41
34
  Then the output should warn about the old lockfile format
42
- Then the file "Berksfile.lock" should contain JSON:
43
- """
44
- {
45
- "dependencies": {
46
- "fake": {
47
- "locked_version": "1.0.0"
48
- }
49
- }
50
- }
51
- """
52
-
53
- Scenario: Wiring the Berksfile.lock when a 2.0 lockfile is present
54
- Given the cookbook store has the cookbooks:
35
+ And the Lockfile should have:
55
36
  | fake | 1.0.0 |
56
- And I write to "Berksfile" with:
57
- """
58
- source "http://localhost:26210"
59
37
 
60
- cookbook 'fake', '1.0.0'
61
- """
62
- And I write to "Berksfile.lock" with:
63
- """
64
- {
65
- "dependencies": {
66
- "fake": {
67
- "locked_version": "1.0.0"
68
- }
69
- }
70
- }
71
- """
72
- When I successfully run `berks install`
73
- Then the file "Berksfile.lock" should contain JSON:
74
- """
75
- {
76
- "dependencies": {
77
- "fake": {
78
- "locked_version": "1.0.0"
79
- }
80
- }
81
- }
82
- """
83
38
 
84
- Scenario: Writing the Berksfile.lock when an old lockfile is present and contains a full path
39
+ Scenario: Writing the Berksfile.lock when a 1.0 lockfile is present and contains a full path
85
40
  Given a cookbook named "fake"
86
- And I write to "Berksfile" with:
41
+ And I have a Berksfile pointing at the local Berkshelf API with:
87
42
  """
88
- source "http://localhost:26210"
89
-
90
43
  cookbook 'fake', '0.0.0', path: './fake'
91
44
  """
92
45
  And I write to "Berksfile.lock" with:
@@ -95,391 +48,205 @@ Feature: Creating and reading the Berkshelf lockfile
95
48
  """
96
49
  When I successfully run `berks install`
97
50
  Then the output should warn about the old lockfile format
98
- Then the file "Berksfile.lock" should contain JSON:
99
- """
100
- {
101
- "dependencies":{
102
- "fake":{
103
- "path":"./fake"
104
- }
105
- }
106
- }
107
- """
51
+ Then the Lockfile should have:
52
+ | fake | ./fake |
108
53
 
109
- Scenario: Reading the Berksfile.lock when it contains an invalid path location
110
- Given the cookbook store has the cookbooks:
111
- | fake | 1.0.0 |
112
- And I write to "Berksfile" with:
113
- """
114
- source "http://localhost:26210"
115
54
 
116
- cookbook 'fake'
55
+ Scenario: Writing the Berksfile.lock when a 2.0 lockfile is present
56
+ Given I have a Berksfile pointing at the local Berkshelf API with:
57
+ """
58
+ cookbook 'fake', '1.0.0'
117
59
  """
118
60
  And I write to "Berksfile.lock" with:
119
61
  """
120
62
  {
121
- "dependencies":{
122
- "non-existent":{
123
- "path":"/this/path/does/not/exist"
63
+ "sources": {
64
+ "fake": {
65
+ "locked_version": "1.0.0"
124
66
  }
125
67
  }
126
68
  }
127
69
  """
128
70
  When I successfully run `berks install`
129
- Then the file "Berksfile.lock" should contain JSON:
71
+ Then the Lockfile should have:
72
+ | fake | 1.0.0 |
73
+
74
+
75
+ Scenario: Reading the Berksfile.lock when it contains an invalid path location
76
+ Given I have a Berksfile pointing at the local Berkshelf API with:
130
77
  """
131
- {
132
- "dependencies":{
133
- "fake":{
134
- "locked_version":"1.0.0"
135
- }
136
- }
137
- }
78
+ cookbook 'fake'
138
79
  """
80
+ And the Lockfile has:
81
+ | non-existent | /this/path/does/not/exist |
82
+ When I successfully run `berks install`
83
+ Then the Lockfile should have:
84
+ | fake | 1.0.0 |
85
+
139
86
 
140
87
  Scenario: Installing a cookbook with dependencies
141
88
  Given the cookbook store has the cookbooks:
142
89
  | dep | 1.0.0 |
143
90
  And the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
144
91
  | dep | ~> 1.0.0 |
145
- And I write to "Berksfile" with:
92
+ And I have a Berksfile pointing at the local Berkshelf API with:
146
93
  """
147
- source "http://localhost:26210"
148
-
149
94
  cookbook 'fake', '1.0.0'
150
95
  """
151
96
  When I successfully run `berks install`
152
- Then the file "Berksfile.lock" should contain JSON:
153
- """
154
- {
155
- "dependencies": {
156
- "fake":{
157
- "locked_version": "1.0.0"
158
- },
159
- "dep":{
160
- "locked_version": "1.0.0"
161
- }
162
- }
163
- }
164
- """
97
+ Then the Lockfile should have:
98
+ | fake | 1.0.0 |
99
+ | dep | 1.0.0 |
165
100
 
166
- Scenario: Writing the Berksfile.lock with a pessimistic lock
167
- Given the cookbook store has the cookbooks:
168
- | berkshelf-cookbook-fixture | 1.0.0 |
169
- And I write to "Berksfile" with:
170
- """
171
- source "http://localhost:26210"
172
101
 
173
- cookbook 'berkshelf-cookbook-fixture', '~> 1.0.0'
174
- """
175
- And I write to "Berksfile.lock" with:
102
+ Scenario: Writing the Berksfile.lock with a pessimistic lock
103
+ And I have a Berksfile pointing at the local Berkshelf API with:
176
104
  """
177
- {
178
- "dependencies":{
179
- "berkshelf-cookbook-fixture":{
180
- "locked_version":"1.0.0"
181
- }
182
- }
183
- }
105
+ cookbook 'fake', '~> 1.0.0'
184
106
  """
107
+ And the Lockfile has:
108
+ | fake | 1.0.0 |
185
109
  When I successfully run `berks install`
186
- Then the file "Berksfile.lock" should contain JSON:
187
- """
188
- {
189
- "dependencies":{
190
- "berkshelf-cookbook-fixture":{
191
- "locked_version":"1.0.0"
192
- }
193
- }
194
- }
195
- """
110
+ Then the Lockfile should have:
111
+ | fake | 1.0.0 |
196
112
 
197
- Scenario: Updating with a Berksfile.lock with pessimistic lock
198
- Given the cookbook store has the cookbooks:
199
- | berkshelf-cookbook-fixture | 0.2.0 |
200
- | berkshelf-cookbook-fixture | 1.0.0 |
201
- And I write to "Berksfile" with:
202
- """
203
- source "http://localhost:26210"
204
113
 
205
- cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
206
- """
207
- And I write to "Berksfile.lock" with:
208
- """
209
- {
210
- "dependencies":{
211
- "berkshelf-cookbook-fixture":{
212
- "locked_version":"0.1.0"
213
- }
214
- }
215
- }
216
- """
217
- When I successfully run `berks update berkshelf-cookbook-fixture`
218
- Then the file "Berksfile.lock" should contain JSON:
114
+ Scenario: Updating with a Berksfile.lock with pessimistic lock
115
+ Given I have a Berksfile pointing at the local Berkshelf API with:
219
116
  """
220
- {
221
- "dependencies":{
222
- "berkshelf-cookbook-fixture":{
223
- "locked_version":"0.2.0"
224
- }
225
- }
226
- }
117
+ cookbook 'fake', '~> 0.1'
227
118
  """
119
+ And the Lockfile has:
120
+ | fake | 0.1.0 |
121
+ When I successfully run `berks update fake`
122
+ Then the Lockfile should have:
123
+ | fake | 0.2.0 |
228
124
 
229
- Scenario: Updating with a Berksfile.lock with hard lock
230
- Given the cookbook store has the cookbooks:
231
- | berkshelf-cookbook-fixture | 1.0.0 |
232
- And I write to "Berksfile" with:
233
- """
234
- source "http://localhost:26210"
235
125
 
236
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
237
- """
238
- And I write to "Berksfile.lock" with:
239
- """
240
- {
241
- "dependencies":{
242
- "berkshelf-cookbook-fixture":{
243
- "locked_version":"1.0.0"
244
- }
245
- }
246
- }
126
+ Scenario: Updating with a Berksfile.lock with hard lock
127
+ And I have a Berksfile pointing at the local Berkshelf API with:
247
128
  """
248
- When I successfully run `berks update berkshelf-cookbook-fixture`
249
- Then the file "Berksfile.lock" should contain JSON:
250
- """
251
- {
252
- "dependencies":{
253
- "berkshelf-cookbook-fixture":{
254
- "locked_version":"1.0.0"
255
- }
256
- }
257
- }
129
+ cookbook 'fake', '0.1.0'
258
130
  """
131
+ And the Lockfile has:
132
+ | fake | 0.1.0 |
133
+ When I successfully run `berks update fake`
134
+ Then the Lockfile should have:
135
+ | fake | 0.1.0 |
136
+
259
137
 
260
138
  Scenario: Updating a Berksfile.lock with a git location
261
- Given the cookbook store has the cookbooks:
262
- | berkshelf-cookbook-fixture | 1.0.0 |
263
- And I write to "Berksfile" with:
139
+ Given I have a Berksfile pointing at the local Berkshelf API with:
264
140
  """
265
- source "http://localhost:26210"
266
-
267
141
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', ref: '919afa0c4'
268
142
  """
269
143
  When I successfully run `berks install`
270
- Then the file "Berksfile.lock" should contain JSON:
271
- """
272
- {
273
- "dependencies":{
274
- "berkshelf-cookbook-fixture":{
275
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
276
- "ref":"919afa0c402089df23ebdf36637f12271b8a96b4",
277
- "locked_version":"1.0.0"
278
- }
279
- }
280
- }
281
- """
144
+ Then the Lockfile should have:
145
+ | berkshelf-cookbook-fixture | 1.0.0 | 919afa0c402089df23ebdf36637f12271b8a96b4 |
146
+
282
147
 
283
148
  Scenario: Updating a Berksfile.lock with a git location and a branch
284
- Given the cookbook store has the cookbooks:
285
- | berkshelf-cookbook-fixture | 1.0.0 |
286
- And I write to "Berksfile" with:
149
+ Given I have a Berksfile pointing at the local Berkshelf API with:
287
150
  """
288
- source "http://localhost:26210"
289
-
290
151
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', branch: 'master'
291
152
  """
292
153
  When I successfully run `berks install`
293
- Then the file "Berksfile.lock" should contain JSON:
294
- """
295
- {
296
- "dependencies":{
297
- "berkshelf-cookbook-fixture":{
298
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
299
- "ref":"a97b9447cbd41a5fe58eee2026e48ccb503bd3bc",
300
- "locked_version":"1.0.0"
301
- }
302
- }
303
- }
304
- """
154
+ Then the Lockfile should have:
155
+ | berkshelf-cookbook-fixture | 1.0.0 | a97b9447cbd41a5fe58eee2026e48ccb503bd3bc |
156
+
305
157
 
306
158
  Scenario: Updating a Berksfile.lock with a git location and a branch
307
- Given the cookbook store has the cookbooks:
308
- | berkshelf-cookbook-fixture | 70a527e17d91f01f031204562460ad1c17f972ee |
309
- And I write to "Berksfile" with:
159
+ Given I have a Berksfile pointing at the local Berkshelf API with:
310
160
  """
311
- source "http://localhost:26210"
312
-
313
161
  cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git', tag: 'v0.2.0'
314
162
  """
315
163
  When I successfully run `berks install`
316
- Then the file "Berksfile.lock" should contain JSON:
317
- """
318
- {
319
- "dependencies":{
320
- "berkshelf-cookbook-fixture":{
321
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
322
- "ref":"70a527e17d91f01f031204562460ad1c17f972ee",
323
- "locked_version":"0.2.0"
324
- }
325
- }
326
- }
327
- """
164
+ Then the Lockfile should have:
165
+ | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
166
+
328
167
 
329
168
  Scenario: Updating a Berksfile.lock with a GitHub location
330
- Given the cookbook store has the cookbooks:
331
- | berkshelf-cookbook-fixture | 919afa0c402089df23ebdf36637f12271b8a96b4 |
332
- And I write to "Berksfile" with:
169
+ Given I have a Berksfile pointing at the local Berkshelf API with:
333
170
  """
334
- source "http://localhost:26210"
335
-
336
171
  cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', ref: '919afa0c4'
337
172
  """
338
173
  When I successfully run `berks install`
339
- Then the file "Berksfile.lock" should contain JSON:
340
- """
341
- {
342
- "dependencies":{
343
- "berkshelf-cookbook-fixture":{
344
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
345
- "ref":"919afa0c402089df23ebdf36637f12271b8a96b4",
346
- "locked_version":"1.0.0"
347
- }
348
- }
349
- }
350
- """
174
+ Then the Lockfile should have:
175
+ | berkshelf-cookbook-fixture | 1.0.0 | 919afa0c402089df23ebdf36637f12271b8a96b4 |
176
+
351
177
 
352
178
  Scenario: Updating a Berksfile.lock when a git location with :rel
353
- Given I write to "Berksfile" with:
179
+ Given I have a Berksfile pointing at the local Berkshelf API with:
354
180
  """
355
- source "http://localhost:26210"
356
-
357
181
  cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
358
182
  """
359
183
  When I successfully run `berks install`
360
- Then the file "Berksfile.lock" should contain JSON:
361
- """
362
- {
363
- "dependencies":{
364
- "berkshelf-cookbook-fixture":{
365
- "git":"git://github.com/RiotGames/berkshelf-cookbook-fixture.git",
366
- "ref":"93f5768b7d14df45e10d16c8bf6fe98ba3ff809a",
367
- "rel":"cookbooks/berkshelf-cookbook-fixture",
368
- "locked_version":"1.0.0"
369
- }
370
- }
371
- }
372
- """
184
+ Then the Lockfile should have:
185
+ | berkshelf-cookbook-fixture | 1.0.0 | 93f5768b7d14df45e10d16c8bf6fe98ba3ff809a | cookbooks/berkshelf-cookbook-fixture |
186
+
373
187
 
374
188
  Scenario: Updating a Berksfile.lock with a path location
375
189
  Given a cookbook named "fake"
376
- And I write to "Berksfile" with:
190
+ And I have a Berksfile pointing at the local Berkshelf API with:
377
191
  """
378
- source "http://localhost:26210"
379
-
380
192
  cookbook 'fake', path: './fake'
381
193
  """
382
194
  When I successfully run `berks install`
383
- Then the file "Berksfile.lock" should contain JSON:
384
- """
385
- {
386
- "dependencies":{
387
- "fake":{
388
- "path":"./fake"
389
- }
390
- }
391
- }
392
- """
195
+ Then the Lockfile should have:
196
+ | fake | ./fake |
197
+
393
198
 
394
199
  Scenario: Installing a Berksfile with a metadata location
395
200
  Given a cookbook named "fake"
396
- And the cookbook "fake" has the file "Berksfile" with:
201
+ And I cd to "fake"
202
+ And I have a Berksfile pointing at the local Berkshelf API with:
397
203
  """
398
- source "http://localhost:26210"
399
-
400
204
  metadata
401
205
  """
402
- When I cd to "fake"
403
- And I successfully run `berks install`
404
- Then the file "Berksfile.lock" should contain JSON:
405
- """
406
- {
407
- "dependencies": {
408
- "fake": {
409
- "path": "."
410
- }
411
- }
412
- }
413
- """
206
+ When I successfully run `berks install`
207
+ Then the Lockfile should have:
208
+ | fake | . |
209
+
414
210
 
415
211
  Scenario: Installing a Berksfile with a metadata location
416
212
  Given a cookbook named "fake"
417
- And the cookbook "fake" has the file "Berksfile" with:
213
+ And I cd to "fake"
214
+ And I have a Berksfile pointing at the local Berkshelf API with:
418
215
  """
419
- source "http://localhost:26210"
420
-
421
216
  metadata
422
217
  """
423
- And the cookbook "fake" has the file "Berksfile.lock" with:
424
- """
425
- {
426
- "dependencies": {
427
- "fake": {
428
- "path": "."
429
- }
430
- }
431
- }
432
- """
433
- When I cd to "fake"
434
- And I successfully run `berks install`
435
- Then the file "Berksfile.lock" should contain JSON:
436
- """
437
- {
438
- "dependencies": {
439
- "fake": {
440
- "path": "."
441
- }
442
- }
443
- }
444
- """
218
+ And the Lockfile has:
219
+ | fake | . |
220
+ When I successfully run `berks install`
221
+ Then the Lockfile should have:
222
+ | fake | . |
445
223
 
446
- Scenario: Installing when the locked version is no longer satisfied
447
- Given the cookbook store has the cookbooks:
448
- | berkshelf-cookbook-fixture | 1.0.0 |
449
- Given I write to "Berksfile" with:
450
- """
451
- source "http://localhost:26210"
452
224
 
453
- cookbook 'berkshelf-cookbook-fixture', '1.0.0'
454
- """
455
- And I successfully run `berks install`
456
- And I write to "Berksfile" with:
225
+ Scenario: Installing when the locked version is no longer satisfied
226
+ Given I have a Berksfile pointing at the local Berkshelf API with:
457
227
  """
458
- source "http://localhost:26210"
459
-
460
- cookbook 'berkshelf-cookbook-fixture', '~> 1.3.0'
228
+ cookbook 'fake', '~> 1.3.0'
461
229
  """
230
+ And the Lockfile has:
231
+ | fake | 1.0.0 |
462
232
  When I run `berks install`
463
233
  Then the output should contain:
464
234
  """
465
- Berkshelf could not find compatible versions for cookbook 'berkshelf-cookbook-fixture':
235
+ Berkshelf could not find compatible versions for cookbook 'fake':
466
236
  In Berksfile:
467
- berkshelf-cookbook-fixture (~> 1.3.0)
237
+ fake (~> 1.3.0)
468
238
 
469
239
  In Berksfile.lock:
470
- berkshelf-cookbook-fixture (1.0.0)
240
+ fake (1.0.0)
471
241
 
472
- Try running `berks update berkshelf-cookbook-fixture, which will try to find 'berkshelf-cookbook-fixture' matching '~> 1.3.0'
242
+ Try running `berks update fake`, which will try to find 'fake' matching '~> 1.3.0'
473
243
  """
474
244
  And the exit status should be "OutdatedDependency"
475
245
 
246
+
476
247
  Scenario: Installing when the Lockfile is empty
477
- Given the cookbook store has the cookbooks:
478
- | fake | 1.0.0 |
479
- And I write to "Berksfile" with:
248
+ Given I have a Berksfile pointing at the local Berkshelf API with:
480
249
  """
481
- source "http://localhost:26210"
482
-
483
250
  cookbook 'fake', '1.0.0'
484
251
  """
485
252
  And an empty file named "Berksfile.lock"
@@ -489,11 +256,10 @@ Feature: Creating and reading the Berkshelf lockfile
489
256
  Using fake (1.0.0)
490
257
  """
491
258
 
259
+
492
260
  Scenario: Installing when the Lockfile is in a bad state
493
- Given I write to "Berksfile" with:
261
+ Given I have a Berksfile pointing at the local Berkshelf API with:
494
262
  """
495
- source "http://localhost:26210"
496
-
497
263
  cookbook 'fake', '1.0.0'
498
264
  """
499
265
  Given I write to "Berksfile.lock" with: