berkshelf 3.0.0.beta7 → 3.0.0.beta8

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 +1 -0
  3. data/.travis.yml +4 -1
  4. data/CONTRIBUTING.md +1 -1
  5. data/Gemfile +0 -1
  6. data/Guardfile +0 -8
  7. data/README.md +33 -13
  8. data/berkshelf.gemspec +3 -3
  9. data/features/commands/install.feature +16 -88
  10. data/features/commands/search.feature +15 -0
  11. data/features/commands/shelf/show.feature +2 -2
  12. data/features/commands/shelf/uninstall.feature +1 -1
  13. data/features/commands/show.feature +3 -3
  14. data/features/commands/update.feature +29 -1
  15. data/features/commands/upload.feature +172 -7
  16. data/features/commands/vendor.feature +32 -0
  17. data/features/json_formatter.feature +26 -24
  18. data/features/lifecycle.feature +285 -0
  19. data/features/lockfile.feature +9 -7
  20. data/features/step_definitions/chef_server_steps.rb +1 -0
  21. data/features/step_definitions/cli_steps.rb +2 -2
  22. data/features/step_definitions/filesystem_steps.rb +2 -4
  23. data/gem_graph.png +0 -0
  24. data/generator_files/chefignore +0 -2
  25. data/lib/berkshelf.rb +39 -14
  26. data/lib/berkshelf/berksfile.rb +161 -113
  27. data/lib/berkshelf/cached_cookbook.rb +2 -2
  28. data/lib/berkshelf/cli.rb +15 -3
  29. data/lib/berkshelf/commands/shelf.rb +3 -7
  30. data/lib/berkshelf/community_rest.rb +9 -9
  31. data/lib/berkshelf/config.rb +3 -3
  32. data/lib/berkshelf/cookbook_generator.rb +0 -8
  33. data/lib/berkshelf/cookbook_store.rb +1 -2
  34. data/lib/berkshelf/dependency.rb +25 -138
  35. data/lib/berkshelf/downloader.rb +41 -7
  36. data/lib/berkshelf/errors.rb +113 -214
  37. data/lib/berkshelf/formatters/base.rb +42 -0
  38. data/lib/berkshelf/formatters/human.rb +145 -0
  39. data/lib/berkshelf/formatters/json.rb +149 -133
  40. data/lib/berkshelf/formatters/null.rb +8 -18
  41. data/lib/berkshelf/init_generator.rb +1 -1
  42. data/lib/berkshelf/installer.rb +115 -104
  43. data/lib/berkshelf/location.rb +22 -121
  44. data/lib/berkshelf/locations/base.rb +75 -0
  45. data/lib/berkshelf/locations/git.rb +196 -0
  46. data/lib/berkshelf/locations/github.rb +8 -0
  47. data/lib/berkshelf/locations/path.rb +78 -0
  48. data/lib/berkshelf/lockfile.rb +452 -290
  49. data/lib/berkshelf/logger.rb +9 -3
  50. data/lib/berkshelf/mixin/logging.rb +4 -9
  51. data/lib/berkshelf/resolver.rb +12 -12
  52. data/lib/berkshelf/source.rb +13 -1
  53. data/lib/berkshelf/version.rb +1 -1
  54. data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -7
  55. data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -6
  56. data/spec/spec_helper.rb +5 -6
  57. data/spec/support/matchers/file_system_matchers.rb +4 -0
  58. data/spec/support/shared_examples/formatter.rb +11 -0
  59. data/spec/unit/berkshelf/berksfile_spec.rb +25 -28
  60. data/spec/unit/berkshelf/cli_spec.rb +19 -11
  61. data/spec/unit/berkshelf/dependency_spec.rb +4 -164
  62. data/spec/unit/berkshelf/formatters/base_spec.rb +35 -0
  63. data/spec/unit/berkshelf/formatters/human_spec.rb +7 -0
  64. data/spec/unit/berkshelf/formatters/json_spec.rb +7 -0
  65. data/spec/unit/berkshelf/formatters/null_spec.rb +7 -11
  66. data/spec/unit/berkshelf/location_spec.rb +16 -144
  67. data/spec/unit/berkshelf/locations/base_spec.rb +80 -0
  68. data/spec/unit/berkshelf/locations/git_spec.rb +249 -0
  69. data/spec/unit/berkshelf/locations/path_spec.rb +107 -0
  70. data/spec/unit/berkshelf/lockfile_parser_spec.rb +3 -3
  71. data/spec/unit/berkshelf/lockfile_spec.rb +55 -11
  72. data/spec/unit/berkshelf/logger_spec.rb +2 -2
  73. data/spec/unit/berkshelf/mixin/logging_spec.rb +5 -9
  74. data/spec/unit/berkshelf/source_spec.rb +32 -13
  75. data/spec/unit/berkshelf_spec.rb +6 -9
  76. metadata +33 -33
  77. data/.ruby-version +0 -1
  78. data/berkshelf-complete.sh +0 -75
  79. data/lib/berkshelf/formatters.rb +0 -110
  80. data/lib/berkshelf/formatters/human_readable.rb +0 -142
  81. data/lib/berkshelf/git.rb +0 -204
  82. data/lib/berkshelf/locations/git_location.rb +0 -135
  83. data/lib/berkshelf/locations/github_location.rb +0 -55
  84. data/lib/berkshelf/locations/mercurial_location.rb +0 -114
  85. data/lib/berkshelf/locations/path_location.rb +0 -88
  86. data/lib/berkshelf/mercurial.rb +0 -146
  87. data/lib/berkshelf/mixin.rb +0 -7
  88. data/spec/support/mercurial.rb +0 -123
  89. data/spec/unit/berkshelf/formatters_spec.rb +0 -114
  90. data/spec/unit/berkshelf/git_spec.rb +0 -312
  91. data/spec/unit/berkshelf/locations/git_location_spec.rb +0 -126
  92. data/spec/unit/berkshelf/locations/mercurial_location_spec.rb +0 -131
  93. data/spec/unit/berkshelf/locations/path_location_spec.rb +0 -25
  94. data/spec/unit/berkshelf/mercurial_spec.rb +0 -172
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 093e4db16726fd19aa0f3851481f7f4223e8ddc5
4
- data.tar.gz: 66efef230a148c0ac4a68db77a16722cce697b4c
3
+ metadata.gz: 34864a59cc163f2f46a8f0ff67ea71d60d013066
4
+ data.tar.gz: f9a55cfc84edeaf87736756035490331c6d22b1b
5
5
  SHA512:
