berkshelf 2.0.0.beta → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. data/CHANGELOG.md +19 -1
  2. data/CONTRIBUTING.md +1 -3
  3. data/Gemfile +0 -20
  4. data/Guardfile +3 -3
  5. data/LICENSE +6 -5
  6. data/README.md +1 -0
  7. data/Thorfile +48 -67
  8. data/berkshelf.gemspec +48 -37
  9. data/features/apply_command.feature +17 -11
  10. data/features/config.feature +11 -11
  11. data/features/configure_command.feature +8 -8
  12. data/features/contingent_command.feature +37 -8
  13. data/features/cookbook_command.feature +17 -14
  14. data/features/groups_install.feature +24 -20
  15. data/features/install_command.feature +24 -33
  16. data/features/licenses.feature +112 -0
  17. data/features/list_command.feature +17 -5
  18. data/features/lockfile.feature +307 -188
  19. data/features/outdated_command.feature +1 -4
  20. data/features/package_command.feature +41 -19
  21. data/features/shelf/list.feature +39 -0
  22. data/features/shelf/show.feature +152 -0
  23. data/features/shelf/uninstall.feature +103 -0
  24. data/features/show_command.feature +49 -17
  25. data/features/step_definitions/filesystem_steps.rb +12 -3
  26. data/features/step_definitions/utility_steps.rb +0 -1
  27. data/features/support/env.rb +11 -4
  28. data/features/update_command.feature +22 -10
  29. data/features/upload_command.feature +174 -127
  30. data/features/vendor_install.feature +6 -6
  31. data/generator_files/Berksfile.erb +1 -1
  32. data/generator_files/metadata.rb.erb +7 -7
  33. data/lib/berkshelf.rb +39 -27
  34. data/lib/berkshelf/base_generator.rb +2 -3
  35. data/lib/berkshelf/berksfile.rb +69 -17
  36. data/lib/berkshelf/cached_cookbook.rb +17 -1
  37. data/lib/berkshelf/chef.rb +2 -4
  38. data/lib/berkshelf/chef/config.rb +51 -75
  39. data/lib/berkshelf/chef/cookbook.rb +1 -2
  40. data/lib/berkshelf/chef/cookbook/chefignore.rb +1 -1
  41. data/lib/berkshelf/cli.rb +144 -194
  42. data/lib/berkshelf/command.rb +11 -12
  43. data/lib/berkshelf/commands/shelf.rb +130 -0
  44. data/lib/berkshelf/commands/test_command.rb +11 -0
  45. data/lib/berkshelf/community_rest.rb +1 -2
  46. data/lib/berkshelf/config.rb +14 -10
  47. data/lib/berkshelf/cookbook_generator.rb +30 -24
  48. data/lib/berkshelf/cookbook_source.rb +1 -1
  49. data/lib/berkshelf/cookbook_store.rb +0 -1
  50. data/lib/berkshelf/core_ext.rb +1 -1
  51. data/lib/berkshelf/core_ext/file.rb +1 -1
  52. data/lib/berkshelf/downloader.rb +3 -1
  53. data/lib/berkshelf/errors.rb +128 -53
  54. data/lib/berkshelf/formatters.rb +2 -6
  55. data/lib/berkshelf/formatters/human_readable.rb +8 -2
  56. data/lib/berkshelf/formatters/json.rb +7 -1
  57. data/lib/berkshelf/formatters/null.rb +0 -1
  58. data/lib/berkshelf/git.rb +16 -16
  59. data/lib/berkshelf/init_generator.rb +28 -26
  60. data/lib/berkshelf/location.rb +12 -11
  61. data/lib/berkshelf/locations/chef_api_location.rb +2 -2
  62. data/lib/berkshelf/locations/git_location.rb +0 -1
  63. data/lib/berkshelf/locations/github_location.rb +0 -1
  64. data/lib/berkshelf/locations/path_location.rb +1 -2
  65. data/lib/berkshelf/locations/site_location.rb +3 -2
  66. data/lib/berkshelf/lockfile.rb +29 -10
  67. data/lib/berkshelf/mixin/config.rb +155 -0
  68. data/lib/berkshelf/mixin/logging.rb +0 -1
  69. data/lib/berkshelf/mixin/shellout.rb +71 -0
  70. data/lib/berkshelf/resolver.rb +7 -4
  71. data/lib/berkshelf/test.rb +1 -3
  72. data/lib/berkshelf/ui.rb +8 -4
  73. data/lib/berkshelf/version.rb +1 -1
  74. data/lib/thor/monkies/shell.rb +0 -1
  75. data/spec/config/berkshelf.pem +27 -0
  76. data/spec/config/knife.rb +12 -0
  77. data/spec/config/validator.pem +27 -0
  78. data/spec/spec_helper.rb +4 -8
  79. data/spec/support/chef_api.rb +14 -9
  80. data/spec/support/chef_server.rb +3 -4
  81. data/spec/unit/berkshelf/berksfile_spec.rb +1 -1
  82. data/spec/unit/berkshelf/cookbook_generator_spec.rb +12 -6
  83. data/spec/unit/berkshelf/cookbook_source_spec.rb +13 -1
  84. data/spec/unit/berkshelf/init_generator_spec.rb +5 -0
  85. data/spec/unit/chef/config_spec.rb +9 -10
  86. metadata +216 -93
  87. data/features/info_command.feature +0 -39
  88. data/features/open_command.feature +0 -36
  89. data/lib/berkshelf/cli_commands/test_command.rb +0 -11
  90. data/lib/berkshelf/mixin.rb +0 -10
  91. data/lib/berkshelf/mixin/path_helpers.rb +0 -30
  92. data/spec/support/knife.rb +0 -18
