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.
- data/CHANGELOG.md +19 -1
- data/CONTRIBUTING.md +1 -3
- data/Gemfile +0 -20
- data/Guardfile +3 -3
- data/LICENSE +6 -5
- data/README.md +1 -0
- data/Thorfile +48 -67
- data/berkshelf.gemspec +48 -37
- data/features/apply_command.feature +17 -11
- data/features/config.feature +11 -11
- data/features/configure_command.feature +8 -8
- data/features/contingent_command.feature +37 -8
- data/features/cookbook_command.feature +17 -14
- data/features/groups_install.feature +24 -20
- data/features/install_command.feature +24 -33
- data/features/licenses.feature +112 -0
- data/features/list_command.feature +17 -5
- data/features/lockfile.feature +307 -188
- data/features/outdated_command.feature +1 -4
- data/features/package_command.feature +41 -19
- data/features/shelf/list.feature +39 -0
- data/features/shelf/show.feature +152 -0
- data/features/shelf/uninstall.feature +103 -0
- data/features/show_command.feature +49 -17
- data/features/step_definitions/filesystem_steps.rb +12 -3
- data/features/step_definitions/utility_steps.rb +0 -1
- data/features/support/env.rb +11 -4
- data/features/update_command.feature +22 -10
- data/features/upload_command.feature +174 -127
- data/features/vendor_install.feature +6 -6
- data/generator_files/Berksfile.erb +1 -1
- data/generator_files/metadata.rb.erb +7 -7
- data/lib/berkshelf.rb +39 -27
- data/lib/berkshelf/base_generator.rb +2 -3
- data/lib/berkshelf/berksfile.rb +69 -17
- data/lib/berkshelf/cached_cookbook.rb +17 -1
- data/lib/berkshelf/chef.rb +2 -4
- data/lib/berkshelf/chef/config.rb +51 -75
- data/lib/berkshelf/chef/cookbook.rb +1 -2
- data/lib/berkshelf/chef/cookbook/chefignore.rb +1 -1
- data/lib/berkshelf/cli.rb +144 -194
- data/lib/berkshelf/command.rb +11 -12
- data/lib/berkshelf/commands/shelf.rb +130 -0
- data/lib/berkshelf/commands/test_command.rb +11 -0
- data/lib/berkshelf/community_rest.rb +1 -2
- data/lib/berkshelf/config.rb +14 -10
- data/lib/berkshelf/cookbook_generator.rb +30 -24
- data/lib/berkshelf/cookbook_source.rb +1 -1
- data/lib/berkshelf/cookbook_store.rb +0 -1
- data/lib/berkshelf/core_ext.rb +1 -1
- data/lib/berkshelf/core_ext/file.rb +1 -1
- data/lib/berkshelf/downloader.rb +3 -1
- data/lib/berkshelf/errors.rb +128 -53
- data/lib/berkshelf/formatters.rb +2 -6
- data/lib/berkshelf/formatters/human_readable.rb +8 -2
- data/lib/berkshelf/formatters/json.rb +7 -1
- data/lib/berkshelf/formatters/null.rb +0 -1
- data/lib/berkshelf/git.rb +16 -16
- data/lib/berkshelf/init_generator.rb +28 -26
- data/lib/berkshelf/location.rb +12 -11
- data/lib/berkshelf/locations/chef_api_location.rb +2 -2
- data/lib/berkshelf/locations/git_location.rb +0 -1
- data/lib/berkshelf/locations/github_location.rb +0 -1
- data/lib/berkshelf/locations/path_location.rb +1 -2
- data/lib/berkshelf/locations/site_location.rb +3 -2
- data/lib/berkshelf/lockfile.rb +29 -10
- data/lib/berkshelf/mixin/config.rb +155 -0
- data/lib/berkshelf/mixin/logging.rb +0 -1
- data/lib/berkshelf/mixin/shellout.rb +71 -0
- data/lib/berkshelf/resolver.rb +7 -4
- data/lib/berkshelf/test.rb +1 -3
- data/lib/berkshelf/ui.rb +8 -4
- data/lib/berkshelf/version.rb +1 -1
- data/lib/thor/monkies/shell.rb +0 -1
- data/spec/config/berkshelf.pem +27 -0
- data/spec/config/knife.rb +12 -0
- data/spec/config/validator.pem +27 -0
- data/spec/spec_helper.rb +4 -8
- data/spec/support/chef_api.rb +14 -9
- data/spec/support/chef_server.rb +3 -4
- data/spec/unit/berkshelf/berksfile_spec.rb +1 -1
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +12 -6
- data/spec/unit/berkshelf/cookbook_source_spec.rb +13 -1
- data/spec/unit/berkshelf/init_generator_spec.rb +5 -0
- data/spec/unit/chef/config_spec.rb +9 -10
- metadata +216 -93
- data/features/info_command.feature +0 -39
- data/features/open_command.feature +0 -36
- data/lib/berkshelf/cli_commands/test_command.rb +0 -11
- data/lib/berkshelf/mixin.rb +0 -10
- data/lib/berkshelf/mixin/path_helpers.rb +0 -30
- 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"
|
data/lib/berkshelf/mixin.rb
DELETED
@@ -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
|
data/spec/support/knife.rb
DELETED
@@ -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
|