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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9eeec61abc7afc5a3a61ba58852f1ee753969f3
4
- data.tar.gz: bf73a4918c2c1c00873e586f5e2e2a38fc7f30a8
3
+ metadata.gz: 1f30b6f5921539453a2eb582dcf8b483bf6f33e1
4
+ data.tar.gz: d47613f9a3940b7b8e0fa157f7e8e5643f468288
5
5
  SHA512:
6
- metadata.gz: ff93338dfc827ddac156835b12deff45ac00d18515185cd2abad4f8283295987d28c31fc371d96ad045a0cc2392d22e3957e037fc00469c769e9b4b913c00480
7
- data.tar.gz: 5d6fab4ced0612343c398a9b39893636e78bbee24f525160016c322c0e42e279cb86764004f98b59d57fe49c0f37432ad5de50ba8460b8fe55664f0dd0785f17
6
+ metadata.gz: 32ec7a95765d2b8d81792e71f6834736e12dd738ef0a5a4764c1fa5ae7dee346d581105349303efca4d4265e6df6f369832d5906d32453a7c24ba67f96bc90cf
7
+ data.tar.gz: 8b64c19ac6c62a77bbed0fea4aacca7fab0fc6f20442ba34c2b726917e48d5cad4bad7a9f1689568fbc83a009670e8a7e5113140eb3b1d155cf2c0c00e7d020b
data/.gitignore CHANGED
@@ -18,7 +18,6 @@ tmp
18
18
  .DS_Store
19
19
  /spec/knife.rb