@@ -1,39 +0,0 @@
1
- Feature: info command
2
- As a user
3
- I want to be able to view the metadata information of a cached cookbook
4
- So that I can troubleshoot bugs or satisfy my own curiosity
5
-
6
- Scenario: Running the info command with an installed cookbook name
7
- Given the cookbook store has the cookbooks:
8
- | berkshelf-cookbook-fixture | 1.0.0 |
9
- | berkshelf-cookbook-fixture | 0.2.0 |
10
- | berkshelf-cookbook-fixture | 0.1.0 |
11
- When I successfully run `berks info berkshelf-cookbook-fixture`
12
- Then the output should contain "Name: berkshelf-cookbook-fixture"
13
- Then the output should contain "Version: 1.0.0"
14
- Then the output should contain "Description: A fabulous new cookbook"
15
- Then the output should contain "Author: YOUR_COMPANY_NAME"
16
- Then the output should contain "Email: YOUR_EMAIL"
17
- Then the output should contain "License: none"
18
- And the exit status should be 0
19
-
20
- Scenario: Running the info command with an installed cookbook name and a version
21
- Given the cookbook store has the cookbooks:
22
- | berkshelf-cookbook-fixture | 1.0.0 |
23
- | berkshelf-cookbook-fixture | 0.2.0 |
24
- | berkshelf-cookbook-fixture | 0.1.0 |
25
- When I successfully run `berks info berkshelf-cookbook-fixture --version 0.2.0`
26
- Then the output should contain "Name: berkshelf-cookbook-fixture"
27
- Then the output should contain "Version: 0.2.0"
28
- Then the output should contain "Description: A fabulous new cookbook"
29
- Then the output should contain "Author: YOUR_COMPANY_NAME"
30
- Then the output should contain "Email: YOUR_EMAIL"
31
- Then the output should contain "License: none"
32
- And the exit status should be 0
33
-
34
- Scenario: Running the info command with a not installed cookbook name
35
- Given the cookbook store has the cookbooks:
36
- | berkshelf-cookbook-fixture | 1.0.0 |
37
- When I run `berks info build-essential`
38
- Then the output should contain "Cookbook 'build-essential' was not installed by your Berksfile"
39
- And the CLI should exit with the status code for error "CookbookNotFound"
@@ -1,36 +0,0 @@
1
- Feature: open command
2
- As a user
3
- I want to be able to view the source of a cached cookbook
4
- So that I can troubleshoot bugs in my dependencies
5
-
6
- Scenario: Running berks open with no $EDITOR
7
- Given the BERKSHELF_EDITOR and VISUAL environment variables are not set
8
- And the environment variable EDITOR is nil
9
- And the cookbook store has the cookbooks:
10
- | mysql | 1.2.4 |
11
- When I run `berks open mysql`
12
- Then the output should contain "To open a cookbook, set $EDITOR or $BERKSHELF_EDITOR"
13
-
14
- Scenario: Running berks open with an $EDITOR
15
- Given the BERKSHELF_EDITOR and VISUAL environment variables are not set
16
- And the environment variable EDITOR is "ls"
17
- And the cookbook store has the cookbooks:
18
- | mysql | 1.2.4 |
19
- When I run `berks open mysql`
20
- Then the output should contain "metadata.rb"
21
-
22
- Scenario: Running berks open with a missing EDITOR
23
- Given the BERKSHELF_EDITOR and VISUAL environment variables are not set
24
- And the environment variable EDITOR is "wat"
25
- And the cookbook store has the cookbooks:
26
- | mysql | 1.2.4 |
27
- When I run `berks open mysql`
28
- Then the output should contain "Could not run `wat "
29
- And the CLI should exit with the status code for error "CommandUnsuccessful"
30
-
31
- Scenario: Running berks open when the cookbook does not exist
32
- Given the BERKSHELF_EDITOR and VISUAL environment variables are not set
33
- And the environment variable EDITOR is "ls"
34
- When I run `berks open mysql`
35
- Then the output should contain "Cookbook 'mysql' not found in any of the sources!"
36
- And the CLI should exit with the status code for error "CookbookNotFound"
@@ -1,11 +0,0 @@
1
- require 'kitchen/cli'
2
-
3
- module Berkshelf
4
- class TestCommand < Kitchen::CLI
5
- namespace "test"
6
- end
7
-
8
- class Cli
9
- register(TestCommand, 'test', 'test [COMMAND]', 'Testing tasks for your cookbook')
10
- end
11
- end
@@ -1,10 +0,0 @@
1
- module Berkshelf
2
- # @author Jamie Winsor <reset@riotgames.com>
3
- #
4
- # Helpful mixins for use within Berkshelf
5
- module Mixin; end
6
- end
7
-
8
- Dir["#{File.dirname(__FILE__)}/mixin/*.rb"].sort.each do |path|
9
- require "berkshelf/mixin/#{File.basename(path, '.rb')}"
10
- end
@@ -1,30 +0,0 @@
1
- module Berkshelf::Mixin
2
- # @author Jamie Winsor <reset@riotgames.com>
3
- module PathHelpers
4
- # Converts a path to a path usable for your current platform
5
- #
6
- # @param [String] path
7
- #
8
- # @return [String]
9
- def platform_specific_path(path)
10
- if RUBY_PLATFORM =~ /mswin|mingw|windows/
11
- system_drive = ENV['SYSTEMDRIVE'] ? ENV['SYSTEMDRIVE'] : ""
12
- path = win_slashify File.join(system_drive, path.split('/')[2..-1])
13
- end
14
-
15
- path
16
- end
17
-
18
- # Convert a unixy filepath to a windowsy filepath. Swaps forward slashes for
19
- # double backslashes
20
- #
21
- # @param [String] path
22
- # filepath to convert
23
- #
24
- # @return [String]
25
- # converted filepath
26
- def win_slashify(path)
27
- path.gsub(File::SEPARATOR, (File::ALT_SEPARATOR || '\\'))
28
- end
29
- end
30
- end
@@ -1,18 +0,0 @@
1
- require 'berkshelf/chef'
2
-
3
- module Berkshelf
4
- module RSpec
5
- module Knife
6
- class << self
7
- def load_knife_config(path)
8
- if File.exist?(path)
9
- Berkshelf::Chef::Config.from_file(path)
10
- ENV["CHEF_CONFIG"] = path
11
- else
12
- raise "Cannot continue; '#{path}' must exist and have testing credentials." unless ENV['CI']
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end