6
- metadata.gz: 7604553987f1fd224a37128cf05d189873f96bcc4d96f1c4cee0e2ee9a45beeb5eefe8095012adfb1696c429e559fd16a58946ed8232f5310a9da428f414f447
7
- data.tar.gz: 62e0a0d8b2df6393da22d846e857389b1b4e003dcb1f1d60c84d1011e878bd8732277e1ba715f09f694c64e2380d95975f25265daf1edbe05ea0d26d8af70f2e
6
+ metadata.gz: 905e8267b648a21fb101f48a948660a8297763257c785177553720df1e02af1611d549d5cf0b3a73c66386baeb6101c0dd7e585296283762ddf2c1747b37c58e
7
+ data.tar.gz: 7af8c5176a2dc388730f0ce8b6c99d53fced510224fcd370b21aea9e58715cd8bd09bc0539ee87769aba095eaaf8d455bb5b77d620393442a42e1bc58b4f35ab
data/.gitignore CHANGED
@@ -25,3 +25,4 @@ rerun.txt
25
25
  .rspec
26
26
  .kitchen
27
27
  vendor/ruby
28
+ .ruby-version
data/.travis.yml CHANGED
@@ -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
11
+ branches:
12
+ only:
13
+ - master
14
+ bundler_args: --without guard --jobs 7
12
15
  before_install:
13
16
  - sudo apt-get install -qq libarchive12 libarchive-dev
14
17
  before_script:
data/CONTRIBUTING.md CHANGED
@@ -17,7 +17,7 @@ If you'd like to submit a patch:
17
17
 
18
18
  ### Install prerequisites
19
19
 
