berkshelf 2.0.18 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. data/.ruby-version +1 -1
  2. data/.travis.yml +4 -1
  3. data/CHANGELOG.md +2 -26
  4. data/Gemfile +12 -2
  5. data/README.md +9 -1
  6. data/berkshelf.gemspec +9 -18
  7. data/bin/berks +3 -13
  8. data/features/apply_command.feature +11 -9
  9. data/features/berksfile.feature +8 -10
  10. data/features/config.feature +1 -2
  11. data/features/configure_command.feature +13 -14
  12. data/features/contingent_command.feature +13 -1
  13. data/features/cookbook_command.feature +2 -4
  14. data/features/groups_install.feature +10 -2
  15. data/features/help.feature +1 -1
  16. data/features/init_command.feature +5 -7
  17. data/features/install_command.feature +157 -228
  18. data/features/json_formatter.feature +27 -15
  19. data/features/licenses.feature +18 -12
  20. data/features/list_command.feature +6 -1
  21. data/features/lockfile.feature +116 -72
  22. data/features/outdated_command.feature +3 -47
  23. data/features/package_command.feature +10 -7
  24. data/features/shelf/show.feature +2 -2
  25. data/features/shelf/uninstall.feature +2 -2
  26. data/features/show_command.feature +10 -3
  27. data/features/step_definitions/chef/config_steps.rb +12 -0
  28. data/features/step_definitions/chef_server_steps.rb +16 -16
  29. data/features/step_definitions/cli_steps.rb +3 -79
  30. data/features/step_definitions/config_steps.rb +43 -0
  31. data/features/step_definitions/environment_steps.rb +7 -0
  32. data/features/step_definitions/filesystem_steps.rb +12 -57
  33. data/features/step_definitions/gem_steps.rb +1 -2
  34. data/features/step_definitions/json_steps.rb +3 -1
  35. data/features/step_definitions/lockfile_steps.rb +4 -0
  36. data/features/step_definitions/utility_steps.rb +0 -19
  37. data/features/support/aruba.rb +12 -0
  38. data/features/support/env.rb +52 -57
  39. data/features/update_command.feature +37 -23
  40. data/features/upload_command.feature +96 -160
  41. data/generator_files/Berksfile.erb +2 -1
  42. data/generator_files/Vagrantfile.erb +3 -0
  43. data/generator_files/default_test.rb.erb +1 -1
  44. data/generator_files/helpers.rb.erb +1 -1
  45. data/lib/berkshelf.rb +43 -24
  46. data/lib/berkshelf/api_client.rb +67 -0
  47. data/lib/berkshelf/api_client/remote_cookbook.rb +42 -0
  48. data/lib/berkshelf/berksfile.rb +232 -420
  49. data/lib/berkshelf/cached_cookbook.rb +22 -10
  50. data/lib/berkshelf/chef/config.rb +1 -0
  51. data/lib/berkshelf/cli.rb +66 -68
  52. data/lib/berkshelf/commands/shelf.rb +1 -1
  53. data/lib/berkshelf/community_rest.rb +10 -17
  54. data/lib/berkshelf/config.rb +23 -27
  55. data/lib/berkshelf/cookbook_generator.rb +3 -4
  56. data/lib/berkshelf/cookbook_store.rb +74 -17
  57. data/lib/berkshelf/core_ext/file.rb +2 -2
  58. data/lib/berkshelf/core_ext/pathname.rb +7 -5
  59. data/lib/berkshelf/{cookbook_source.rb → dependency.rb} +47 -67
  60. data/lib/berkshelf/downloader.rb +49 -106
  61. data/lib/berkshelf/errors.rb +64 -71
  62. data/lib/berkshelf/formatters.rb +11 -9
  63. data/lib/berkshelf/formatters/human_readable.rb +9 -9
  64. data/lib/berkshelf/formatters/json.rb +14 -4
  65. data/lib/berkshelf/init_generator.rb +3 -3
  66. data/lib/berkshelf/installer.rb +136 -0
  67. data/lib/berkshelf/location.rb +91 -131
  68. data/lib/berkshelf/locations/git_location.rb +9 -11
  69. data/lib/berkshelf/locations/github_location.rb +1 -1
  70. data/lib/berkshelf/locations/path_location.rb +10 -27
  71. data/lib/berkshelf/lockfile.rb +92 -70
  72. data/lib/berkshelf/logger.rb +4 -7
  73. data/lib/berkshelf/mixin/config.rb +21 -4
  74. data/lib/berkshelf/resolver.rb +60 -150
  75. data/lib/berkshelf/resolver/graph.rb +44 -0
  76. data/lib/berkshelf/source.rb +55 -0
  77. data/lib/berkshelf/source_uri.rb +38 -0
  78. data/lib/berkshelf/version.rb +1 -1
  79. data/spec/config/knife.rb +1 -1
  80. data/spec/fixtures/cassettes/Berkshelf_Resolver/_initialize/adds_the_dependencies_of_the_dependency_as_dependencies.yml +3694 -0
  81. data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +1 -1
  82. data/spec/fixtures/lockfiles/default.lock +1 -1
  83. data/spec/spec_helper.rb +20 -121
  84. data/spec/support/chef_api.rb +3 -4
  85. data/spec/support/chef_server.rb +20 -11
  86. data/spec/support/git.rb +127 -0
  87. data/spec/support/kitchen.rb +12 -0
  88. data/spec/support/path_helpers.rb +69 -0
  89. data/spec/unit/berkshelf/api_client/remote_cookbook_spec.rb +23 -0
  90. data/spec/unit/berkshelf/api_client_spec.rb +57 -0
  91. data/spec/unit/berkshelf/berksfile_spec.rb +206 -324
  92. data/spec/unit/berkshelf/cached_cookbook_spec.rb +73 -38
  93. data/spec/unit/berkshelf/community_rest_spec.rb +30 -71
  94. data/spec/unit/berkshelf/config_spec.rb +3 -14
  95. data/spec/unit/berkshelf/cookbook_generator_spec.rb +1 -2
  96. data/spec/unit/berkshelf/cookbook_store_spec.rb +12 -7
  97. data/spec/unit/berkshelf/dependency_spec.rb +285 -0
  98. data/spec/unit/berkshelf/downloader_spec.rb +4 -183
  99. data/spec/unit/berkshelf/formatters/null_spec.rb +1 -1
  100. data/spec/unit/berkshelf/formatters_spec.rb +4 -2
  101. data/spec/unit/berkshelf/git_spec.rb +15 -15
  102. data/spec/unit/berkshelf/installer_spec.rb +39 -0
  103. data/spec/unit/berkshelf/location_spec.rb +87 -114
  104. data/spec/unit/berkshelf/locations/git_location_spec.rb +41 -53
  105. data/spec/unit/berkshelf/locations/path_location_spec.rb +13 -23
  106. data/spec/unit/berkshelf/lockfile_spec.rb +38 -40
  107. data/spec/unit/berkshelf/resolver/graph_spec.rb +44 -0
  108. data/spec/unit/berkshelf/resolver_spec.rb +34 -83
  109. data/spec/unit/berkshelf/source_spec.rb +23 -0
  110. data/spec/unit/berkshelf/source_uri_spec.rb +29 -0
  111. metadata +149 -188
  112. checksums.yaml +0 -7
  113. data/features/default_locations.feature +0 -127
  114. data/features/step_definitions/berksfile_steps.rb +0 -8
  115. data/features/step_definitions/configure_cli_steps.rb +0 -19
  116. data/features/vendor_install.feature +0 -19
  117. data/lib/berkshelf/core_ext/openuri.rb +0 -36
  118. data/lib/berkshelf/core_ext/rbzip2.rb +0 -8
  119. data/lib/berkshelf/locations/chef_api_location.rb +0 -228
  120. data/lib/berkshelf/locations/site_location.rb +0 -92
  121. data/lib/berkshelf/test.rb +0 -35
  122. data/spec/knife.rb.sample +0 -12
  123. data/spec/support/test_generators.rb +0 -27
  124. data/spec/unit/berkshelf/cli_spec.rb +0 -16
  125. data/spec/unit/berkshelf/cookbook_source_spec.rb +0 -358
  126. data/spec/unit/berkshelf/core_ext/pathname_spec.rb +0 -46
  127. data/spec/unit/berkshelf/locations/chef_api_location_spec.rb +0 -139
  128. data/spec/unit/berkshelf/locations/site_location_spec.rb +0 -19
@@ -1 +1 @@
1
- 2.0.0-p247
1
+ 1.9.3-p429
@@ -8,7 +8,10 @@ notifications:
8
8
  - "irc.freenode.org#berkshelf"
9
9
  skip_join: true
10
10
  use_notice: true
11
+ bundler_args: --without guard
12
+ before_install:
13
+ - sudo apt-get install -qq libarchive12 libarchive-dev
11
14
  before_script:
12
15
  - git config --global user.email "ci@berkshelf.com"
13
16
  - git config --global user.name "Berkshelf"
14
- script: 'bundle exec thor spec:ci'
17
+ script: bundle exec thor spec:ci
@@ -1,30 +1,6 @@
1
- # 2.0.18
1
+ # 3.0.0
2
2
 
3
- * Fix issue with connecting to an HTTPS enabled community site
4
-
5
- # 2.0.17
6
-
7
- * Fix constraint on Hashie
8
-
9
- # 2.0.16
10
-
11
- * Update constraint on Ridley
12
-
13
- # 2.0.14
14
-
15
- * Backport changes from master to allow detecting cookbooks by metadata.json
16
-
17
- # 2.0.13
18
-
19
- * Lock transitive dependency on Faraday
20
-
21
- # 2.0.10
22
-
23
- * Huge performance increase when resolving a Berksfile when the Berkshelf contains a lot of cookbooks
24
-
25
- # 2.0.9
26
-
27
- * Update required version of Ridley
3
+ * New "universe" resolver which communicates with an API server to resolve constraint graphs faster and more reliably
28
4
 
29
5
  # 2.0.7
30
6
 
data/Gemfile CHANGED
@@ -2,8 +2,14 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- group :development do
6
- gem 'test-kitchen', '>= 1.0.0.alpha7'
5
+ group :guard do
6
+ gem 'coolline', '~> 0.4.2'
7
+ gem 'guard', '~> 1.8'
8
+ gem 'guard-cane'
9
+ gem 'guard-cucumber'
10
+ gem 'guard-rspec'
11
+ gem 'guard-spork'
12
+ gem 'guard-yard'
7
13
 
8
14
  require 'rbconfig'
9
15
 
@@ -25,3 +31,7 @@ group :development do
25
31
  gem 'win32console', require: false
26
32
  end
27
33
  end
34
+
35
+ group :test do
36
+ gem 'berkshelf-api', github: "RiotGames/berkshelf-api"
37
+ end
data/README.md CHANGED
@@ -23,6 +23,14 @@ Usage
23
23
  -----
24
24
  See [berkshelf.com](http://berkshelf.com) for up-to-date usage instructions.
25
25
 
26
+ Supported Platforms
27
+ -------------------
28
+ Berkshelf is tested on Ruby 1.9.3, 2.0.0, and JRuby 1.6+.
29
+
30
+ Ruby 1.9 mode is required on all interpreters.
31
+
32
+ Ruby 1.9.1 and 1.9.2 are not officially supported. If you encounter problems, please upgrade to Ruby 2.0 or 1.9.3.
33
+
26
34
  Bash Completion
27
35
  ---------------
28
36
  There is a [berkshelf bash completion script](https://raw.github.com/RiotGames/berkshelf/master/berkshelf-complete.sh). If you're using homebrew, you can install it like this:
@@ -60,7 +68,7 @@ You are encouraged to keep project-specific configuration in the `$PWD/.berkshel
60
68
  SSL Errors
61
69
  ----------
62
70
 
63
- If you have trouble getting Berkshelf to successfully talk to an SSL Chef server, you can try making sure you
71
+ If you have trouble getting Berkshelf to successfully talk to an SSL Chef Server, you can try making sure you
64
72
  have a certificate bundle available to your shell. `export SSL_CERT_FILE=...path/to/cert/file...`
65
73
 
66
74
  If you need to disable SSL, you can in `~/.berkshelf/config.json` like so:
@@ -27,21 +27,21 @@ Gem::Specification.new do |s|
27
27
  s.name = 'berkshelf'
28
28
  s.require_paths = ['lib']
29
29
  s.version = Berkshelf::VERSION
30
- s.required_ruby_version = '>= 1.9.1'
30
+ s.required_ruby_version = '>= 1.9.2'
31
31
  s.required_rubygems_version = '>= 1.8.0'
32
32
 
33
- s.add_dependency 'activesupport', '~> 3.2.0'
34
33
  s.add_dependency 'addressable', '~> 2.3.4'
34
+ s.add_dependency 'buff-config', '~> 0.1'
35
+ s.add_dependency 'buff-extensions', '~> 0.4'
35
36
  s.add_dependency 'buff-shell_out', '~> 0.1'
36
- s.add_dependency 'chozo', '>= 0.6.1'
37
- s.add_dependency 'hashie', '~> 2.0'
37
+ s.add_dependency 'celluloid', '>= 0.14.0'
38
+ s.add_dependency 'faraday', '>= 0.8.5'
39
+ s.add_dependency 'hashie', '>= 2.0.2'
38
40
  s.add_dependency 'minitar', '~> 0.5.4'
39
41
  s.add_dependency 'retryable', '~> 1.3.3'
40
- s.add_dependency 'ridley', '~> 1.7.0'
41
- s.add_dependency 'solve', '~> 0.8.2'
42
+ s.add_dependency 'ridley', '~> 1.3.0'
43
+ s.add_dependency 'solve', '>= 0.5.0'
42
44
  s.add_dependency 'thor', '~> 0.18.0'
43
- s.add_dependency 'rbzip2', '~> 0.2.0'
44
- s.add_dependency 'faraday', '~> 0.8.5' # lock tranisitive dependency of Ridley
45
45
 
46
46
  s.add_development_dependency 'aruba', '~> 0.5'
47
47
  s.add_development_dependency 'cane', '~> 2.5'
@@ -49,18 +49,9 @@ Gem::Specification.new do |s|
49
49
  s.add_development_dependency 'fuubar', '~> 1.1'
50
50
  s.add_development_dependency 'rake', '~> 0.9'
51
51
  s.add_development_dependency 'rspec', '~> 2.13'
52
- s.add_development_dependency 'simplecov', '~> 0.7'
53
52
  s.add_development_dependency 'spork', '~> 0.9'
53
+ s.add_development_dependency 'test-kitchen', '>= 1.0.0.alpha7'
54
54
  s.add_development_dependency 'vcr', '~> 2.4'
55
55
  s.add_development_dependency 'webmock', '~> 1.11'
56
56
  s.add_development_dependency 'yard', '~> 0.8'
57
-
58
- # Guard extensions for development
59
- s.add_development_dependency 'coolline', '~> 0.4.2' # readline for guard on MRI
60
- s.add_development_dependency 'guard', '~> 1.8'
61
- s.add_development_dependency 'guard-cane'
62
- s.add_development_dependency 'guard-cucumber'
63
- s.add_development_dependency 'guard-rspec'
64
- s.add_development_dependency 'guard-spork'
65
- s.add_development_dependency 'guard-yard'
66
57
  end
data/bin/berks CHANGED
@@ -1,15 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- $:.push File.expand_path("../../lib", __FILE__)
3
- require 'berkshelf'
2
+ $:.push File.expand_path('../../lib', __FILE__)
3
+ require 'berkshelf/cli'
4
4
 
5
- begin
6
- Berkshelf::Cli.start
7
- rescue Berkshelf::BerkshelfError => e
8
- Berkshelf.ui.error e
9
- Berkshelf.ui.error "\t" + e.backtrace.join("\n\t") if ENV['BERKSHELF_DEBUG']
10
- exit e.status_code
11
- rescue Ridley::Errors::RidleyError => e
12
- Berkshelf.ui.error "#{e.class} #{e}"
13
- Berkshelf.ui.error "\t" + e.backtrace.join("\n\t") if ENV['BERKSHELF_DEBUG']
14
- exit 47
15
- end
5
+ Berkshelf::Cli::Runner.new(ARGV.dup).execute!
@@ -3,36 +3,38 @@ Feature: Applying cookbook versions to a Chef Environment
3
3
  I want to push my berks resolved cookbook versions to my environment
4
4
  So that I can avoid manual configuration of my environments
5
5
 
6
- @chef_server
7
6
  Scenario: Locking a cookbook version with dependencies
8
7
  Given the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
9
8
  | dependency | 2.0.0 |
10
9
  And the cookbook store has the cookbooks:
11
10
  | dependency | 2.0.0 |
12
- And I have an environment named "berkshelf_lock_test"
11
+ And The Chef Server has an environment named "berkshelf_lock_test"
13
12
  And I write to "Berksfile" with:
14
13
  """
14
+ source "http://localhost:26210"
15
+
15
16
  cookbook 'fake', '1.0.0'
16
17
  """
17
18
  When I successfully run `berks apply berkshelf_lock_test`
18
- Then the version locks in "berkshelf_lock_test" should be:
19
+ Then the version locks in the "berkshelf_lock_test" environment should be:
19
20
  | cookbook | version_lock |
20
- | fake | = 1.0.0 |
21
- | dependency | = 2.0.0 |
21
+ | fake | 1.0.0 |
22
+ | dependency | 2.0.0 |
22
23
  And the exit status should be 0
23
24
 
24
- @chef_server
25
25
  Scenario: Locking cookbook versions to a non-existent Chef Environment
26
- Given I do not have an environment named "berkshelf_lock_test"
26
+ Given The Chef Server does not have an environment named "berkshelf_lock_test"
27
27
  And the cookbook store has the cookbooks:
28
28
  | fake | 1.0.0 |
29
29
  And I write to "Berksfile" with:
30
30
  """
31
+ source "http://localhost:26210"
32
+
31
33
  cookbook 'fake', '1.0.0'
32
34
  """
33
- When I run the apply command on "berkshelf_lock_test"
35
+ When I run `berks apply berkshelf_lock_test`
34
36
  Then the output should contain:
35
37
  """
36
38
  The environment 'berkshelf_lock_test' does not exist
37
39
  """
38
- And the CLI should exit with the status code for error "EnvironmentNotFound"
40
+ And the exit status should be "EnvironmentNotFound"
@@ -6,6 +6,8 @@ Feature: Evaluating a Berksfile
6
6
  Scenario: Containing pure Ruby
7
7
  Given I write to "Berksfile" with:
8
8
  """
9
+ source "http://localhost:26210"
10
+
9
11
  if ENV['BACON']
10
12
  puts "If you don't got bacon..."
11
13
  else
@@ -18,19 +20,12 @@ Feature: Evaluating a Berksfile
18
20
  """
19
21
  If you don't got bacon...
20
22
  """
21
- And the exit status should be 0
22
-
23
- Scenario: Calling valid DSL methods:
24
- Given I write to "Berksfile" with:
25
- """
26
- site :opscode
27
- """
28
- When I successfully run `berks install`
29
- And the exit status should be 0
30
23
 
31
24
  Scenario: Containing methods I shouldn't be able to call
32
25
  Given I write to "Berksfile" with:
33
26
  """
27
+ source "http://localhost:26210"
28
+
34
29
  add_location(:foo)
35
30
  """
36
31
  When I run `berks install`
@@ -40,11 +35,13 @@ Feature: Evaluating a Berksfile
40
35
 
41
36
  undefined method `add_location' for
42
37
  """
43
- And the CLI should exit with the status code for error "BerksfileReadError"
38
+ And the exit status should be "BerksfileReadError"
44
39
 
45
40
  Scenario: Containing Ruby syntax errors
46
41
  Given I write to "Berksfile" with:
47
42
  """
43
+ source "http://localhost:26210"
44
+
48
45
  ptus "This is a ruby syntax error"
49
46
  """
50
47
  When I run `berks install`
@@ -54,3 +51,4 @@ Feature: Evaluating a Berksfile
54
51
 
55
52
  undefined method `ptus' for
56
53
  """
54
+ And the exit status should be "BerksfileReadError"
@@ -4,7 +4,6 @@ Feature: Reading a Berkshelf configuration file
4
4
  So that I don't have to spend time modifying the default generated output each time
5
5
 
6
6
  Scenario: Missing a Berkshelf configuration file
7
- Given I do not have a Berkshelf config file
8
7
  When I successfully run `berks cookbook sparkle_motion`
9
8
  Then the resulting "sparkle_motion" Vagrantfile should contain:
10
9
  | config.vm.box = "Berkshelf-CentOS-6.3-x86_64-minimal" |
@@ -71,7 +70,7 @@ Feature: Reading a Berkshelf configuration file
71
70
  When I run `berks cookbook sparkle_motion`
72
71
  Then the output should contain "Invalid configuration"
73
72
  And the output should contain "vagrant.vm.box Expected attribute: 'vagrant.vm.box' to be a type of: 'String'"
74
- And the CLI should exit with the status code for error "InvalidConfiguration"
73
+ And the exit status should be "InvalidConfiguration"
75
74
 
76
75
  Scenario: Using a Berkshelf configuration file with Chef configuration information
77
76
  Given I have a Berkshelf config file containing:
@@ -1,10 +1,13 @@
1
+ @spawn
1
2
  Feature: Configuring Berkshelf via the command line
2
3
  As CLI user of Berkshelf
3
4
  I want a command to generate a Berkshelf configuration file based on my input
4
5
  So I can quickly get up and running with the least amount of resistance
5
6
 
7
+ Background:
8
+ Given I do not have a Berkshelf config
9
+
6
10
  Scenario: Using custom values
7
- Given I do not have a Berkshelf config file
8
11
  When I run `berks configure` interactively
9
12
  And I type "https://api.opscode.com/organizations/vialstudios"
10
13
  And I type "node_name"
@@ -17,7 +20,6 @@ Feature: Configuring Berkshelf via the command line
17
20
  """
18
21
  Config written to:
19
22
  """
20
- And the exit status should be 0
21
23
  And a Berkshelf config file should exist and contain:
22
24
  | chef.chef_server_url | https://api.opscode.com/organizations/vialstudios |
23
25
  | chef.validation_client_name | reset |
@@ -26,10 +28,10 @@ Feature: Configuring Berkshelf via the command line
26
28
  | chef.validation_key_path | /Users/reset/.chef/reset.pem |
27
29
  | vagrant.vm.box | Berkshelf-minimal |
28
30
  | vagrant.vm.box_url | https://dl.dropbox.com/Berkshelf.box |
31
+ And the exit status should be 0
29
32
 
30
33
  Scenario: Accepting the default values
31
- Given I do not have a Berkshelf config file
32
- And I have a default Chef config
34
+ Given I do not have a Chef config
33
35
  When I run `berks configure` interactively
34
36
  And I type ""
35
37
  And I type ""
@@ -42,7 +44,6 @@ Feature: Configuring Berkshelf via the command line
42
44
  """
43
45
  Config written to:
44
46
  """
45
- And the exit status should be 0
46
47
  And a Berkshelf config file should exist and contain:
47
48
  | chef.chef_server_url | http://localhost:4000 |
48
49
  | chef.validation_client_name | chef-validator |
@@ -50,19 +51,19 @@ Feature: Configuring Berkshelf via the command line
50
51
  | chef.validation_key_path | /etc/chef/validation.pem |
51
52
  | vagrant.vm.box | Berkshelf-CentOS-6.3-x86_64-minimal |
52
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
53
55
 
54
56
  Scenario: Creating a Berkshelf configuration file when one already exists
55
- Given I have a default Berkshelf config file
56
- When I run `berks configure` interactively
57
+ Given I already have a Berkshelf config file
58
+ When I run `berks configure`
57
59
  Then the output should contain:
58
60
  """
59
61
  A configuration file already exists. Re-run with the --force flag if you wish to overwrite it.
60
62
  """
61
- And the CLI should exit with the status code for error "ConfigExists"
63
+ And the exit status should be "ConfigExists"
62
64
 
63
65
  Scenario Outline: Using the --path option
64
- Given I do not have a Berkshelf config file at "<path>"
65
- When I run the "configure --path <path>" command interactively
66
+ When I run `berks configure --path <path>` interactively
66
67
  And I type "https://api.opscode.com/organizations/vialstudios"
67
68
  And I type "node_name"
68
69
  And I type "client_key"
@@ -74,7 +75,6 @@ Feature: Configuring Berkshelf via the command line
74
75
  """
75
76
  Config written to:
76
77
  """
77
- And the exit status should be 0
78
78
  And a Berkshelf config file should exist at "<path>" and contain:
79
79
  | chef.chef_server_url | https://api.opscode.com/organizations/vialstudios |
80
80
  | chef.validation_client_name | reset |
@@ -83,10 +83,9 @@ Feature: Configuring Berkshelf via the command line
83
83
  | chef.validation_key_path | /Users/reset/.chef/reset.pem |
84
84
  | vagrant.vm.box | Berkshelf-minimal |
85
85
  | vagrant.vm.box_url | https://dl.dropbox.com/Berkshelf.box |
86
+ And the exit status should be 0
86
87
 
87
88
  Examples:
88
- | path |
89
+ | path |
89
90
  | .berkshelf/config.json |
90
91
  | berkshelf/config.json |
91
- | berkshelf-config.json |
92
- | config.json |
@@ -3,6 +3,11 @@ Feature: Running the contingent command
3
3
  I want a way to the cookbooks that depend on another
4
4
  So that I can better understand my infrastructure
5
5
 
6
+ Background:
7
+ Given the Berkshelf API server's cache is empty
8
+ And the Chef Server is empty
9
+ And the cookbook store is empty
10
+
6
11
  Scenario: When there are dependent cookbooks
7
12
  Given the cookbook store has the cookbooks:
8
13
  | dep | 1.0.0 |
@@ -12,6 +17,8 @@ Feature: Running the contingent command
12
17
  | dep | ~> 1.0.0 |
13
18
  And I write to "Berksfile" with:
14
19
  """
20
+ source "http://localhost:26210"
21
+
15
22
  cookbook 'fake', '1.0.0'
16
23
  cookbook 'ekaf', '1.0.0'
17
24
  """
@@ -29,6 +36,8 @@ Feature: Running the contingent command
29
36
  | fake | 1.0.0 |
30
37
  And I write to "Berksfile" with:
31
38
  """
39
+ source "http://localhost:26210"
40
+
32
41
  cookbook 'fake', '1.0.0'
33
42
  """
34
43
  And I successfully run `berks contingent dep`
@@ -39,7 +48,10 @@ Feature: Running the contingent command
39
48
  And the exit status should be 0
40
49
 
41
50
  Scenario: When the cookbook is not in the Berksfile
42
- Given an empty file named "Berksfile"
51
+ Given I write to "Berksfile" with:
52
+ """
53
+ source "http://localhost:26210"
54
+ """
43
55
  And I successfully run `berks contingent dep`
44
56
  Then the output should contain:
45
57
  """
@@ -9,8 +9,7 @@ Feature: Creating a new cookbook
9
9
  And the exit status should be 0
10
10
 
11
11
  Scenario Outline: With various options
12
- When I run the cookbook command to create "sparkle_motion" with options:
13
- | --<option> |
12
+ When I successfully run `berks cookbook sparkle_motion --<option>`
14
13
  Then I should have a new cookbook skeleton "sparkle_motion" with <feature> support
15
14
  And the exit status should be 0
16
15
 
@@ -28,8 +27,7 @@ Feature: Creating a new cookbook
28
27
 
29
28
  Scenario Outline: When a required supporting gem is not installed
30
29
  Given the gem "<gem>" is not installed
31
- When I run the cookbook command to create "sparkle_motion" with options:
32
- | --<option> |
30
+ When I successfully run `berks cookbook sparkle_motion --<option>`
33
31
  Then I should have a new cookbook skeleton "sparkle_motion" with <feature> support
34
32
  And the output should contain a warning to suggest supporting the option "<option>" by installing "<gem>"
35
33
  And the exit status should be 0
@@ -9,6 +9,8 @@ Feature: Installing specific groups
9
9
  | takeme | 1.0.0 |
10
10
  Given I write to "Berksfile" with:
11
11
  """
12
+ source "http://localhost:26210"
13
+
12
14
  group :notme do
13
15
  cookbook 'notme', '1.0.0'
14
16
  end
@@ -34,6 +36,8 @@ Feature: Installing specific groups
34
36
  | takeme | 1.0.0 |
35
37
  Given I write to "Berksfile" with:
36
38
  """
39
+ source "http://localhost:26210"
40
+
37
41
  group :notme do
38
42
  cookbook 'notme', '1.0.0'
39
43
  end
@@ -47,7 +51,7 @@ Feature: Installing specific groups
47
51
  And I write to "Berksfile.lock" with:
48
52
  """
49
53
  {
50
- "sources": {
54
+ "dependencies": {
51
55
  "notme": { "locked_version": "1.0.0"},
52
56
  "takeme": { "locked_version": "1.0.0"},
53
57
  "default": { "locked_version": "1.0.0"}
@@ -68,6 +72,8 @@ Feature: Installing specific groups
68
72
  | takeme | 1.0.0 |
69
73
  Given I write to "Berksfile" with:
70
74
  """
75
+ source "http://localhost:26210"
76
+
71
77
  group :notme do
72
78
  cookbook 'notme', '1.0.0'
73
79
  end
@@ -87,6 +93,8 @@ Feature: Installing specific groups
87
93
  Scenario: Attempting to provide an only and except option
88
94
  Given I write to "Berksfile" with:
89
95
  """
96
+ source "http://localhost:26210"
97
+
90
98
  group :notme do
91
99
  cookbook 'nginx', '= 0.101.2'
92
100
  end
@@ -102,4 +110,4 @@ Feature: Installing specific groups
102
110
  """
103
111
  Cannot specify both :except and :only
104
112
  """
105
- And the CLI should exit with the status code for error "ArgumentError"
113
+ And the exit status should be "ArgumentError"