berkshelf 2.0.0.beta → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/CHANGELOG.md +19 -1
  2. data/CONTRIBUTING.md +1 -3
  3. data/Gemfile +0 -20
  4. data/Guardfile +3 -3
  5. data/LICENSE +6 -5
  6. data/README.md +1 -0
  7. data/Thorfile +48 -67
  8. data/berkshelf.gemspec +48 -37
  9. data/features/apply_command.feature +17 -11
  10. data/features/config.feature +11 -11
  11. data/features/configure_command.feature +8 -8
  12. data/features/contingent_command.feature +37 -8
  13. data/features/cookbook_command.feature +17 -14
  14. data/features/groups_install.feature +24 -20
  15. data/features/install_command.feature +24 -33
  16. data/features/licenses.feature +112 -0
  17. data/features/list_command.feature +17 -5
  18. data/features/lockfile.feature +307 -188
  19. data/features/outdated_command.feature +1 -4
  20. data/features/package_command.feature +41 -19
  21. data/features/shelf/list.feature +39 -0
  22. data/features/shelf/show.feature +152 -0
  23. data/features/shelf/uninstall.feature +103 -0
  24. data/features/show_command.feature +49 -17
  25. data/features/step_definitions/filesystem_steps.rb +12 -3
  26. data/features/step_definitions/utility_steps.rb +0 -1
  27. data/features/support/env.rb +11 -4
  28. data/features/update_command.feature +22 -10
  29. data/features/upload_command.feature +174 -127
  30. data/features/vendor_install.feature +6 -6
  31. data/generator_files/Berksfile.erb +1 -1
  32. data/generator_files/metadata.rb.erb +7 -7
  33. data/lib/berkshelf.rb +39 -27
  34. data/lib/berkshelf/base_generator.rb +2 -3
  35. data/lib/berkshelf/berksfile.rb +69 -17
  36. data/lib/berkshelf/cached_cookbook.rb +17 -1
  37. data/lib/berkshelf/chef.rb +2 -4
  38. data/lib/berkshelf/chef/config.rb +51 -75
  39. data/lib/berkshelf/chef/cookbook.rb +1 -2
  40. data/lib/berkshelf/chef/cookbook/chefignore.rb +1 -1
  41. data/lib/berkshelf/cli.rb +144 -194
  42. data/lib/berkshelf/command.rb +11 -12
  43. data/lib/berkshelf/commands/shelf.rb +130 -0
  44. data/lib/berkshelf/commands/test_command.rb +11 -0
  45. data/lib/berkshelf/community_rest.rb +1 -2
  46. data/lib/berkshelf/config.rb +14 -10
  47. data/lib/berkshelf/cookbook_generator.rb +30 -24
  48. data/lib/berkshelf/cookbook_source.rb +1 -1
  49. data/lib/berkshelf/cookbook_store.rb +0 -1
  50. data/lib/berkshelf/core_ext.rb +1 -1
  51. data/lib/berkshelf/core_ext/file.rb +1 -1
  52. data/lib/berkshelf/downloader.rb +3 -1
  53. data/lib/berkshelf/errors.rb +128 -53
  54. data/lib/berkshelf/formatters.rb +2 -6
  55. data/lib/berkshelf/formatters/human_readable.rb +8 -2
  56. data/lib/berkshelf/formatters/json.rb +7 -1
  57. data/lib/berkshelf/formatters/null.rb +0 -1
  58. data/lib/berkshelf/git.rb +16 -16
  59. data/lib/berkshelf/init_generator.rb +28 -26
  60. data/lib/berkshelf/location.rb +12 -11
  61. data/lib/berkshelf/locations/chef_api_location.rb +2 -2
  62. data/lib/berkshelf/locations/git_location.rb +0 -1
  63. data/lib/berkshelf/locations/github_location.rb +0 -1
  64. data/lib/berkshelf/locations/path_location.rb +1 -2
  65. data/lib/berkshelf/locations/site_location.rb +3 -2
  66. data/lib/berkshelf/lockfile.rb +29 -10
  67. data/lib/berkshelf/mixin/config.rb +155 -0
  68. data/lib/berkshelf/mixin/logging.rb +0 -1
  69. data/lib/berkshelf/mixin/shellout.rb +71 -0
  70. data/lib/berkshelf/resolver.rb +7 -4
  71. data/lib/berkshelf/test.rb +1 -3
  72. data/lib/berkshelf/ui.rb +8 -4
  73. data/lib/berkshelf/version.rb +1 -1
  74. data/lib/thor/monkies/shell.rb +0 -1
  75. data/spec/config/berkshelf.pem +27 -0
  76. data/spec/config/knife.rb +12 -0
  77. data/spec/config/validator.pem +27 -0
  78. data/spec/spec_helper.rb +4 -8
  79. data/spec/support/chef_api.rb +14 -9
  80. data/spec/support/chef_server.rb +3 -4
  81. data/spec/unit/berkshelf/berksfile_spec.rb +1 -1
  82. data/spec/unit/berkshelf/cookbook_generator_spec.rb +12 -6
  83. data/spec/unit/berkshelf/cookbook_source_spec.rb +13 -1
  84. data/spec/unit/berkshelf/init_generator_spec.rb +5 -0
  85. data/spec/unit/chef/config_spec.rb +9 -10
  86. metadata +216 -93
  87. data/features/info_command.feature +0 -39
  88. data/features/open_command.feature +0 -36
  89. data/lib/berkshelf/cli_commands/test_command.rb +0 -11
  90. data/lib/berkshelf/mixin.rb +0 -10
  91. data/lib/berkshelf/mixin/path_helpers.rb +0 -30
  92. data/spec/support/knife.rb +0 -18
@@ -3,6 +3,15 @@ require 'aruba/api'
3
3
  World(Aruba::Api)
4
4
  World(Berkshelf::RSpec::ChefAPI)
5
5
 
6
+ Given /^I dynamically write to "(.+)" with:$/ do |file, contents|
7
+ steps %{
8
+ Given I write to "#{file}" with:
9
+ """
10
+ #{ERB.new(contents).result(binding)}
11
+ """
12
+ }
13
+ end
14
+
6
15
  Given /^a cookbook named "(.*?)"$/ do |name|
7
16
  steps %{
8
17
  Given a directory named "#{name}"
@@ -42,8 +51,8 @@ Given /^the cookbook "(.*?)" has the file "(.*?)" with:$/ do |cookbook_name, fil
42
51
  end
43
52
 
44
53
  Given /^the cookbook store has the cookbooks:$/ do |cookbooks|
45
- cookbooks.raw.each do |name, version|
46
- generate_cookbook(cookbook_store, name, version)
54
+ cookbooks.raw.each do |name, version, license|
55
+ generate_cookbook(cookbook_store, name, version, license: license)
47
56
  end
48
57
  end
49
58
 
@@ -126,7 +135,7 @@ Then /^I should have a new cookbook skeleton "(.*?)" with Chef-Minitest support$
126
135
  cb_path = Pathname.new(current_dir).join(name)
127
136
  expect(cb_path).to have_structure {
128
137
  file "Berksfile" do
129
- contains "cookbook \"minitest-handler\""
138
+ contains "cookbook 'minitest-handler'"
130
139
  end
131
140
  file "Vagrantfile" do
132
141
  contains "recipe[minitest-handler::default]"
@@ -22,7 +22,6 @@ Then /^the output should be the same as \`(.+)\`$/ do |command|
22
22
  end
23
23
 
24
24
  # The built-in regex matcher does not support multi-line matching :(
25
- # @author Seth Vargo <sethvargo@gmail.com>
26
25
  Then /^the output should match multiline:$/ do |expected|
27
26
  regex = Regexp.new(expected.strip, Regexp::MULTILINE)
28
27
  expect(regex).to match(all_output)
@@ -11,7 +11,7 @@ Spork.prefork do
11
11
 
12
12
  ENV['RUBY_ENV'] = 'test'
13
13
  ENV['BERKSHELF_PATH'] = File.join(APP_ROOT, 'tmp', 'berkshelf')
14
- ENV['BERKSHELF_CHEF_CONFIG'] = File.join(APP_ROOT, 'spec', 'knife.rb')
14
+ ENV['BERKSHELF_CHEF_CONFIG'] = File.join(APP_ROOT, 'spec', 'config', 'knife.rb')
15
15
 
16
16
  # Workaround for RSA Fingerprint prompt in Travis CI
17
17
  git_ssh_path = '/tmp/git_ssh.sh'
@@ -34,7 +34,7 @@ Spork.prefork do
34
34
  clean_cookbook_store
35
35
  generate_berks_config(File.join(ENV['BERKSHELF_PATH'], 'config.json'))
36
36
  @aruba_io_wait_seconds = 5
37
- @aruba_timeout_seconds = 16
37
+ @aruba_timeout_seconds = 30
38
38
  end
39
39
 
40
40
  Before('@slow_process') do
@@ -42,6 +42,15 @@ Spork.prefork do
42
42
  @aruba_io_wait_seconds = 30
43
43
  end
44
44
 
45
+ # Chef Zero
46
+ require 'chef_zero/server'
47
+ @server = ChefZero::Server.new(port: 4000, generate_real_keys: false)
48
+ @server.start_background
49
+
50
+ at_exit do
51
+ @server.stop if @server && @server.running?
52
+ end
53
+
45
54
  def cookbook_store
46
55
  Pathname.new(File.join(ENV['BERKSHELF_PATH'], 'cookbooks'))
47
56
  end
@@ -65,7 +74,5 @@ Spork.prefork do
65
74
  end
66
75
 
67
76
  Spork.each_run do
68
- Berkshelf::RSpec::Knife.load_knife_config(File.join(APP_ROOT, 'spec/knife.rb'))
69
-
70
77
  require 'berkshelf'
71
78
  end
@@ -1,15 +1,17 @@
1
- Feature: update command
1
+ Feature: Updating a cookbook defined by a Berksfile
2
2
  As a user
3
3
  I want a way to update the versions without clearing out the files I've downloaded
4
4
  So that I can update faster than a clean install
5
5
 
6
- Scenario: updating with the old lockfile format
7
- Given I write to "Berksfile" with:
6
+ Scenario: With the old lockfile format
7
+ Given the cookbook store has the cookbooks:
8
+ | berkshelf-cookbook-fixture | 0.1.0 |
9
+ And I write to "Berksfile" with:
8
10
  """
9
11
  site :opscode
10
12
  cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
11
13
  """
12
- Given I write to "Berksfile.lock" with:
14
+ And I write to "Berksfile.lock" with:
13
15
  """
14
16
  cookbook 'berkshelf-cookbook-fixture', :locked_version => '0.1.0'
15
17
  """
@@ -21,21 +23,25 @@ Feature: update command
21
23
  "sha":"b2714a4f9bdf500cb20267067160a0b3c1d8404c",
22
24
  "sources":{
23
25
  "berkshelf-cookbook-fixture":{
24
- "locked_version":"0.2.0",
26
+ "locked_version":"0.1.0",
25
27
  "constraint":"~> 0.1"
26
28
  }
27
29
  }
28
30
  }
29
31
  """
30
32
 
31
- Scenario: Updating all cookbooks
32
- Given I write to "Berksfile" with:
33
+ Scenario: Without a cookbook specified
34
+ Given the cookbook store has the cookbooks:
35
+ | berkshelf-cookbook-fixture | 0.1.0 |
36
+ | berkshelf-cookbook-fixture | 0.2.0 |
37
+ | hostsfile | 1.0.1 |
38
+ And I write to "Berksfile" with:
33
39
  """
34
40
  site :opscode
35
41
  cookbook 'berkshelf-cookbook-fixture', '~> 0.1'
36
42
  cookbook 'hostsfile', '~> 1.0.0'
37
43
  """
38
- Given I write to "Berksfile.lock" with:
44
+ And I write to "Berksfile.lock" with:
39
45
  """
40
46
  {
41
47
  "sha":"9d10199aa2652f9e965149c4346db20c78e97553",
@@ -69,7 +75,11 @@ Feature: update command
69
75
  }
70
76
  """
71
77
 
72
- Scenario: Updating a single cookbook
78
+ Scenario: With a single cookbook specified
79
+ Given the cookbook store has the cookbooks:
80
+ | berkshelf-cookbook-fixture | 0.1.0 |
81
+ | berkshelf-cookbook-fixture | 0.2.0 |
82
+ | hostsfile | 1.0.1 |
73
83
  Given I write to "Berksfile" with:
74
84
  """
75
85
  site :opscode
@@ -110,7 +120,9 @@ Feature: update command
110
120
  }
111
121
  """
112
122
 
113
- Scenario: Update a cookbook that doesn't exist
123
+ Scenario: With a cookbook that does not exist
124
+ Given the cookbook store has the cookbooks:
125
+ | berkshelf-cookbook-fixture | 0.1.0 |
114
126
  Given I write to "Berksfile" with:
115
127
  """
116
128
  site :opscode
@@ -1,117 +1,125 @@
1
- Feature: upload command
1
+ Feature: Uploading cookbooks to a Chef Server
2
2
  As a Berkshelf CLI user
3
3
  I need a way to upload cookbooks to a Chef server that I have installed into my Bookshelf
4
4
  So they are available to Chef clients
5
5
 
6
- @no_run @chef_server
7
- Scenario: running the upload command when the Sources in the Berksfile are already installed
8
- Given I write to "Berksfile" with:
6
+ @chef_server @slow_process
7
+ Scenario: With no arguments
8
+ Given the cookbook store has the cookbooks:
9
+ | fake | 1.0.0 |
10
+ | ekaf | 2.0.0 |
11
+ And I write to "Berksfile" with:
9
12
  """
10
- cookbook "mysql", "1.2.4"
13
+ cookbook 'fake', '1.0.0'
14
+ cookbook 'ekaf', '2.0.0'
11
15
  """
12
16
  And the Chef server does not have the cookbooks:
13
- | mysql | 1.2.4 |
14
- | openssl | 1.0.0 |
15
- And I run the install command
16
- When I run the upload command
17
- Then the output should not contain "Using mysql (1.2.4)"
18
- And the output should not contain "Using openssl (1.0.0)"
19
- And the output should contain "Uploading mysql (1.2.4) to:"
20
- And the output should contain "Uploading openssl (1.0.0) to:"
21
- And the Chef server should have the cookbooks:
22
- | mysql | 1.2.4 |
23
- | openssl | 1.0.0 |
24
- And the exit status should be 0
25
-
26
- @chef_server @slow_process
27
- Scenario: running the upload command when the Sources in the Berksfile have not been installed
28
- Given I write to "Berksfile" with:
17
+ | fake | 1.0.0 |
18
+ | ekaf | 2.0.0 |
19
+ When I successfully run `berks upload`
20
+ Then the output should contain:
29
21
  """
30
- cookbook "mysql", "1.2.4"
31
- cookbook "openssl", "= 1.0.0"
22
+ Uploading fake (1.0.0) to: 'http://localhost:4000/'
23
+ Uploading ekaf (2.0.0) to: 'http://localhost:4000/'
32
24
  """
33
- And the Chef server does not have the cookbooks:
34
- | mysql | 1.2.4 |
35
- | openssl | 1.0.0 |
36
- When I run the upload command
37
- Then the output should contain "Installing mysql (1.2.4) from site:"
38
- And the output should contain "Installing openssl (1.0.0) from site:"
39
- And the output should contain "Uploading mysql (1.2.4) to:"
40
- And the output should contain "Uploading openssl (1.0.0) to:"
41
25
  And the Chef server should have the cookbooks:
42
- | mysql | 1.2.4 |
43
- | openssl | 1.0.0 |
26
+ | fake | 1.0.0 |
27
+ | ekaf | 2.0.0 |
44
28
  And the exit status should be 0
45
29
 
46
30
  @chef_server
47
- Scenario: running the upload command with a Berksfile containing a source that has a path location
48
- Given a Berksfile with path location sources to fixtures:
49
- | example_cookbook | example_cookbook-0.5.0 |
31
+ Scenario: With a path location in the Berksfile
32
+ Given a cookbook named "fake"
33
+ And I write to "Berksfile" with:
34
+ """
35
+ cookbook 'fake', path: './fake'
36
+ """
50
37
  And the Chef server does not have the cookbooks:
51
- | example_cookbook | 0.5.0 |
52
- When I run the upload command
53
- Then the output should contain "Using example_cookbook (0.5.0) at path:"
54
- And the output should contain "Uploading example_cookbook (0.5.0) to:"
38
+ | fake | 0.0.0 |
39
+ When I successfully run `berks upload`
40
+ Then the output should contain:
41
+ """
42
+ Uploading fake (0.0.0) to: 'http://localhost:4000/'
43
+ """
55
44
  And the Chef server should have the cookbooks:
56
- | example_cookbook | 0.5.0 |
45
+ | fake | 0.0.0 |
57
46
  And the exit status should be 0
58
47
 
59
48
  @chef_server
60
- Scenario: running the upload command with a Berksfile containing a source that has a Git location
61
- Given I write to "Berksfile" with:
49
+ Scenario: With a git location in the Berksfile
50
+ Given the cookbook store has the cookbooks:
51
+ | berkshelf-cookbook-fixture | 0.1.0 |
52
+ And I write to "Berksfile" with:
62
53
  """
63
- cookbook "artifact", git: "git://github.com/RiotGames/artifact-cookbook.git", ref: "0.9.8"
54
+ cookbook 'berkshelf-cookbook-fixture', ref: 'v0.1.0'
64
55
  """
65
56
  And the Chef server does not have the cookbooks:
66
- | artifact | 0.9.8 |
67
- When I run the upload command
68
- Then the output should contain "Installing artifact (0.9.8) from git:"
69
- And the output should contain "Uploading artifact (0.9.8) to:"
57
+ | berkshelf-cookbook-fixture | 0.1.0 |
58
+ When I successfully run `berks upload`
59
+ Then the output should contain:
60
+ """
61
+ Uploading berkshelf-cookbook-fixture (0.1.0) to: 'http://localhost:4000/'
62
+ """
70
63
  And the Chef server should have the cookbooks:
71
- | artifact | 0.9.8 |
64
+ | berkshelf-cookbook-fixture | 0.1.0 |
72
65
  And the exit status should be 0
73
66
 
74
67
  @chef_server @slow_process
75
- Scenario: Running the upload command for a single cookbook
76
- Given I write to "Berksfile" with:
68
+ Scenario: With a single cookbook
69
+ Given the cookbook store has the cookbooks:
70
+ | fake | 1.0.0 |
71
+ | ekaf | 2.0.0 |
72
+ And the cookbook store contains a cookbook "reset" "3.4.5" with dependencies:
73
+ | fake | ~> 1.0.0 |
74
+ And I write to "Berksfile" with:
77
75
  """
78
- cookbook "build-essential", "1.2.0"
79
- cookbook "mysql", "1.2.4"
80
- cookbook "openssl", "= 1.0.0"
76
+ cookbook 'fake', '1.0.0'
77
+ cookbook 'ekaf', '2.0.0'
78
+ cookbook 'reset', '3.4.5'
81
79
  """
82
- And I successfully run `berks install`
83
80
  And the Chef server does not have the cookbooks:
84
- | mysql | 1.2.4 |
85
- | openssl | 1.0.0 |
86
- | build-essential | 1.2.0 |
87
- When I run `berks upload mysql`
88
- Then the output should contain "Uploading mysql (1.2.4)"
89
- And the output should contain "Uploading openssl (1.0.0)"
90
- And the output should not contain "Uploading build-essential (1.2.0)"
81
+ | fake | 1.0.0 |
82
+ | ekaf | 2.0.0 |
83
+ | reset | 3.4.5 |
84
+ When I successfully run `berks upload reset`
85
+ Then the output should contain:
86
+ """
87
+ Uploading reset (3.4.5) to: 'http://localhost:4000/'
88
+ Uploading fake (1.0.0) to: 'http://localhost:4000/'
89
+ """
91
90
  And the Chef server should have the cookbooks:
92
- | mysql | 1.2.4 |
93
- | openssl | 1.0.0 |
91
+ | reset | 3.4.5 |
92
+ | fake | 1.0.0 |
94
93
  And the Chef server should not have the cookbooks:
95
- | build-essential | 1.2.0 |
94
+ | ekaf | 2.0.0 |
96
95
  And the exit status should be 0
97
96
 
98
97
  @chef_server @slow_process
99
- Scenario: explicitly specifying multiple cookbooks to upload
98
+ Scenario: With multiple cookbooks
99
+ Given the cookbook store has the cookbooks:
100
+ | ntp | 1.0.0 |
101
+ | vim | 1.0.0 |
102
+ | apt | 1.0.0 |
100
103
  Given I write to "Berksfile" with:
101
104
  """
102
- cookbook "ntp"
103
- cookbook "vim"
104
- cookbook "apt"
105
+ cookbook 'ntp', '1.0.0'
106
+ cookbook 'vim', '1.0.0'
107
+ cookbook 'apt', '1.0.0'
105
108
  """
106
- And I successfully run `berks install`
107
109
  And the Chef server does not have the cookbooks:
108
110
  | ntp |
109
111
  | vim |
110
112
  | apt |
111
- When I run `berks upload ntp vim`
112
- Then the output should contain "Uploading ntp"
113
- And the output should contain "Uploading vim"
114
- And the output should not contain "Uploading apt"
113
+ When I successfully run `berks upload ntp vim`
114
+ Then the output should contain:
115
+ """
116
+ Uploading ntp (1.0.0) to: 'http://localhost:4000/'
117
+ Uploading vim (1.0.0) to: 'http://localhost:4000/'
118
+ """
119
+ And the output should not contain:
120
+ """
121
+ Uploading apt (1.0.0) to: 'http://localhost:4000/'
122
+ """
115
123
  And the Chef server should have the cookbooks:
116
124
  | ntp |
117
125
  | vim |
@@ -120,99 +128,138 @@ Feature: upload command
120
128
  And the exit status should be 0
121
129
 
122
130
  @chef_server @slow_process
123
- Scenario: uploading a single group of cookbooks with the --only flag
131
+ Scenario: With the --only flag
132
+ Given the cookbook store has the cookbooks:
133
+ | core | 1.0.0 |
134
+ | system | 1.0.0 |
124
135
  Given I write to "Berksfile" with:
125
136
  """
126
- group :core do
127
- cookbook "ntp"
137
+ group :group_a do
138
+ cookbook 'core', '1.0.0'
128
139
  end
129
140
 
130
- group :system do
131
- cookbook "vim"
141
+ group :group_b do
142
+ cookbook 'system', '1.0.0'
132
143
  end
133
144
  """
134
- And I successfully run `berks install`
135
145
  And the Chef server does not have the cookbooks:
136
- | ntp |
137
- | vim |
138
- When I run `berks upload --only core`
139
- Then the output should contain "Uploading ntp"
140
- And the output should not contain "Uploading vim"
146
+ | core | 1.0.0 |
147
+ | system | 1.0.0 |
148
+ When I successfully run `berks upload --only group_a`
149
+ Then the output should contain:
150
+ """
151
+ Uploading core (1.0.0) to: 'http://localhost:4000/'
152
+ """
153
+ And the output should not contain:
154
+ """
155
+ Uploading system (1.0.0) to: 'http://localhost:4000/'
156
+ """
141
157
  And the Chef server should have the cookbooks:
142
- | ntp |
158
+ | core | 1.0.0 |
143
159
  And the Chef server should not have the cookbooks:
144
- | vim |
160
+ | system | 1.0.0 |
145
161
  And the exit status should be 0
146
162
 
147
163
  @chef_server @slow_process
148
- Scenario: uploading multiple groups of cookbooks with the --only flag
164
+ Scenario: With the --only flag specifying multiple groups
165
+ Given the cookbook store has the cookbooks:
166
+ | core | 1.0.0 |
167
+ | system | 1.0.0 |
149
168
  Given I write to "Berksfile" with:
150
169
  """
151
- group :core do
152
- cookbook "ntp"
170
+ group :group_a do
171
+ cookbook 'core', '1.0.0'
153
172
  end
154
173
 
155
- group :system do
156
- cookbook "vim"
174
+ group :group_b do
175
+ cookbook 'system', '1.0.0'
157
176
  end
158
177
  """
159
- And I successfully run `berks install`
160
178
  And the Chef server does not have the cookbooks:
161
- | ntp |
162
- | vim |
163
- When I run `berks upload --only core system`
164
- Then the output should contain "Uploading ntp"
165
- And the output should contain "Uploading vim"
179
+ | core | 1.0.0 |
180
+ | system | 1.0.0 |
181
+ When I successfully run `berks upload --only group_a group_b`
182
+ Then the output should contain:
183
+ """
184
+ Uploading core (1.0.0) to: 'http://localhost:4000/'
185
+ Uploading system (1.0.0) to: 'http://localhost:4000/'
186
+ """
166
187
  And the Chef server should have the cookbooks:
167
- | ntp |
168
- | vim |
188
+ | core | 1.0.0 |
189
+ | system | 1.0.0 |
169
190
  And the exit status should be 0
170
191
 
171
192
  @chef_server @slow_process
172
- Scenario: skip uploading one group of cookbooks with the --except flag
193
+ Scenario: With the --except flag
194
+ Given the cookbook store has the cookbooks:
195
+ | core | 1.0.0 |
196
+ | system | 1.0.0 |
173
197
  Given I write to "Berksfile" with:
174
198
  """
175
- group :core do
176
- cookbook "ntp"
199
+ group :group_a do
200
+ cookbook 'core', '1.0.0'
177
201
  end
178
202
 
179
- group :system do
180
- cookbook "vim"
203
+ group :group_b do
204
+ cookbook 'system', '1.0.0'
181
205
  end
182
206
  """
183
- And I successfully run `berks install`
184
207
  And the Chef server does not have the cookbooks:
185
- | ntp |
186
- | vim |
187
- When I run `berks upload --except core`
188
- Then the output should not contain "Uploading ntp"
189
- And the output should contain "Uploading vim"
190
- And the Chef server should not have the cookbooks:
191
- | ntp |
208
+ | core | 1.0.0 |
209
+ | system | 1.0.0 |
210
+ When I successfully run `berks upload --except group_b`
211
+ Then the output should contain:
212
+ """
213
+ Uploading core (1.0.0) to: 'http://localhost:4000/'
214
+ """
215
+ And the output should not contain:
216
+ """
217
+ Uploading system (1.0.0) to: 'http://localhost:4000/'
218
+ """
192
219
  And the Chef server should have the cookbooks:
193
- | vim |
220
+ | core | 1.0.0 |
221
+ And the Chef server should not have the cookbooks:
222
+ | system | 1.0.0 |
194
223
  And the exit status should be 0
195
224
 
196
225
  @chef_server @slow_process
197
- Scenario: skip uploading multiple groups of cookbooks with the --except flag
226
+ Scenario: With the --except flag specifying multiple groups
227
+ Given the cookbook store has the cookbooks:
228
+ | core | 1.0.0 |
229
+ | system | 1.0.0 |
198
230
  Given I write to "Berksfile" with:
199
231
  """
200
- group :core do
201
- cookbook "ntp"
232
+ group :group_a do
233
+ cookbook 'core', '1.0.0'
202
234
  end
203
235
 
204
- group :system do
205
- cookbook "vim"
236
+ group :group_b do
237
+ cookbook 'system', '1.0.0'
206
238
  end
207
239
  """
208
- And I successfully run `berks install`
209
240
  And the Chef server does not have the cookbooks:
210
- | ntp |
211
- | vim |
212
- When I run `berks upload --except core system`
213
- Then the output should not contain "Uploading ntp"
214
- And the output should not contain "Uploading vim"
241
+ | core | 1.0.0 |
242
+ | system | 1.0.0 |
243
+ When I successfully run `berks upload --except group_a group_b`
244
+ Then the output should not contain:
245
+ """
246
+ Uploading core (1.0.0) to: 'http://localhost:4000/'
247
+ Uploading system (1.0.0) to: 'http://localhost:4000/'
248
+ """
215
249
  And the Chef server should not have the cookbooks:
216
- | ntp |
217
- | vim |
250
+ | core | 1.0.0 |
251
+ | system | 1.0.0 |
218
252
  And the exit status should be 0
253
+
254
+ Scenario: With an invalid cookbook
255
+ Given a cookbook named "cookbook with spaces"
256
+ And I write to "Berksfile" with:
257
+ """
258
+ cookbook 'cookbook with spaces', path: './cookbook with spaces'
259
+ """
260
+ When I run `berks upload`
261
+ Then the output should contain:
262
+ """
263
+ The cookbook 'cookbook with spaces' has invalid filenames:
264
+ """
265
+ And the CLI should exit with the status code for error "InvalidCookbookFiles"