berkshelf 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/Gemfile +11 -11
- data/Guardfile +1 -1
- data/README.md +1 -1
- data/berkshelf.gemspec +10 -11
- data/features/config.feature +1 -1
- data/features/cookbook_command.feature +1 -1
- data/features/default_locations.feature +6 -6
- data/features/groups_install.feature +3 -3
- data/features/init_command.feature +1 -1
- data/features/lockfile.feature +1 -1
- data/features/support/env.rb +1 -1
- data/features/upload_command.feature +1 -1
- data/lib/berkshelf.rb +14 -14
- data/lib/berkshelf/base_generator.rb +1 -1
- data/lib/berkshelf/berksfile.rb +22 -22
- data/lib/berkshelf/cached_cookbook.rb +1 -1
- data/lib/berkshelf/cli.rb +1 -1
- data/lib/berkshelf/cookbook_generator.rb +1 -1
- data/lib/berkshelf/cookbook_source.rb +1 -1
- data/lib/berkshelf/cookbook_store.rb +2 -2
- data/lib/berkshelf/core_ext/file_utils.rb +1 -1
- data/lib/berkshelf/core_ext/pathname.rb +2 -2
- data/lib/berkshelf/formatters.rb +1 -1
- data/lib/berkshelf/formatters/json.rb +1 -1
- data/lib/berkshelf/git.rb +2 -2
- data/lib/berkshelf/init_generator.rb +1 -1
- data/lib/berkshelf/location.rb +2 -2
- data/lib/berkshelf/locations/chef_api_location.rb +15 -8
- data/lib/berkshelf/locations/git_location.rb +2 -2
- data/lib/berkshelf/locations/site_location.rb +3 -3
- data/lib/berkshelf/resolver.rb +2 -2
- data/lib/berkshelf/vagrant/action/validate.rb +3 -3
- data/lib/berkshelf/vagrant/middleware.rb +1 -1
- data/lib/berkshelf/version.rb +1 -1
- data/spec/spec_helper.rb +6 -5
- data/spec/unit/berkshelf/berksfile_spec.rb +9 -9
- data/spec/unit/berkshelf/config_spec.rb +1 -1
- data/spec/unit/berkshelf/cookbook_source_spec.rb +3 -3
- data/spec/unit/berkshelf/cookbook_store_spec.rb +1 -1
- data/spec/unit/berkshelf/downloader_spec.rb +3 -3
- data/spec/unit/berkshelf/git_spec.rb +1 -1
- data/spec/unit/berkshelf/location_spec.rb +3 -3
- data/spec/unit/berkshelf/locations/chef_api_location_spec.rb +10 -12
- data/spec/unit/berkshelf/locations/git_location_spec.rb +2 -2
- data/spec/unit/berkshelf/lockfile_spec.rb +1 -1
- data/spec/unit/berkshelf/resolver_spec.rb +5 -5
- metadata +38 -54
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -3,15 +3,15 @@ source :rubygems
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem '
|
7
|
-
gem 'spork'
|
6
|
+
gem 'coolline'
|
8
7
|
gem 'guard', '>= 1.5.0'
|
9
|
-
gem 'guard-
|
8
|
+
gem 'guard-cucumber'
|
10
9
|
gem 'guard-rspec'
|
11
10
|
gem 'guard-spork'
|
12
|
-
gem 'guard-
|
13
|
-
gem 'coolline'
|
11
|
+
gem 'guard-yard'
|
14
12
|
gem 'redcarpet'
|
13
|
+
gem 'spork'
|
14
|
+
gem 'yard'
|
15
15
|
|
16
16
|
require 'rbconfig'
|
17
17
|
|
@@ -28,19 +28,19 @@ group :development do
|
|
28
28
|
gem 'rb-inotify', require: false
|
29
29
|
|
30
30
|
elsif RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
|
31
|
-
gem 'win32console', require: false
|
32
31
|
gem 'rb-notifu', '>= 0.0.4', require: false
|
33
32
|
gem 'wdm', require: false
|
33
|
+
gem 'win32console', require: false
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
group :test do
|
38
|
-
gem '
|
39
|
-
gem 'rake', '>= 0.9.2.2'
|
40
|
-
gem 'rspec'
|
38
|
+
gem 'aruba'
|
41
39
|
gem 'fuubar'
|
42
40
|
gem 'json_spec'
|
43
|
-
gem '
|
41
|
+
gem 'rake', '>= 0.9.2.2'
|
42
|
+
gem 'rspec'
|
43
|
+
gem 'thor'
|
44
44
|
gem 'vcr'
|
45
|
-
gem '
|
45
|
+
gem 'webmock'
|
46
46
|
end
|
data/Guardfile
CHANGED
@@ -12,7 +12,7 @@ guard 'yard', stdout: '/dev/null', stderr: '/dev/null' do
|
|
12
12
|
watch(%r{ext/.+\.c})
|
13
13
|
end
|
14
14
|
|
15
|
-
guard 'rspec',
|
15
|
+
guard 'rspec', cli: "--color --drb --format Fuubar", all_on_start: false, all_after_pass: false do
|
16
16
|
watch(%r{^spec/unit/.+_spec\.rb$})
|
17
17
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
|
18
18
|
watch('spec/spec_helper.rb') { "spec" }
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ and run:
|
|
31
31
|
$ cd berkshelf
|
32
32
|
$ bundle install
|
33
33
|
|
34
|
-
Bundler will install all gems and their dependencies required for testing and developing.
|
34
|
+
Bundler will install all gems and their dependencies required for testing and developing.
|
35
35
|
|
36
36
|
### Running unit (RSpec) and acceptance (Cucumber) tests
|
37
37
|
|
data/berkshelf.gemspec
CHANGED
@@ -26,15 +26,14 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.version = Berkshelf::VERSION
|
27
27
|
s.required_ruby_version = ">= 1.9.1"
|
28
28
|
|
29
|
-
s.
|
30
|
-
s.
|
31
|
-
s.
|
32
|
-
s.
|
33
|
-
s.
|
34
|
-
s.
|
35
|
-
s.
|
36
|
-
s.
|
37
|
-
s.
|
38
|
-
s.
|
39
|
-
s.add_runtime_dependency 'activemodel'
|
29
|
+
s.add_dependency 'activesupport'
|
30
|
+
s.add_dependency 'chef', '>= 10.12.0'
|
31
|
+
s.add_dependency 'ridley', '>= 0.4.1'
|
32
|
+
s.add_dependency 'chozo', '>= 0.2.2'
|
33
|
+
s.add_dependency 'hashie'
|
34
|
+
s.add_dependency 'minitar'
|
35
|
+
s.add_dependency 'multi_json', '>= 1.3.0'
|
36
|
+
s.add_dependency 'solve', '>= 0.4.0.rc1'
|
37
|
+
s.add_dependency 'thor', '~> 0.16.0'
|
38
|
+
s.add_dependency 'vagrant', '~> 1.0.5'
|
40
39
|
end
|
data/features/config.feature
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Feature: cookbook command
|
2
|
-
As a Cookbook author
|
2
|
+
As a Cookbook author
|
3
3
|
I want a way to quickly generate a Cookbook skeleton that contains supporting Berkshelf files
|
4
4
|
So I can quickly and automatically generate a Cookbook containing Berkshelf supporting files or other common supporting files
|
5
5
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
Feature: Berksfile default locations
|
2
2
|
As a Berkshelf user
|
3
3
|
I want to be able to define default locations in my Berksfile
|
4
|
-
So I can set the precedence of where cookbook sources are downloaded from or define an alternate location for all
|
4
|
+
So I can set the precedence of where cookbook sources are downloaded from or define an alternate location for all
|
5
5
|
cookbook sources to attempt to retrieve from
|
6
6
|
|
7
7
|
@chef_server
|
8
8
|
Scenario: with a default chef_api(1) and site(2) location with a cookbook source that is satisfied by the chef_api(1) location
|
9
9
|
Given I write to "Berksfile" with:
|
10
10
|
"""
|
11
|
-
chef_api :
|
11
|
+
chef_api :config
|
12
12
|
site 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
13
13
|
|
14
14
|
cookbook "artifact", "= 0.10.0"
|
@@ -28,7 +28,7 @@ Feature: Berksfile default locations
|
|
28
28
|
Scenario: with a default chef_api(1) and site(2) location with a cookbook source that is not satisfied by the chef_api(1) location
|
29
29
|
Given I write to "Berksfile" with:
|
30
30
|
"""
|
31
|
-
chef_api :
|
31
|
+
chef_api :config
|
32
32
|
site 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
33
33
|
|
34
34
|
cookbook "artifact", "= 0.10.0"
|
@@ -49,7 +49,7 @@ Feature: Berksfile default locations
|
|
49
49
|
Given I write to "Berksfile" with:
|
50
50
|
"""
|
51
51
|
site 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
52
|
-
chef_api :
|
52
|
+
chef_api :config
|
53
53
|
|
54
54
|
cookbook "artifact", "= 0.10.0"
|
55
55
|
"""
|
@@ -68,7 +68,7 @@ Feature: Berksfile default locations
|
|
68
68
|
Scenario: with a default chef_api(1) location and a cookbook source that is satisfied by the chef_api(1) location but has an explicit location set
|
69
69
|
Given I write to "Berksfile" with:
|
70
70
|
"""
|
71
|
-
chef_api :
|
71
|
+
chef_api :config
|
72
72
|
|
73
73
|
cookbook 'artifact', '= 0.10.0', site: 'http://cookbooks.opscode.com/api/v1/cookbooks'
|
74
74
|
"""
|
@@ -87,7 +87,7 @@ Feature: Berksfile default locations
|
|
87
87
|
Scenario: with a defualt chef_api(1) location and a cookbook source that is not satisfied by it
|
88
88
|
Given I write to "Berksfile" with:
|
89
89
|
"""
|
90
|
-
chef_api :
|
90
|
+
chef_api :config
|
91
91
|
|
92
92
|
cookbook 'artifact', '= 0.10.0'
|
93
93
|
"""
|
@@ -9,7 +9,7 @@ Feature: installing groups
|
|
9
9
|
group :notme do
|
10
10
|
cookbook "nginx", "= 0.101.2"
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
cookbook "artifact", "= 0.10.0"
|
14
14
|
|
15
15
|
group :takeme do
|
@@ -30,7 +30,7 @@ Feature: installing groups
|
|
30
30
|
group :notme do
|
31
31
|
cookbook "nginx", "= 0.101.2"
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
cookbook "artifact", "= 0.10.0"
|
35
35
|
|
36
36
|
group :takeme do
|
@@ -51,7 +51,7 @@ Feature: installing groups
|
|
51
51
|
group :notme do
|
52
52
|
cookbook "nginx", "= 0.101.2"
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
cookbook "artifact", "= 0.10.0"
|
56
56
|
|
57
57
|
group :takeme do
|
data/features/lockfile.feature
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Feature: Berksfile.lock
|
2
2
|
As a user
|
3
|
-
I want my versions to be locked even when I don't specify versions in my Berksfile
|
3
|
+
I want my versions to be locked even when I don't specify versions in my Berksfile
|
4
4
|
So when I share my repository, all other developers get the same versions that I did when I installed.
|
5
5
|
|
6
6
|
@slow_process
|
data/features/support/env.rb
CHANGED
@@ -23,7 +23,7 @@ Feature: upload command
|
|
23
23
|
| openssl | 1.0.0 |
|
24
24
|
And the exit status should be 0
|
25
25
|
|
26
|
-
@chef_server
|
26
|
+
@chef_server @slow_process
|
27
27
|
Scenario: running the upload command when the Sources in the Berksfile have not been installed
|
28
28
|
Given I write to "Berksfile" with:
|
29
29
|
"""
|
data/lib/berkshelf.rb
CHANGED
@@ -4,8 +4,8 @@ require 'chef/knife'
|
|
4
4
|
require 'chef/platform'
|
5
5
|
|
6
6
|
require 'chozo/core_ext'
|
7
|
+
|
7
8
|
require 'active_support/core_ext'
|
8
|
-
require 'active_model'
|
9
9
|
require 'archive/tar/minitar'
|
10
10
|
require 'forwardable'
|
11
11
|
require 'hashie'
|
@@ -28,27 +28,27 @@ module Berkshelf
|
|
28
28
|
DEFAULT_STORE_PATH = File.expand_path("~/.berkshelf").freeze
|
29
29
|
DEFAULT_FILENAME = 'Berksfile'.freeze
|
30
30
|
|
31
|
-
autoload :UI, 'berkshelf/ui'
|
32
|
-
autoload :Cli, 'berkshelf/cli'
|
33
|
-
autoload :Git, 'berkshelf/git'
|
34
|
-
autoload :Berksfile, 'berkshelf/berksfile'
|
35
|
-
autoload :Lockfile, 'berkshelf/lockfile'
|
36
31
|
autoload :BaseGenerator, 'berkshelf/base_generator'
|
37
|
-
autoload :
|
32
|
+
autoload :Berksfile, 'berkshelf/berksfile'
|
33
|
+
autoload :CachedCookbook, 'berkshelf/cached_cookbook'
|
34
|
+
autoload :Cli, 'berkshelf/cli'
|
35
|
+
autoload :Config, 'berkshelf/config'
|
38
36
|
autoload :CookbookGenerator, 'berkshelf/cookbook_generator'
|
39
37
|
autoload :CookbookSource, 'berkshelf/cookbook_source'
|
40
38
|
autoload :CookbookStore, 'berkshelf/cookbook_store'
|
41
|
-
autoload :CachedCookbook, 'berkshelf/cached_cookbook'
|
42
39
|
autoload :Downloader, 'berkshelf/downloader'
|
43
|
-
autoload :
|
40
|
+
autoload :Git, 'berkshelf/git'
|
41
|
+
autoload :InitGenerator, 'berkshelf/init_generator'
|
42
|
+
autoload :Lockfile, 'berkshelf/lockfile'
|
44
43
|
autoload :Resolver, 'berkshelf/resolver'
|
45
|
-
autoload :
|
44
|
+
autoload :UI, 'berkshelf/ui'
|
45
|
+
autoload :Uploader, 'berkshelf/uploader'
|
46
46
|
|
47
47
|
require 'berkshelf/location'
|
48
48
|
|
49
49
|
class << self
|
50
50
|
attr_accessor :ui
|
51
|
-
|
51
|
+
|
52
52
|
attr_writer :cookbook_store
|
53
53
|
|
54
54
|
# @return [Pathname]
|
@@ -66,7 +66,7 @@ module Berkshelf
|
|
66
66
|
# to or uploaded from here. By default this is '~/.berkshelf' but
|
67
67
|
# can be overridden by specifying a value for the ENV variable
|
68
68
|
# 'BERKSHELF_PATH'.
|
69
|
-
#
|
69
|
+
#
|
70
70
|
# @return [String]
|
71
71
|
def berkshelf_path
|
72
72
|
ENV["BERKSHELF_PATH"] || DEFAULT_STORE_PATH
|
@@ -99,8 +99,8 @@ module Berkshelf
|
|
99
99
|
# metadata.rb file of a Chef Cookbook. If no metadata.rb file
|
100
100
|
# was found, nil is returned.
|
101
101
|
#
|
102
|
-
# @return [Pathname]
|
103
|
-
# path to metadata.rb
|
102
|
+
# @return [Pathname]
|
103
|
+
# path to metadata.rb
|
104
104
|
def find_metadata(path = Dir.pwd)
|
105
105
|
path = Pathname.new(path)
|
106
106
|
path.ascend do |potential_root|
|
data/lib/berkshelf/berksfile.rb
CHANGED
@@ -29,7 +29,7 @@ module Berkshelf
|
|
29
29
|
def vendor(cookbooks, path)
|
30
30
|
path = File.expand_path(path)
|
31
31
|
FileUtils.mkdir_p(path)
|
32
|
-
|
32
|
+
|
33
33
|
scratch = Berkshelf.mktmpdir
|
34
34
|
cookbooks.each do |cb|
|
35
35
|
dest = File.join(scratch, cb.cookbook_name, "/")
|
@@ -52,7 +52,7 @@ module Berkshelf
|
|
52
52
|
# @return [String]
|
53
53
|
# The path on disk to the file representing this instance of Berksfile
|
54
54
|
attr_reader :filepath
|
55
|
-
|
55
|
+
|
56
56
|
# @return [Berkshelf::Downloader]
|
57
57
|
attr_reader :downloader
|
58
58
|
|
@@ -90,8 +90,8 @@ module Berkshelf
|
|
90
90
|
# @example a cookbook source that will be retrieved from a Chef API (Chef Server)
|
91
91
|
# cookbook 'artifact', chef_api: 'https://api.opscode.com/organizations/vialstudios', node_name: 'reset', client_key: '/Users/reset/.chef/knife.rb'
|
92
92
|
#
|
93
|
-
# @example a cookbook source that will be retrieved from a Chef API using your
|
94
|
-
# cookbook 'artifact', chef_api: :
|
93
|
+
# @example a cookbook source that will be retrieved from a Chef API using your Berkshelf config
|
94
|
+
# cookbook 'artifact', chef_api: :config
|
95
95
|
#
|
96
96
|
# @overload cookbook(name, version_constraint, options = {})
|
97
97
|
# @param [#to_s] name
|
@@ -101,9 +101,9 @@ module Berkshelf
|
|
101
101
|
# @option options [Symbol, Array] :group
|
102
102
|
# the group or groups that the cookbook belongs to
|
103
103
|
# @option options [String, Symbol] :chef_api
|
104
|
-
# a URL to a Chef API. Alternatively the symbol :
|
104
|
+
# a URL to a Chef API. Alternatively the symbol :config can be provided
|
105
105
|
# which will instantiate this location with the values found in your
|
106
|
-
#
|
106
|
+
# Berkshelf configuration.
|
107
107
|
# @option options [String] :site
|
108
108
|
# a URL pointing to a community API endpoint
|
109
109
|
# @option options [String] :path
|
@@ -122,9 +122,9 @@ module Berkshelf
|
|
122
122
|
# @option options [Symbol, Array] :group
|
123
123
|
# the group or groups that the cookbook belongs to
|
124
124
|
# @option options [String, Symbol] :chef_api
|
125
|
-
# a URL to a Chef API. Alternatively the symbol :
|
125
|
+
# a URL to a Chef API. Alternatively the symbol :config can be provided
|
126
126
|
# which will instantiate this location with the values found in your
|
127
|
-
#
|
127
|
+
# Berkshelf configuration.
|
128
128
|
# @option options [String] :site
|
129
129
|
# a URL pointing to a community API endpoint
|
130
130
|
# @option options [String] :path
|
@@ -141,7 +141,7 @@ module Berkshelf
|
|
141
141
|
name, constraint = args
|
142
142
|
|
143
143
|
options[:group] = Array(options[:group])
|
144
|
-
|
144
|
+
|
145
145
|
if @@active_group
|
146
146
|
options[:group] += @@active_group
|
147
147
|
end
|
@@ -208,11 +208,11 @@ module Berkshelf
|
|
208
208
|
# contain an explicit location.
|
209
209
|
#
|
210
210
|
# @note
|
211
|
-
# specifying the symbol :
|
212
|
-
# contents of your
|
211
|
+
# specifying the symbol :config as the value of the chef_api default location will attempt to use the
|
212
|
+
# contents of your Berkshelf configuration to find the Chef API to interact with.
|
213
213
|
#
|
214
|
-
# @example using the symbol :
|
215
|
-
# chef_api :
|
214
|
+
# @example using the symbol :config to add a Chef API default location
|
215
|
+
# chef_api :config
|
216
216
|
#
|
217
217
|
# @example using a URL, node_name, and client_key to add a Chef API default location
|
218
218
|
# chef_api "https://api.opscode.com/organizations/vialstudios", node_name: "reset", client_key: "/Users/reset/.chef/knife.rb"
|
@@ -263,7 +263,7 @@ module Berkshelf
|
|
263
263
|
@sources.has_key?(source.to_s)
|
264
264
|
end
|
265
265
|
|
266
|
-
# @option options [Symbol, Array] :except
|
266
|
+
# @option options [Symbol, Array] :except
|
267
267
|
# Group(s) to exclude to exclude from the returned Array of sources
|
268
268
|
# group to not be installed
|
269
269
|
# @option options [Symbol, Array] :only
|
@@ -325,8 +325,8 @@ module Berkshelf
|
|
325
325
|
end
|
326
326
|
alias_method :get_source, :[]
|
327
327
|
|
328
|
-
# @option options [Symbol, Array] :except
|
329
|
-
# Group(s) to exclude which will cause any sources marked as a member of the
|
328
|
+
# @option options [Symbol, Array] :except
|
329
|
+
# Group(s) to exclude which will cause any sources marked as a member of the
|
330
330
|
# group to not be installed
|
331
331
|
# @option options [Symbol, Array] :only
|
332
332
|
# Group(s) to include which will cause any sources marked as a member of the
|
@@ -362,12 +362,12 @@ module Berkshelf
|
|
362
362
|
# @option options [String] :organization
|
363
363
|
# the Organization to connect to. This is only used if you are connecting to
|
364
364
|
# private Chef or hosted Chef
|
365
|
-
# @option options [Boolean] :force Upload the Cookbook even if the version
|
365
|
+
# @option options [Boolean] :force Upload the Cookbook even if the version
|
366
366
|
# already exists and is frozen on the target Chef Server
|
367
|
-
# @option options [Boolean] :freeze Freeze the uploaded Cookbook on the Chef
|
367
|
+
# @option options [Boolean] :freeze Freeze the uploaded Cookbook on the Chef
|
368
368
|
# Server so that it cannot be overwritten
|
369
|
-
# @option options [Symbol, Array] :except
|
370
|
-
# Group(s) to exclude which will cause any sources marked as a member of the
|
369
|
+
# @option options [Symbol, Array] :except
|
370
|
+
# Group(s) to exclude which will cause any sources marked as a member of the
|
371
371
|
# group to not be installed
|
372
372
|
# @option options [Symbol, Array] :only
|
373
373
|
# Group(s) to include which will cause any sources marked as a member of the
|
@@ -396,8 +396,8 @@ module Berkshelf
|
|
396
396
|
|
397
397
|
# Finds a solution for the Berksfile and returns an array of CachedCookbooks.
|
398
398
|
#
|
399
|
-
# @option options [Symbol, Array] :except
|
400
|
-
# Group(s) to exclude which will cause any sources marked as a member of the
|
399
|
+
# @option options [Symbol, Array] :except
|
400
|
+
# Group(s) to exclude which will cause any sources marked as a member of the
|
401
401
|
# group to not be installed
|
402
402
|
# @option options [Symbol, Array] :only
|
403
403
|
# Group(s) to include which will cause any sources marked as a member of the
|
@@ -135,7 +135,7 @@ module Berkshelf
|
|
135
135
|
#
|
136
136
|
# example:
|
137
137
|
# {
|
138
|
-
# "da97c94bb6acb2b7900cbf951654fea3" => "/Users/reset/.berkshelf/nginx-0.101.2/README.md"
|
138
|
+
# "da97c94bb6acb2b7900cbf951654fea3" => "/Users/reset/.berkshelf/nginx-0.101.2/README.md"
|
139
139
|
# }
|
140
140
|
def checksums
|
141
141
|
{}.tap do |checksums|
|