20
20
  /spec/*.pem
21
- /spec/fixtures/vcr_cassettes
22
21
  /features/config.yml
23
22
  *.sw[op]
24
23
  \.\#*
@@ -2,6 +2,14 @@
2
2
 
3
3
  * New "universe" resolver which communicates with an API server to resolve constraint graphs faster and more reliably
4
4
 
5
+ # 2.0.10
6
+
7
+ * Huge performance increase when resolving a Berksfile when the Berkshelf contains a lot of cookbooks
8
+
9
+ # 2.0.9
10
+
11
+ * Update required version of Ridley
12
+
5
13
  # 2.0.7
6
14
 
7
15
  * Fix crash when parsing a lockfile that contains path locations which no longer exist
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ gemspec
5
5
  group :guard do
6
6
  gem 'coolline', '~> 0.4.2'
7
7
  gem 'guard', '~> 1.8'
8
- gem 'guard-cane'
9
8
  gem 'guard-cucumber'
10
9
  gem 'guard-rspec'
11
10
  gem 'guard-spork'
data/Guardfile CHANGED
@@ -23,7 +23,3 @@ guard 'cucumber', cli: '--drb --format pretty --tags ~@no_run --tags ~@wip', all
23
23
 
24
24
  watch(%r{^lib/berkshelf/cli.rb}) { 'features' }
25
25
  end
26
-
27
- guard 'cane', run_all_on_start: false do
28
- watch(/.*\.rb/)
29
- end
data/README.md CHANGED
@@ -39,7 +39,7 @@ There is a [berkshelf bash completion script](https://raw.github.com/RiotGames/b
39
39
 
40
40
  Download the latest script
41
41
 
42
- cd `brew --prefix`/etc/bash_completion && wget https://raw.github.com/RiotGames/berkshelf/master/berkshelf-complete.sh
42
+ cd `brew --prefix`/etc/bash_completion.d && wget https://raw.github.com/RiotGames/berkshelf/master/berkshelf-complete.sh
43
43
 
44
44
  And make sure you have this in your bash/zsh profile:
45
45
 
data/Thorfile CHANGED
@@ -30,7 +30,7 @@ class Spec < Thor
30
30
 
31
31
  desc 'all', 'Run all specs and features'
32
32
  def all
33
- exit(units_command && acceptance_command && quality_command)
33
+ exit(units_command && acceptance_command)
34
34
  end
35
35
 
36
36
  desc 'ci', 'Run tests on Travis'
@@ -49,22 +49,13 @@ class Spec < Thor
49
49
  exit(acceptance_command)
50
50
  end
51
51
 
52
- desc 'quality', 'Run code quality tests'
53
- def quality
54
- exit(quality_command)
55
- end
56
-
57
52
  no_tasks do
58
53
  def units_command
59
54
  run('rspec --color --format progress spec/unit')
60
55
  end
61
56
 
62
57
  def acceptance_command
63
- run('cucumber --color --format progress --tags ~@no_run')
64
- end
65
-
66
- def quality_command
67
- run('cane --gte coverage/.last_run.json,90')
58
+ run('cucumber --color --format progress --tags ~@no_run --strict')
68
59
  end
69
60
  end
70
61
  end
@@ -34,24 +34,21 @@ Gem::Specification.new do |s|
34
34
  s.add_dependency 'buff-config', '~> 0.2'
35
35
  s.add_dependency 'buff-extensions', '~> 0.4'
36
36
  s.add_dependency 'buff-shell_out', '~> 0.1'
37
- s.add_dependency 'celluloid', '>= 0.14.0'
38
37
  s.add_dependency 'faraday', '>= 0.8.5'
39
38
  s.add_dependency 'hashie', '>= 2.0.2'
40
39
  s.add_dependency 'minitar', '~> 0.5.4'
41
40
  s.add_dependency 'retryable', '~> 1.3.3'
42
- s.add_dependency 'ridley', '~> 1.4.0'
43
- s.add_dependency 'solve', '>= 0.5.0'
41
+ s.add_dependency 'ridley', '~> 1.6'
42
+ s.add_dependency 'solve', '>= 0.8.0'
44
43
  s.add_dependency 'thor', '~> 0.18.0'
45
44
 
46
45
  s.add_development_dependency 'aruba', '~> 0.5'
47
- s.add_development_dependency 'cane', '~> 2.5'
48
46
  s.add_development_dependency 'chef-zero', '~> 1.5.0'
49
47
  s.add_development_dependency 'fuubar', '~> 1.1'
50
48
  s.add_development_dependency 'rake', '~> 0.9'
51
49
  s.add_development_dependency 'rspec', '~> 2.13'
52
50
  s.add_development_dependency 'spork', '~> 0.9'
53
51
  s.add_development_dependency 'test-kitchen', '>= 1.0.0.alpha7'
54
- s.add_development_dependency 'vcr', '~> 2.4'
55
52
  s.add_development_dependency 'webmock', '~> 1.11'
56
53
  s.add_development_dependency 'yard', '~> 0.8'
57
54
  end
@@ -1,13 +1,7 @@
1
1
  Feature: Evaluating a Berksfile
2
- As a user with a Berksfile
3
- I want to evaluate things and see nice errors
4
- So I can identify my syntax errors and faults
5
-
6
2
  Scenario: Containing pure Ruby
7
3
  Given I write to "Berksfile" with:
8
4
  """
9
- source "http://localhost:26210"
10
-
11
5
  if ENV['BACON']
12
6
  puts "If you don't got bacon..."
13
7
  else
@@ -21,11 +15,10 @@ Feature: Evaluating a Berksfile
21
15
  If you don't got bacon...
22
16
  """
23
17
 
18
+
24
19
  Scenario: Containing methods I shouldn't be able to call
25
20
  Given I write to "Berksfile" with:
26
21
  """
27
- source "http://localhost:26210"
28
-
29
22
  add_location(:foo)
30
23
  """
31
24
  When I run `berks install`
@@ -37,11 +30,10 @@ Feature: Evaluating a Berksfile
37
30
  """
38
31
  And the exit status should be "BerksfileReadError"
39
32
 
33
+
40
34
  Scenario: Containing Ruby syntax errors
41
35
  Given I write to "Berksfile" with:
42
36
  """
43
- source "http://localhost:26210"
44
-
45
37
  ptus "This is a ruby syntax error"
46
38
  """
47
39
  When I run `berks install`
@@ -0,0 +1,31 @@
1
+ Feature: berks apply
2
+ Scenario: Locking a cookbook version with dependencies
3
+ Given the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
4
+ | dependency | 2.0.0 |
5
+ And the cookbook store has the cookbooks:
6
+ | dependency | 2.0.0 |
7
+ And the Chef Server has an environment named "my_env"
8
+ And I have a Berksfile pointing at the local Berkshelf API with:
9
+ """
10
+ cookbook 'fake', '1.0.0'
11
+ """
12
+ When I successfully run `berks apply my_env`
13
+ Then the version locks in the "my_env" environment should be:
14
+ | fake | 1.0.0 |
15
+ | dependency | 2.0.0 |
16
+
17
+
18
+ Scenario: Locking cookbook versions to a non-existent Chef Environment
19
+ Given the Chef Server does not have an environment named "my_env"
20
+ And the cookbook store has the cookbooks:
21
+ | fake | 1.0.0 |
22
+ And I have a Berksfile pointing at the local Berkshelf API with:
23
+ """
24
+ cookbook 'fake', '1.0.0'
25
+ """
26
+ When I run `berks apply my_env`
27
+ Then the output should contain:
28
+ """
29
+ The environment 'my_env' does not exist
30
+ """
31
+ And the exit status should be "EnvironmentNotFound"
@@ -1,11 +1,7 @@
1
1
  @spawn
2
- Feature: Configuring Berkshelf via the command line
3
- As CLI user of Berkshelf
4
- I want a command to generate a Berkshelf configuration file based on my input
5
- So I can quickly get up and running with the least amount of resistance
6
-
2
+ Feature: berks configure
7
3
  Background:
8
- Given I do not have a Berkshelf config
4
+ * I do not have a Berkshelf config
9
5
 
10
6
  Scenario: Using custom values
11
7
  When I run `berks configure` interactively
@@ -28,7 +24,7 @@ Feature: Configuring Berkshelf via the command line
28
24
  | chef.validation_key_path | /Users/reset/.chef/reset.pem |
29
25
  | vagrant.vm.box | Berkshelf-minimal |
30
26
  | vagrant.vm.box_url | https://dl.dropbox.com/Berkshelf.box |
31
- And the exit status should be 0
27
+
32
28
 
33
29
  Scenario: Accepting the default values
34
30
  Given I do not have a Chef config
@@ -49,9 +45,11 @@ Feature: Configuring Berkshelf via the command line
49
45
  | chef.validation_client_name | chef-validator |
50
46
  | chef.client_key | /etc/chef/client.pem |
51
47
  | chef.validation_key_path | /etc/chef/validation.pem |
52
- | vagrant.vm.box | Berkshelf-CentOS-6.3-x86_64-minimal |
53
- | vagrant.vm.box_url | https://dl.dropbox.com/u/31081437/Berkshelf-CentOS-6.3-x86_64-minimal.box |
54
- And the exit status should be 0
48
+ | vagrant.vm.box | opscode_ubuntu-12.04_provisionerless |
49
+ | vagrant.vm.box_url | https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box |
50
+ | vagrant.omnibus.enabled | BOOLEAN[true] |
51
+ | vagrant.omnibus.version | latest |
52
+
55
53
 
56
54
  Scenario: Creating a Berkshelf configuration file when one already exists
57
55
  Given I already have a Berkshelf config file
@@ -62,6 +60,7 @@ Feature: Configuring Berkshelf via the command line
62
60
  """
63
61
  And the exit status should be "ConfigExists"
64
62
 
63
+
65
64
  Scenario Outline: Using the --path option
66
65
  When I run `berks configure --path <path>` interactively
67
66
  And I type "https://api.opscode.com/organizations/vialstudios"
@@ -83,7 +82,6 @@ Feature: Configuring Berkshelf via the command line
83
82
  | chef.validation_key_path | /Users/reset/.chef/reset.pem |
84
83
  | vagrant.vm.box | Berkshelf-minimal |
85
84
  | vagrant.vm.box_url | https://dl.dropbox.com/Berkshelf.box |
86
- And the exit status should be 0
87
85
 
88
86
  Examples:
89
87
  | path |
@@ -1,12 +1,9 @@
1
- Feature: Running the contingent command
2
- As a user with a Berksfile
3
- I want a way to the cookbooks that depend on another
4
- So that I can better understand my infrastructure
5
-
1
+ Feature: berks contingent
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: When there are dependent cookbooks
12
9
  Given the cookbook store has the cookbooks:
@@ -15,10 +12,8 @@ Feature: Running the contingent command
15
12
  | dep | ~> 1.0.0 |
16
13
  And the cookbook store contains a cookbook "ekaf" "1.0.0" with dependencies:
17
14
  | dep | ~> 1.0.0 |
18
- And I write to "Berksfile" with:
15
+ And I have a Berksfile pointing at the local Berkshelf API with:
19
16
  """
20
- source "http://localhost:26210"
21
-
22
17
  cookbook 'fake', '1.0.0'
23
18
  cookbook 'ekaf', '1.0.0'
24
19
  """
@@ -29,15 +24,13 @@ Feature: Running the contingent command
29
24
  * ekaf (1.0.0)
30
25
  * fake (1.0.0)
31
26
  """
32
- And the exit status should be 0
27
+
33
28
 
34
29
  Scenario: When there are no dependent cookbooks
35
30
  Given the cookbook store has the cookbooks:
36
31
  | fake | 1.0.0 |
37
- And I write to "Berksfile" with:
32
+ And I have a Berksfile pointing at the local Berkshelf API with:
38
33
  """
39
- source "http://localhost:26210"
40
-
41
34
  cookbook 'fake', '1.0.0'
42
35
  """
43
36
  And I successfully run `berks contingent dep`
@@ -45,13 +38,10 @@ Feature: Running the contingent command
45
38
  """
46
39
  There are no cookbooks contingent upon 'dep' defined in this Berksfile
47
40
  """
48
- And the exit status should be 0
41
+
49
42
 
50
43
  Scenario: When the cookbook is not in the Berksfile
51
- Given I write to "Berksfile" with:
52
- """
53
- source "http://localhost:26210"
54
- """
44
+ Given I have a Berksfile pointing at the local Berkshelf API
55
45
  And I successfully run `berks contingent dep`
56
46
  Then the output should contain:
57
47
  """
@@ -1,18 +1,12 @@
1
- Feature: Creating a new cookbook
2
- As a Cookbook author
3
- I want a way to quickly generate a Cookbook skeleton that contains supporting Berkshelf files
4
- So I can quickly and automatically generate a Cookbook containing Berkshelf supporting files or other common supporting files
5
-
1
+ Feature: berks cookbook
6
2
  Scenario: With the default options
7
3
  When I successfully run `berks cookbook sparkle_motion`
8
4
  Then I should have a new cookbook skeleton "sparkle_motion"
9
- And the exit status should be 0
5
+
10
6
 
11
7
  Scenario Outline: With various options
12
8
  When I successfully run `berks cookbook sparkle_motion --<option>`
13
9
  Then I should have a new cookbook skeleton "sparkle_motion" with <feature> support
14
- And the exit status should be 0
15
-
16
10
  Examples:
17
11
  | option | feature |
18
12
  | foodcritic | Foodcritic |
@@ -25,21 +19,20 @@ Feature: Creating a new cookbook
25
19
  | skip-vagrant | no Vagrant |
26
20
  | skip-test-kitchen | no Test Kitchen |
27
21
 
22
+
28
23
  Scenario Outline: When a required supporting gem is not installed
29
24
  Given the gem "<gem>" is not installed
30
25
  When I successfully run `berks cookbook sparkle_motion --<option>`
31
26
  Then I should have a new cookbook skeleton "sparkle_motion" with <feature> support
32
27
  And the output should contain a warning to suggest supporting the option "<option>" by installing "<gem>"
33
- And the exit status should be 0
34
-
35
28
  Examples:
36
29
  | option | feature | gem |
37
30
  | foodcritic | Foodcritic | foodcritic |
38
31
  | scmversion | SCMVersion | thor-scmversion |
39
32
 
33
+
40
34
  Scenario: When bundler is not installed
41
35
  Given the gem "bundler" is not installed
42
36
  When I successfully run `berks cookbook sparkle_motion`
43
37
  Then I should have a new cookbook skeleton "sparkle_motion"
44
38
  And the output should contain a warning to suggest supporting the default for "bundler" by installing "bundler"
45
- And the exit status should be 0
@@ -1,8 +1,4 @@
1
- Feature: initialize command
2
- As a Cookbook author
3
- I want a way to quickly prepare a Cookbook on my local disk with Berkshelf files
4
- So that I can resolve my Cookbook's dependencies with Berkshelf
5
-
1
+ Feature: berks init
6
2
  Scenario: initializing a path containing a cookbook
7
3
  Given a cookbook named "sparkle_motion"
8
4
  When I successfully run `berks init sparkle_motion`
@@ -14,25 +10,20 @@ Feature: initialize command
14
10
  metadata
15
11
  """
16
12
  And the output should contain "Successfully initialized"
17
- And the exit status should be 0
13
+
18
14
 
19
15
  Scenario: initializing a path that does not contain a cookbook
20
16
  Given a directory named "not_a_cookbook"
21
- When I successfully run `berks init not_a_cookbook`
22
- Then the directory "not_a_cookbook" should have the following files:
23
- | Berksfile |
24
- And the directory "not_a_cookbook" should not have the following files:
25
- | chefignore |
26
- And the file "Berksfile" in the directory "not_a_cookbook" should not contain:
27
- """
28
- metadata
29
- """
30
- And the output should contain "Successfully initialized"
31
- And the exit status should be 0
17
+ When I run `berks init not_a_cookbook`
18
+ And the exit status should be "NotACookbook"
19
+
32
20
 
33
21
  Scenario: initializing with no value given for target
22
+ Given I write to "metadata.rb" with:
23
+ """
24
+ name 'sparkle_motion'
25
+ """
34
26
  When I successfully run `berks init`
35
27
  Then the output should contain "Successfully initialized"
36
28
  And a file named "Berksfile" should exist
37
- And a file named "chefignore" should not exist
38
- And the exit status should be 0
29
+ And a file named "chefignore" should exist
@@ -1,18 +1,13 @@
1
- Feature: install cookbooks from a Berksfile
2
- As a user with a Berksfile
3
- I want a command to install the cookbooks defined in my Berksfile and their recursive dependencies
4
- So I don't have to download those cookbooks and their all of their dependencies manually
5
-
1
+ Feature: berks install
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: installing the version that best satisfies our demand
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'
17
12
  """
18
13
  And the Chef Server has cookbooks:
@@ -27,11 +22,10 @@ Feature: install cookbooks from a Berksfile
27
22
  And the cookbook store should have the cookbooks:
28
23
  | berkshelf | 2.0.0 |
29
24
 
25
+
30
26
  Scenario: installing an explicit version demand
31
- Given I write to "Berksfile" with:
27
+ Given I have a Berksfile pointing at the local Berkshelf API with:
32
28
  """
33
- source "http://localhost:26210"
34
-
35
29
  cookbook 'berkshelf', '1.0.0'
36
30
  """
37
31
  And the Chef Server has cookbooks:
@@ -46,11 +40,10 @@ Feature: install cookbooks from a Berksfile
46
40
  And the cookbook store should have the cookbooks:
47
41
  | berkshelf | 1.0.0 |
48
42
 
43
+
49
44
  Scenario: installing demands from all groups
50
- Given I write to "Berksfile" with:
45
+ Given I have a Berksfile pointing at the local Berkshelf API with:
51
46
  """
52
- source "http://localhost:26210"
53
-
54
47
  group :one do
55
48
  cookbook 'ruby'
56
49
  end
@@ -73,11 +66,10 @@ Feature: install cookbooks from a Berksfile
73
66
  | ruby | 1.0.0 |
74
67
  | elixir | 1.0.0 |
75
68
 
69
+
76
70
  Scenario: installing a demand that has already been installed
77
- Given I write to "Berksfile" with:
71
+ Given I have a Berksfile pointing at the local Berkshelf API with:
78
72
  """
79
- source "http://localhost:26210"
80
-
81
73
  cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
82
74
  """
83
75
  And the cookbook store contains a cookbook "berkshelf" "1.0.0" with dependencies:
@@ -91,11 +83,66 @@ Feature: install cookbooks from a Berksfile
91
83
  Using hostsfile (1.0.1)
92
84
  """
93
85
 
94
- Scenario: installing a demand from a path location
95
- Given I write to "Berksfile" with:
86
+
87
+ Scenario: installing a single groups of demands with the --only flag
88
+ Given the cookbook store has the cookbooks:
89
+ | takeme | 1.0.0 |
90
+ | notme | 1.0.0 |
91
+ And I have a Berksfile pointing at the local Berkshelf API with:
92
+ """
93
+ cookbook 'takeme', group: :take_me
94
+ cookbook 'notme', group: :not_me
96
95
  """
97
- source "http://localhost:26210"
96
+ When I successfully run `berks install --only take_me`
97
+ Then the output should contain "Using takeme (1.0.0)"
98
+ Then the output should not contain "Using notme (1.0.0)"
99
+
100
+
101
+ Scenario: installing multiple groups of demands with the --only flag
102
+ Given the cookbook store has the cookbooks:
103
+ | takeme | 1.0.0 |
104
+ | notme | 1.0.0 |
105
+ And I have a Berksfile pointing at the local Berkshelf API with:
106
+ """
107
+ cookbook 'takeme', group: :take_me
108
+ cookbook 'notme', group: :not_me
109
+ """
110
+ When I successfully run `berks upload --only take_me not_me`
111
+ Then the output should contain "Using takeme (1.0.0)"
112
+ Then the output should contain "Using notme (1.0.0)"
113
+
114
+
115
+ Scenario: skipping a single group to install with the --except flag
116
+ Given the cookbook store has the cookbooks:
117
+ | takeme | 1.0.0 |
118
+ | notme | 1.0.0 |
119
+ And I have a Berksfile pointing at the local Berkshelf API with:
120
+ """
121
+ cookbook 'takeme', group: :take_me
122
+ cookbook 'notme', group: :not_me
123
+ """
124
+ When I successfully run `berks upload --except not_me`
125
+ Then the output should contain "Using takeme (1.0.0)"
126
+ Then the output should not contain "Using notme (1.0.0)"
127
+
128
+
129
+ Scenario: skipping multiple groups to install with the --except flag
130
+ Given the cookbook store has the cookbooks:
131
+ | takeme | 1.0.0 |
132
+ | notme | 1.0.0 |
133
+ And I have a Berksfile pointing at the local Berkshelf API with:
134
+ """
135
+ cookbook 'takeme', group: :take_me
136
+ cookbook 'notme', group: :not_me
137
+ """
138
+ When I successfully run `berks upload --except take_me not_me`
139
+ Then the output should not contain "Using takeme (1.0.0)"
140
+ Then the output should not contain "Using notme (1.0.0)"
141
+
98
142
 
143
+ Scenario: installing a demand from a path location
144
+ Given I have a Berksfile pointing at the local Berkshelf API with:
145
+ """
99
146
  cookbook 'example_cookbook', path: '../../fixtures/cookbooks/example_cookbook-0.5.0'
100
147
  """
101
148
  And the Berkshelf API server's cache is up to date
@@ -105,24 +152,22 @@ Feature: install cookbooks from a Berksfile
105
152
  Using example_cookbook (0.5.0) path: '
106
153
  """
107
154
 
155
+
108
156
  Scenario: installing a Berksfile from a remote directory that contains a path location
109
- Given I write to "tmp_berks/Berksfile" with:
157
+ Given I have a Berksfile at "subdirectory" pointing at the local Berkshelf API with:
110
158
  """
111
- source "http://localhost:26210"
112
-
113
159
  cookbook 'example_cookbook', path: '../../../fixtures/cookbooks/example_cookbook-0.5.0'
114
160
  """
115
- When I successfully run `berks install -b ./tmp_berks/Berksfile`
161
+ When I successfully run `berks install -b subdirectory/Berksfile`
116
162
  Then the output should contain:
117
163
  """
118
164
  Using example_cookbook (0.5.0) path: '
119
165
  """
120
166
 
167
+
121
168
  Scenario: installing a demand from a Git location
122
- Given I write to "Berksfile" with:
169
+ Given I have a Berksfile pointing at the local Berkshelf API with:
123
170
  """
124
- source "http://localhost:26210"
125
-
126
171
  cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git"
127
172
  """
128
173
  When I successfully run `berks install`
@@ -135,11 +180,10 @@ Feature: install cookbooks from a Berksfile
135
180
  Using berkshelf-cookbook-fixture (1.0.0) git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'master'
136
181
  """
137
182
 
183
+
138
184
  Scenario: installing a demand from a Git location that has already been installed
139
- Given I write to "Berksfile" with:
185
+ Given I have a Berksfile pointing at the local Berkshelf API with:
140
186
  """
141
- source "http://localhost:26210"
142
-
143
187
  cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git"
144
188
  """
145
189
  And the cookbook store has the git cookbooks:
@@ -150,11 +194,10 @@ Feature: install cookbooks from a Berksfile
150
194
  Using berkshelf-cookbook-fixture (1.0.0) git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'master'
151
195
  """
152
196
 
197
+
153
198
  Scenario: installing a Berksfile that contains a Git location with a rel
154
- Given I write to "Berksfile" with:
199
+ Given I have a Berksfile pointing at the local Berkshelf API with:
155
200
  """
156
- source "http://localhost:26210"
157
-
158
201
  cookbook "berkshelf-cookbook-fixture", github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
159
202
  """
160
203
  When I successfully run `berks install`
@@ -167,11 +210,10 @@ Feature: install cookbooks from a Berksfile
167
210
  Using berkshelf-cookbook-fixture (1.0.0) github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'rel' over protocol: 'git'
168
211
  """
169
212
 
213
+
170
214
  Scenario: installing a Berksfile that contains a Git location with a tag
171
- Given I write to "Berksfile" with:
215
+ Given I have a Berksfile pointing at the local Berkshelf API with:
172
216
  """
173
- source "http://localhost:26210"
174
-
175
217
  cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
176
218
  """
177
219
  When I successfully run `berks install`
@@ -184,11 +226,10 @@ Feature: install cookbooks from a Berksfile
184
226
  Using berkshelf-cookbook-fixture (0.2.0) git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v0.2.0' at ref: '70a527e17d91f01f031204562460ad1c17f972ee'
185
227
  """
186
228
 
229
+
187
230
  Scenario: installing a Berksfile that contains a GitHub location
188
- Given I write to "Berksfile" with:
231
+ Given I have a Berksfile pointing at the local Berkshelf API with:
189
232
  """
190
- source "http://localhost:26210"
191
-
192
233
  cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0"
193
234
  """
194
235
  When I successfully run `berks install`
@@ -201,11 +242,10 @@ Feature: install cookbooks from a Berksfile
201
242
  Using berkshelf-cookbook-fixture (0.2.0) github: 'RiotGames/berkshelf-cookbook-fixture' with branch: 'v0.2.0' over protocol: 'git'
202
243
  """
203
244
 
245
+
204
246
  Scenario Outline: installing a Berksfile that contains a Github location and specific protocol
205
- Given I write to "Berksfile" with:
247
+ Given I have a Berksfile pointing at the local Berkshelf API with:
206
248
  """
207
- source "http://localhost:26210"
208
-
209
249
  cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v1.0.0", protocol: "<protocol>"
210
250
  """
211
251
  When I successfully run `berks install`
@@ -220,14 +260,13 @@ Feature: install cookbooks from a Berksfile
220
260
 
221
261
  Examples:
222
262
  | protocol |
223
- | git |
224
- | https |
263
+ | git |
264
+ | https |
265
+
225
266
 
226
267
  Scenario: installing a Berksfile that contains a Github location and an unsupported protocol
227
- Given I write to "Berksfile" with:
268
+ Given I have a Berksfile pointing at the local Berkshelf API with:
228
269
  """
229
- source "http://localhost:26210"
230
-
231
270
  cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "somethingabsurd"
232
271
  """
233
272
  When I run `berks install`
@@ -237,27 +276,25 @@ Feature: install cookbooks from a Berksfile
237
276
  """
238
277
  And the exit status should be "InvalidGitURI"
239
278
 
279
+
240
280
  Scenario: running install when current project is a cookbook and the 'metadata' is specified
241
281
  Given a cookbook named "sparkle_motion"
242
- And the cookbook "sparkle_motion" has the file "Berksfile" with:
282
+ And I cd to "sparkle_motion"
283
+ And I have a Berksfile pointing at the local Berkshelf API with:
243
284
  """
244
- source "http://localhost:26210"
245
-
246
285
  metadata
247
286
  """
248
- When I cd to "sparkle_motion"
249
- And I successfully run `berks install`
287
+ When I successfully run `berks install`
250
288
  Then the output should contain:
251
289
  """
252
290
  Using sparkle_motion (0.0.0)
253
291
  """
254
292
 
293
+
255
294
  Scenario: running install when current project is a cookbook and the 'metadata' is specified with a path
256
295
  Given a cookbook named "fake"
257
- And I write to "Berksfile" with:
296
+ And I have a Berksfile pointing at the local Berkshelf API with:
258
297
  """
259
- source "http://localhost:26210"
260
-
261
298
  metadata path: './fake'
262
299
  """
263
300
  When I successfully run `berks install`
@@ -266,16 +303,15 @@ Feature: install cookbooks from a Berksfile
266
303
  Using fake (0.0.0)
267
304
  """
268
305
 
306
+
269
307
  Scenario: running install when a Berksfile.lock is present
270
308
  Given the Chef Server has cookbooks:
271
309
  | bacon | 0.1.0 |
272
310
  | bacon | 0.2.0 |
273
311
  | bacon | 1.0.0 |
274
312
  And the Berkshelf API server's cache is up to date
275
- And I write to "Berksfile" with:
313
+ And I have a Berksfile pointing at the local Berkshelf API with:
276
314
  """
277
- source "http://localhost:26210"
278
-
279
315
  cookbook 'bacon', '~> 0.1'
280
316
  """
281
317
  And I write to "Berksfile.lock" with:
@@ -294,6 +330,7 @@ Feature: install cookbooks from a Berksfile
294
330
  Installing bacon (0.2.0)
295
331
  """
296
332
 
333
+
297
334
  Scenario: running install with no Berksfile or Berksfile.lock
298
335
  When I run `berks install`
299
336
  Then the output should contain:
@@ -302,11 +339,10 @@ Feature: install cookbooks from a Berksfile
302
339
  """
303
340
  And the exit status should be "BerksfileNotFound"
304
341
 
342
+
305
343
  Scenario: running install when the Cookbook is not found on the remote site
306
- Given I write to "Berksfile" with:
344
+ Given I have a Berksfile pointing at the local Berkshelf API with:
307
345
  """
308
- source "http://localhost:26210"
309
-
310
346
  cookbook 'doesntexist'
311
347
  cookbook 'other-failure'
312
348
  """
@@ -317,11 +353,10 @@ Feature: install cookbooks from a Berksfile
317
353
  """
318
354
  And the exit status should be "NoSolutionError"
319
355
 
356
+
320
357
  Scenario: installing a Berksfile that has a Git location source with an invalid Git URI
321
- Given I write to "Berksfile" with:
358
+ Given I have a Berksfile pointing at the local Berkshelf API with:
322
359
  """
323
- source "http://localhost:26210"
324
-
325
360
  cookbook 'nginx', git: '/something/on/disk'
326
361
  """
327
362
  When I run `berks install`
@@ -331,11 +366,10 @@ Feature: install cookbooks from a Berksfile
331
366
  """
332
367
  And the exit status should be "InvalidGitURI"
333
368
 
369
+
334
370
  Scenario: installing when there are sources with duplicate names defined in the same group
335
- Given I write to "Berksfile" with:
371
+ Given I have a Berksfile pointing at the local Berkshelf API with:
336
372
  """
337
- source "http://localhost:26210"
338
-
339
373
  cookbook 'berkshelf-cookbook-fixture'
340
374
  cookbook 'berkshelf-cookbook-fixture'
341
375
  """
@@ -346,11 +380,10 @@ Feature: install cookbooks from a Berksfile
346
380
  """
347
381
  And the exit status should be "DuplicateDependencyDefined"
348
382
 
383
+
349
384
  Scenario: when a Git demand points to a branch that does not satisfy the version constraint
350
- Given I write to "Berksfile" with:
385
+ Given I have a Berksfile pointing at the local Berkshelf API with:
351
386
  """
352
- source "http://localhost:26210"
353
-
354
387
  cookbook "berkshelf-cookbook-fixture", "1.0.0", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
355
388
  """
356
389
  When I run `berks install`
@@ -361,11 +394,10 @@ Feature: install cookbooks from a Berksfile
361
394
  """
362
395
  And the exit status should be "CookbookValidationFailure"
363
396
 
397
+
364
398
  Scenario: when a Git demand is defined and a cookbook of the same name and version is already in the cookbook store
365
- Given I write to "Berksfile" with:
399
+ Given I have a Berksfile pointing at the local Berkshelf API with:
366
400
  """
367
- source "http://localhost:26210"
368
-
369
401
  cookbook "berkshelf-cookbook-fixture", git: "git://github.com/RiotGames/berkshelf-cookbook-fixture.git", tag: "v1.0.0"
370
402
  """
371
403
  And the cookbook store has the cookbooks:
@@ -378,11 +410,10 @@ Feature: install cookbooks from a Berksfile
378
410
  Using berkshelf-cookbook-fixture (1.0.0) git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git' with branch: 'v1.0.0' at ref: 'b4f968c9001ad8de30f564a2107fab9cfa91f771'
379
411
  """
380
412
 
413
+
381
414
  Scenario: with a cookbook definition containing an invalid option
382
- Given I write to "Berksfile" with:
415
+ Given I have a Berksfile pointing at the local Berkshelf API with:
383
416
  """
384
- source "http://localhost:26210"
385
-
386
417
  cookbook "berkshelf-cookbook-fixture", whatisthis: "I don't even know", anotherwat: "isthat"
387
418
  """
388
419
  When I run `berks install`
@@ -392,11 +423,10 @@ Feature: install cookbooks from a Berksfile
392
423
  """
393
424
  And the exit status should be "InternalError"
394
425
 
426
+
395
427
  Scenario: with a git error during download
396
- Given I write to "Berksfile" with:
428
+ Given I have a Berksfile pointing at the local Berkshelf API with:
397
429
  """
398
- source "http://localhost:26210"
399
-
400
430
  cookbook 'berkshelf-cookbook-fixture', '1.0.0'
401
431
  cookbook "doesntexist", git: "git://github.com/asdjhfkljashflkjashfakljsf"
402
432
  """
@@ -407,3 +437,52 @@ Feature: install cookbooks from a Berksfile
407
437
  An error occurred during Git execution:
408
438
  """
409
439
  And the exit status should be "GitError"
440
+
441
+
442
+ Scenario: transitive dependencies in metadata
443
+ Given the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
444
+ | bacon | >= 0.0.0 |
445
+ And I have a Berksfile pointing at the local Berkshelf API with:
446
+ """
447
+ metadata
448
+ """
449
+ And I write to "metadata.rb" with:
450
+ """
451
+ depends 'fake', '1.0.0'
452
+ depends 'bacon', '0.2.0'
453
+ """
454
+ And the Chef Server has cookbooks:
455
+ | bacon | 0.1.0 |
456
+ | bacon | 0.2.0 |
457
+ | bacon | 1.0.0 |
458
+ And the Berkshelf API server's cache is up to date
459
+ When I successfully run `berks install`
460
+ Then the cookbook store should have the cookbooks:
461
+ | bacon | 0.2.0 |
462
+ Then the output should contain:
463
+ """
464
+ Installing bacon (0.2.0)
465
+ """
466
+
467
+
468
+ Scenario: transitive dependencies in metadata when cookbooks are downloaded
469
+ Given the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
470
+ | bacon | >= 0.0.0 |
471
+ And the cookbook store has the cookbooks:
472
+ | bacon | 1.0.0 |
473
+ | bacon | 0.3.0 |
474
+ | bacon | 0.2.0 |
475
+ And I have a Berksfile pointing at the local Berkshelf API with:
476
+ """
477
+ metadata
478
+ """
479
+ And I write to "metadata.rb" with:
480
+ """
481
+ depends 'fake', '1.0.0'
482
+ depends 'bacon', '0.2.0'
483
+ """
484
+ When I successfully run `berks install`
485
+ Then the output should contain:
486
+ """
487
+ Using bacon (0.2.0)
488
+ """