20
- Install git and mercurial on your test system. (http://mercurial.selenic.com/wiki/Download)
20
+ Install git on your test system.
21
21
 
22
22
  Install the latest version of [Bundler](http://gembundler.com)
23
23
 
data/Gemfile CHANGED
@@ -8,7 +8,6 @@ group :guard do
8
8
  gem 'guard-cucumber'
9
9
  gem 'guard-rspec'
10
10
  gem 'guard-spork'
11
- gem 'guard-yard'
12
11
 
13
12
  require 'rbconfig'
14
13
 
data/Guardfile CHANGED
@@ -4,14 +4,6 @@ guard 'spork' do
4
4
  watch(%r{^features/support/}) { :cucumber }
5
5
  end
6
6
 
7
- unless RUBY_PLATFORM =~ /mswin|mingw|windows/
8
- guard 'yard', stdout: '/dev/null', stderr: '/dev/null' do
9
- watch(%r{app/.+\.rb})
10
- watch(%r{lib/.+\.rb})
11
- watch(%r{ext/.+\.c})
12
- end
13
- end
14
-
15
7
  rspec_cli = '--color --drb --format Fuubar'
16
8
  rspec_cli += ' --tag ~@api_client --tag ~@not_supported_on_windows' if RUBY_PLATFORM =~ /mswin|mingw|windows/
17
9
  guard 'rspec', cli: rspec_cli, all_on_start: false, all_after_pass: false do
data/README.md CHANGED
@@ -32,19 +32,10 @@ Ruby 1.9 mode is required on all interpreters.
32
32
 
33
33
  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.
34
34
 
35
- Bash Completion
36
- ---------------
37
- There is a [berkshelf bash completion script](https://raw.github.com/berkshelf/berkshelf/master/berkshelf-complete.sh). If you're using homebrew, you can install it like this:
38
-
39
- brew install bash-completion # if you haven't already
40
-
41
- Download the latest script
42
-
43
- (cd `brew --prefix`/etc/bash_completion.d && curl https://raw.github.com/berkshelf/berkshelf/master/berkshelf-complete.sh > berkshelf-complete.sh)
44
-
45
- And make sure you have this in your bash/zsh profile:
46
-
47
- [ -f `brew --prefix`/etc/bash_completion ] && source `brew --prefix`/etc/bash_completion
35
+ Shell Completion
36
+ ----------------
37
+ - [Bash](https://github.com/berkshelf/berkshelf-bash-plugin)
38
+ - [ZSH](https://github.com/berkshelf/berkshelf-zsh-plugin)
48
39
 
49
40
  Plugins
50
41
  -------
@@ -64,6 +55,35 @@ $PWD/config.json
64
55
 
65
56
  You are encouraged to keep project-specific configuration in the `$PWD/.berkshelf` directory. A default configuration file is generated for you, but you can update the values to suit your needs.
66
57
 
58
+ Github Cookbooks
59
+ ----------------
60
+ With Berkshelf 3 you can query a Berkshelf-API server (a server which indexes cookbooks from various sources and
61
+ hosts it over a REST API) in order to resolve the cookbook dependencies. When you choose to host your own Berkshelf-API
62
+ server, you can configure it to also index cookbooks hosted in various Github and/or Github Enterprise organizations.
63
+
64
+ When doing so you should also configure Berkshelf so it can download cookbooks from your indexed Github organizations:
65
+
66
+ ```
67
+ {
68
+ "github":[
69
+ {
70
+ "access_token": ""
71
+ },
72
+ {
73
+ "access_token": "",
74
+ "api_endpoint": "https://github.enterprise.local/api/v3",
75
+ "web_endpoint": "https://github.enterprise.local",
76
+ "ssl_verify": true
77
+ }
78
+ ]
79
+ }
80
+ ```
81
+
82
+ The first subsection is used for any organization hosted on github.com. As this is the default, you do not have to set the
83
+ endpoint info (these are known values for github.com). The second subsection is used when you also index cookbooks from
84
+ organizations hosted on Github Enterprise. In this case you will need to specify the specific endpoint info so Berkshelf
85
+ knows where to connect to. You can add as many subsections as you have endpoints.
86
+
67
87
  SSL Errors
68
88
  ----------
69
89
 
data/berkshelf.gemspec CHANGED
@@ -31,14 +31,14 @@ Gem::Specification.new do |s|
31
31
  s.required_rubygems_version = '>= 1.8.0'
32
32
 
33
33
  s.add_dependency 'addressable', '~> 2.3.4'
34
- s.add_dependency 'berkshelf-api-client', '~> 1.1'
34
+ s.add_dependency 'berkshelf-api-client', '~> 1.2.0.rc2'
35
35
  s.add_dependency 'buff-config', '~> 0.2'
36
36
  s.add_dependency 'buff-extensions', '~> 0.4'
37
37
  s.add_dependency 'buff-shell_out', '~> 0.1'
38
- s.add_dependency 'faraday', '~> 0.8.5'
38
+ s.add_dependency 'faraday', '~> 0.9.0'
39
39
  s.add_dependency 'minitar', '~> 0.5.4'
40
40
  s.add_dependency 'retryable', '~> 1.3.3'
41
- s.add_dependency 'ridley', '~> 2.3'
41
+ s.add_dependency 'ridley', '~> 3.0.0.rc1'
42
42
  s.add_dependency 'solve', '>= 0.8.0'
43
43
  s.add_dependency 'thor', '~> 0.18.0'
44
44
  s.add_dependency 'octokit', '~> 2.6'
@@ -66,12 +66,14 @@ Feature: berks install
66
66
  Scenario: installing a demand that has already been installed
67
67
  Given I have a Berksfile pointing at the local Berkshelf API with:
68
68
  """
69
- cookbook 'berkshelf-cookbook-fixture', github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'deps'
69
+ cookbook 'berkshelf-cookbook-fixture',
70
+ github: 'RiotGames/berkshelf-cookbook-fixture',
71
+ branch: 'deps'
70
72
  """
71
73
  And the cookbook store contains a cookbook "berkshelf" "1.0.0" with dependencies:
72
- | hostsfile | = 1.0.1 |
74
+ | hostsfile | = 1.0.1 |
73
75
  And the cookbook store has the cookbooks:
74
- | hostsfile | 1.0.1 |
76
+ | hostsfile | 1.0.1 |
75
77
  And the Berkshelf API server's cache is up to date
76
78
  When I successfully run `berks install`
77
79
  Then the output should contain:
@@ -170,7 +172,6 @@ Feature: berks install
170
172
 
171
173
  Scenario: installing a demand from a path location locks the graph to that version
172
174
  Given the Chef Server has cookbooks:
173
- # | example_cookbook | 1.0.0 | |
174
175
  | other_cookbook | 1.0.0 | example_cookbook ~> 1.0.0 |
175
176
  And I have a Berksfile pointing at the local Berkshelf API with:
176
177
  """
@@ -226,7 +227,10 @@ Feature: berks install
226
227
  Scenario: installing a Berksfile that contains a Git location with a rel
227
228
  Given I have a Berksfile pointing at the local Berkshelf API with:
228
229
  """
229
- cookbook "berkshelf-cookbook-fixture", github: 'RiotGames/berkshelf-cookbook-fixture', branch: 'rel', rel: 'cookbooks/berkshelf-cookbook-fixture'
230
+ cookbook 'berkshelf-cookbook-fixture',
231
+ github: 'RiotGames/berkshelf-cookbook-fixture',
232
+ branch: 'rel',
233
+ rel: 'cookbooks/berkshelf-cookbook-fixture'
230
234
  """
231
235
  When I successfully run `berks install`
232
236
  Then the cookbook store should have the git cookbooks:
@@ -298,22 +302,10 @@ Feature: berks install
298
302
  Using berkshelf-cookbook-fixture (0.2.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
299
303
  """
300
304
 
301
- Scenario: installing a Berksfile that contains a GitHub location ending in .git
302
- Given I have a Berksfile pointing at the local Berkshelf API with:
303
- """
304
- cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture.git", tag: "v0.2.0"
305
- """
306
- When I run `berks install`
307
- Then the output should contain:
308
- """
309
- 'RiotGames/berkshelf-cookbook-fixture.git' is not a valid GitHub identifier - should not end in '.git'
310
- """
311
- And the exit status should be "InvalidGitHubIdentifier"
312
-
313
- Scenario: installing a Berksfile that contains a Github location and protocol git
305
+ Scenario: installing a Berksfile that contains a GitHub location
314
306
  Given I have a Berksfile pointing at the local Berkshelf API with:
315
307
  """
316
- cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "git"
308
+ cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0"
317
309
  """
318
310
  When I successfully run `berks install`
319
311
  Then the cookbook store should have the git cookbooks:
@@ -325,47 +317,6 @@ Feature: berks install
325
317
  Using berkshelf-cookbook-fixture (0.2.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
326
318
  """
327
319
 
328
- Scenario: installing a Berksfile that contains a Github location and protocol https
329
- Given I have a Berksfile pointing at the local Berkshelf API with:
330
- """
331
- cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "https"
332
- """
333
- When I successfully run `berks install`
334
- Then the cookbook store should have the git cookbooks:
335
- | berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
336
- And the output should contain:
337
- """
338
- Fetching 'berkshelf-cookbook-fixture' from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
339
- Fetching cookbook index from http://0.0.0.0:26210...
340
- Using berkshelf-cookbook-fixture (0.2.0) from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
341
- """
342
-
343
- # GitHub doesn't permit anonymous SSH access, so we are going to get a
344
- # failure message back. That's okay, if GitHub tells us our key was denied,
345
- # we know the connection has made it that far.
346
- Scenario: installing a Berksfile that contains a Github location and protocol ssh
347
- Given I have a Berksfile pointing at the local Berkshelf API with:
348
- """
349
- cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "ssh"
350
- """
351
- When I run `berks install`
352
- Then the output should contain:
353
- """
354
- Permission denied (publickey).
355
- """
356
-
357
- Scenario: installing a Berksfile that contains a Github location and an unsupported protocol
358
- Given I have a Berksfile pointing at the local Berkshelf API with:
359
- """
360
- cookbook "berkshelf-cookbook-fixture", github: "RiotGames/berkshelf-cookbook-fixture", tag: "v0.2.0", protocol: "somethingabsurd"
361
- """
362
- When I run `berks install`
363
- Then the output should contain:
364
- """
365
- 'somethingabsurd' is not supported for the 'github' location key - please use 'git' instead
366
- """
367
- And the exit status should be "InvalidGitURI"
368
-
369
320
  Scenario: running install when current project is a cookbook and the 'metadata' is specified
370
321
  Given a cookbook named "sparkle_motion"
371
322
  And I cd to "sparkle_motion"
@@ -438,18 +389,6 @@ Feature: berks install
438
389
  """
439
390
  And the exit status should be "NoSolutionError"
440
391
 
441
- Scenario: installing a Berksfile that has a Git location source with an invalid Git URI
442
- Given I have a Berksfile pointing at the local Berkshelf API with:
443
- """
444
- cookbook 'nginx', git: '/something/on/disk'
445
- """
446
- When I run `berks install`
447
- Then the output should contain:
448
- """
449
- '/something/on/disk' is not a valid Git URI
450
- """
451
- And the exit status should be "InvalidGitURI"
452
-
453
392
  Scenario: installing when there are sources with duplicate names defined in the same group
454
393
  Given I have a Berksfile pointing at the local Berkshelf API with:
455
394
  """
@@ -459,7 +398,7 @@ Feature: berks install
459
398
  When I run `berks install`
460
399
  Then the output should contain:
461
400
  """
462
- Berksfile contains multiple entries named 'berkshelf-cookbook-fixture'. Use only one, or put them in different groups.
401
+ Your Berksfile contains multiple entries named 'berkshelf-cookbook-fixture'. Please remove duplicate dependencies, or put them in different groups.
463
402
  """
464
403
  And the exit status should be "DuplicateDependencyDefined"
465
404
 
@@ -491,18 +430,6 @@ Feature: berks install
491
430
  Using berkshelf-cookbook-fixture (1.0.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v1.0.0)
492
431
  """
493
432
 
494
- Scenario: with a cookbook definition containing an invalid option
495
- Given I have a Berksfile pointing at the local Berkshelf API with:
496
- """
497
- cookbook "berkshelf-cookbook-fixture", whatisthis: "I don't even know", anotherwat: "isthat"
498
- """
499
- When I run `berks install`
500
- Then the output should contain:
501
- """
502
- Invalid options for dependency: 'whatisthis', 'anotherwat'.
503
- """
504
- And the exit status should be "InternalError"
505
-
506
433
  Scenario: with a git error during download
507
434
  Given I have a Berksfile pointing at the local Berkshelf API with:
508
435
  """
@@ -512,10 +439,9 @@ Feature: berks install
512
439
  When I run `berks install`
513
440
  Then the output should contain:
514
441
  """
515
- Fetching 'doesntexist' from git://github.com/asdjhfkljashflkjashfakljsf (at master)
516
- An error occurred during Git execution:
442
+ Repository not found.
517
443
  """
518
- And the exit status should be "GitError"
444
+ And the exit status should be "GitLocation::GitError"
519
445
 
520
446
  Scenario: transitive dependencies in metadata
521
447
  Given the cookbook store contains a cookbook "fake" "1.0.0" with dependencies:
@@ -526,6 +452,7 @@ Feature: berks install
526
452
  """
527
453
  And I write to "metadata.rb" with:
528
454
  """
455
+ name "myface"
529
456
  depends 'fake', '1.0.0'
530
457
  depends 'bacon', '0.2.0'
531
458
  """
@@ -555,6 +482,7 @@ Feature: berks install
555
482
  """
556
483
  And I write to "metadata.rb" with:
557
484
  """
485
+ name "myface"
558
486
  depends 'fake', '1.0.0'
559
487
  depends 'bacon', '0.2.0'
560
488
  """
@@ -0,0 +1,15 @@
1
+ Feature: berks search
2
+ Scenario: Searching for a cookbook by name
3
+ * I successfully run `berks search berkshelf-cookbook-fixture`
4
+ * the output should contain:
5
+ """
6
+ berkshelf-cookbook-fixture (1.0.0)
7
+ """
8
+
9
+ Scenario: Searching for a cookbook by partial name
10
+ * I successfully run `berks search berkshelf-`
11
+ * the output should contain:
12
+ """
13
+ berkshelf-api (1.0.0)
14
+ berkshelf-cookbook-fixture (1.0.0)
15
+ """
@@ -3,7 +3,7 @@ Feature: berks shelf show
3
3
  When I run `berks shelf show fake`
4
4
  Then the output should contain:
5
5
  """
6
- Cookbook 'fake' is not in the Berkshelf shelf
6
+ Cookbook 'fake' not found in the Berkshelf shelf!
7
7
  """
8
8
  And the exit status should be "CookbookNotFound"
9
9
 
@@ -54,7 +54,7 @@ Feature: berks shelf show
54
54
  When I run `berks shelf show fake --version 1.2.3`
55
55
  Then the output should contain:
56
56
  """
57
- Cookbook 'fake' (1.2.3) is not in the Berkshelf shelf
57
+ Cookbook 'fake' (1.2.3) not found in the Berkshelf shelf!
58
58
  """
59
59
  And the exit status should be "CookbookNotFound"
60
60
 
@@ -3,7 +3,7 @@ Feature: berks shelf uninstall
3
3
  When I run `berks shelf uninstall fake`
4
4
  Then the output should contain:
5
5
  """
6
- Cookbook 'fake' is not in the Berkshelf shelf
6
+ Cookbook 'fake' not found in the Berkshelf shelf!
7
7
  """
8
8
  And the exit status should be "CookbookNotFound"
9
9
 
@@ -61,7 +61,7 @@ Feature: berks show
61
61
  When I run `berks show fake`
62
62
  Then the output should contain:
63
63
  """
64
- Could not find cookbook 'fake'. Make sure it is in your Berksfile, then run `berks install` to download and install the missing dependencies.
64
+ Dependency 'fake' was not found. Please make sure it is in your Berksfile, and then run `berks install` to download and install the missing dependencies.
65
65
  """
66
66
  And the exit status should be "DependencyNotFound"
67
67
 
@@ -73,7 +73,7 @@ Feature: berks show
73
73
  When I run `berks show fake`
74
74
  Then the output should contain:
75
75
  """
76
- Could not find cookbook 'fake'. Make sure it is in your Berksfile, then run `berks install` to download and install the missing dependencies.
76
+ Dependency 'fake' was not found. Please make sure it is in your Berksfile, and then run `berks install` to download and install the missing dependencies.
77
77
  """
78
78
  And the exit status should be "DependencyNotFound"
79
79
 
@@ -94,6 +94,6 @@ Feature: berks show
94
94
  When I run `berks show fake`
95
95
  Then the output should contain:
96
96
  """
97
- Could not find cookbook 'fake (1.0.0)'. Run `berks install` to download and install the missing cookbook.
97
+ Cookbook 'fake' (1.0.0) not found in the cookbook store!
98
98
  """
99
99
  And the exit status should be "CookbookNotFound"
@@ -64,11 +64,39 @@ Feature: berks update
64
64
  fake (0.2.0)
65
65
  """
66
66
 
67
+ Scenario: With a git location
68
+ Given I have a Berksfile pointing at the local Berkshelf API with:
69
+ """
70
+ cookbook 'berkshelf-cookbook-fixture', git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture'
71
+ """
72
+ And I write to "Berksfile.lock" with:
73
+ """
74
+ DEPENDENCIES
75
+ berkshelf-cookbook-fixture
76
+ git: git://github.com/RiotGames/berkshelf-cookbook-fixture
77
+ revision: 70a527e17d91f01f031204562460ad1c17f972ee
78
+
79
+ GRAPH
80
+ berkshelf-cookbook-fixture (0.2.0)
81
+ """
82
+ And I successfully run `berks install`
83
+ When I successfully run `berks update`
84
+ Then the file "Berksfile.lock" should contain:
85
+ """
86
+ DEPENDENCIES
87
+ berkshelf-cookbook-fixture
88
+ git: git://github.com/RiotGames/berkshelf-cookbook-fixture
89
+ revision: a97b9447cbd41a5fe58eee2026e48ccb503bd3bc
90
+
91
+ GRAPH
92
+ berkshelf-cookbook-fixture (1.0.0)
93
+ """
94
+
67
95
  Scenario: With a cookbook that does not exist
68
96
  Given I have a Berksfile pointing at the local Berkshelf API
69
97
  When I run `berks update not_real`
70
98
  Then the output should contain:
71
99
  """
72
- Could not find cookbook 'not_real'. Make sure it is in your Berksfile, then run `berks install` to download and install the missing dependencies.
100
+ Dependency 'not_real' was not found. Please make sure it is in your Berksfile, and then run `berks install` to download and install the missing dependencies.
73
101
  """
74
102
  And the exit status should be "DependencyNotFound"
@@ -1,6 +1,5 @@
1
1
  Feature: berks upload
2
2
  Background:
3
- * the Berkshelf API server's cache is empty
4
3
  * the Chef Server is empty
5
4
  * the cookbook store has the cookbooks:
6
5
  | fake | 1.0.0 |
@@ -13,6 +12,16 @@ Feature: berks upload
13
12
  cookbook 'fake', '1.0.0'
14
13
  cookbook 'ekaf', '2.0.0'
15
14
  """
15
+ And I write to "Berksfile.lock" with:
16
+ """
17
+ DEPENDENCIES
18
+ fake (= 1.0.0)
19
+ ekaf (= 2.0.0)
20
+
21
+ GRAPH
22
+ fake (1.0.0)
23
+ ekaf (2.0.0)
24
+ """
16
25
  When I successfully run `berks upload`
17
26
  Then the Chef Server should have the cookbooks:
18
27
  | fake | 1.0.0 |
@@ -24,6 +33,15 @@ Feature: berks upload
24
33
  """
25
34
  cookbook 'fake', path: './fake'
26
35
  """
36
+ And I write to "Berksfile.lock" with:
37
+ """
38
+ DEPENDENCIES
39
+ fake
40
+ path: ./fake
41
+
42
+ GRAPH
43
+ fake (0.0.0)
44
+ """
27
45
  When I successfully run `berks upload`
28
46
  Then the Chef Server should have the cookbooks:
29
47
  | fake | 0.0.0 |
@@ -33,10 +51,23 @@ Feature: berks upload
33
51
  | fake | = 1.0.0 |
34
52
  And I have a Berksfile pointing at the local Berkshelf API with:
35
53
  """
36
- cookbook 'fake', '1.0.0'
37
- cookbook 'ekaf', '2.0.0'
54
+ cookbook 'fake', '1.0.0'
55
+ cookbook 'ekaf', '2.0.0'
38
56
  cookbook 'reset', '3.4.5'
39
57
  """
58
+ And I write to "Berksfile.lock" with:
59
+ """
60
+ DEPENDENCIES
61
+ ekaf (= 2.0.0)
62
+ fake (= 1.0.0)
63
+ reset (= 3.4.5)
64
+
65
+ GRAPH
66
+ ekaf (2.0.0)
67
+ fake (1.0.0)
68
+ reset (3.4.5)
69
+ fake (= 1.0.0)
70
+ """
40
71
  When I successfully run `berks upload reset`
41
72
  Then the Chef Server should have the cookbooks:
42
73
  | reset | 3.4.5 |
@@ -46,10 +77,18 @@ Feature: berks upload
46
77
 
47
78
  Scenario: specifying a dependency not defined in the Berksfile
48
79
  Given I have a Berksfile pointing at the local Berkshelf API
80
+ And I write to "Berksfile.lock" with:
81
+ """
82
+ DEPENDENCIES
83
+ fake (= 1.0.0)
84
+
85
+ GRAPH
86
+ fake (1.0.0)
87
+ """
49
88
  When I run `berks upload reset`
50
89
  Then the output should contain:
51
90
  """
52
- Could not find cookbook 'reset'. Make sure it is in your Berksfile, then run `berks install` to download and install the missing dependencies.
91
+ Dependency 'reset' was not found. Please make sure it is in your Berksfile, and then run `berks install` to download and install the missing dependencies.
53
92
  """
54
93
  And the exit status should be "DependencyNotFound"
55
94
 
@@ -60,6 +99,18 @@ Feature: berks upload
60
99
  cookbook 'ekaf', '2.0.0'
61
100
  cookbook 'oops', '3.0.0'
62
101
  """
102
+ And I write to "Berksfile.lock" with:
103
+ """
104
+ DEPENDENCIES
105
+ ekaf (= 2.0.0)
106
+ fake (= 1.0.0)
107
+ oops (= 3.0.0)
108
+
109
+ GRAPH
110
+ ekaf (2.0.0)
111
+ fake (1.0.0)
112
+ oops (3.0.0)
113
+ """
63
114
  When I successfully run `berks upload fake ekaf`
64
115
  Then the Chef Server should have the cookbooks:
65
116
  | fake |
@@ -67,12 +118,50 @@ Feature: berks upload
67
118
  And the Chef Server should not have the cookbooks:
68
119
  | oops |
69
120
 
121
+ Scenario: uploading a filter does not change the lockfile
122
+ Given I have a Berksfile pointing at the local Berkshelf API with:
123
+ """
124
+ cookbook 'fake', group: :take_me
125
+ cookbook 'ekaf', group: :not_me
126
+ """
127
+ And I write to "Berksfile.lock" with:
128
+ """
129
+ DEPENDENCIES
130
+ ekaf
131
+ fake
132
+
133
+ GRAPH
134
+ ekaf (2.0.0)
135
+ fake (1.0.0)
136
+ """
137
+ When I run `berks upload --only take_me`
138
+ Then the file "Berksfile.lock" should contain:
139
+ """
140
+ DEPENDENCIES
141
+ ekaf
142
+ fake
143
+
144
+ GRAPH
145
+ ekaf (2.0.0)
146
+ fake (1.0.0)
147
+ """
148
+
70
149
  Scenario: uploading a single groups of demands with the --only flag
71
150
  Given I have a Berksfile pointing at the local Berkshelf API with:
72
151
  """
73
152
  cookbook 'fake', group: :take_me
74
153
  cookbook 'ekaf', group: :not_me
75
154
  """
155
+ And I write to "Berksfile.lock" with:
156
+ """
157
+ DEPENDENCIES
158
+ ekaf
159
+ fake
160
+
161
+ GRAPH
162
+ ekaf (2.0.0)
163
+ fake (1.0.0)
164
+ """
76
165
  When I successfully run `berks upload --only take_me`
77
166
  Then the Chef Server should have the cookbooks:
78
167
  | fake | 1.0.0 |
@@ -85,6 +174,16 @@ Feature: berks upload
85
174
  cookbook 'fake', group: :take_me
86
175
  cookbook 'ekaf', group: :not_me
87
176
  """
177
+ And I write to "Berksfile.lock" with:
178
+ """
179
+ DEPENDENCIES
180
+ ekaf
181
+ fake
182
+
183
+ GRAPH
184
+ ekaf (2.0.0)
185
+ fake (1.0.0)
186
+ """
88
187
  When I successfully run `berks upload --only take_me not_me`
89
188
  And the Chef Server should have the cookbooks:
90
189
  | fake | 1.0.0 |
@@ -96,6 +195,16 @@ Feature: berks upload
96
195
  cookbook 'fake', group: :take_me
97
196
  cookbook 'ekaf', group: :not_me
98
197
  """
198
+ And I write to "Berksfile.lock" with:
199
+ """
200
+ DEPENDENCIES
201
+ ekaf
202
+ fake
203
+
204
+ GRAPH
205
+ ekaf (2.0.0)
206
+ fake (1.0.0)
207
+ """
99
208
  When I successfully run `berks upload --except not_me`
100
209
  And the Chef Server should have the cookbooks:
101
210
  | fake | 1.0.0 |
@@ -108,6 +217,16 @@ Feature: berks upload
108
217
  cookbook 'fake', group: :take_me
109
218
  cookbook 'ekaf', group: :not_me
110
219
  """
220
+ And I write to "Berksfile.lock" with:
221
+ """
222
+ DEPENDENCIES
223
+ ekaf
224
+ fake
225
+
226
+ GRAPH
227
+ ekaf (2.0.0)
228
+ fake (1.0.0)
229
+ """
111
230
  When I successfully run `berks upload --except take_me not_me`
112
231
  And the Chef Server should not have the cookbooks:
113
232
  | fake | 1.0.0 |
@@ -119,6 +238,15 @@ Feature: berks upload
119
238
  """
120
239
  cookbook 'cookbook with spaces', path: './cookbook with spaces'
121
240
  """
241
+ And I write to "Berksfile.lock" with:
242
+ """
243
+ DEPENDENCIES
244
+ cookbook with spaces
245
+ path: ./cookbook with spaces
246
+
247
+ GRAPH
248
+ cookbook with spaces (0.0.0)
249
+ """
122
250
  When I run `berks upload`
123
251
  Then the output should contain:
124
252
  """
@@ -140,6 +268,16 @@ Feature: berks upload
140
268
  """
141
269
  metadata
142
270
  """
271
+ And I write to "Berksfile.lock" with:
272
+ """
273
+ DEPENDENCIES
274
+ fake
275
+ path: .
276
+ metadata: true
277
+
278
+ GRAPH
279
+ fake (0.0.0)
280
+ """
143
281
  When I successfully run `berks upload fake`
144
282
  Then the output should contain:
145
283
  """
@@ -153,6 +291,14 @@ Feature: berks upload
153
291
  """
154
292
  cookbook 'fake', '1.0.0'
155
293
  """
294
+ And I write to "Berksfile.lock" with:
295
+ """
296
+ DEPENDENCIES
297
+ fake (= 1.0.0)
298
+
299
+ GRAPH
300
+ fake (1.0.0)
301
+ """
156
302
  When I successfully run `berks upload`
157
303
  Then the output should contain:
158
304
  """
@@ -169,12 +315,21 @@ Feature: berks upload
169
315
  Given a cookbook named "fake"
170
316
  And the cookbook "fake" has the file "Berksfile" with:
171
317
  """
172
- source 'https://api.berkshelf.com'
173
318
  metadata
174
319
  """
175
- And the Chef Server has frozen cookbooks:
176
- | fake | 0.0.0 |
177
320
  And I cd to "fake"
321
+ And I write to "Berksfile.lock" with:
322
+ """
323
+ DEPENDENCIES
324
+ fake
325
+ path: .
326
+ metadata: true
327
+
328
+ GRAPH
329
+ fake (0.0.0)
330
+ """
331
+ And the Chef Server has frozen cookbooks:
332
+ | fake | 0.0.0 |
178
333
  When I successfully run `berks upload`
179
334
  Then the output should contain:
180
335
  """
@@ -205,6 +360,16 @@ Feature: berks upload
205
360
  source 'https://api.berkshelf.com'
206
361
  metadata
207
362
  """
363
+ And the cookbook "fake" has the file "Berksfile.lock" with:
364
+ """
365
+ DEPENDENCIES
366
+ fake
367
+ path: .
368
+ metadata: true
369
+
370
+ GRAPH
371
+ fake (0.0.0)
372
+ """
208
373
  And I cd to "fake"
209
374
  When I successfully run `berks upload --skip-syntax-check`
210
375
  Then the Chef Server should have the cookbooks: