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.
Files changed (48) hide show
  1. data/.travis.yml +2 -0
  2. data/Gemfile +11 -11
  3. data/Guardfile +1 -1
  4. data/README.md +1 -1
  5. data/berkshelf.gemspec +10 -11
  6. data/features/config.feature +1 -1
  7. data/features/cookbook_command.feature +1 -1
  8. data/features/default_locations.feature +6 -6
  9. data/features/groups_install.feature +3 -3
  10. data/features/init_command.feature +1 -1
  11. data/features/lockfile.feature +1 -1
  12. data/features/support/env.rb +1 -1
  13. data/features/upload_command.feature +1 -1
  14. data/lib/berkshelf.rb +14 -14
  15. data/lib/berkshelf/base_generator.rb +1 -1
  16. data/lib/berkshelf/berksfile.rb +22 -22
  17. data/lib/berkshelf/cached_cookbook.rb +1 -1
  18. data/lib/berkshelf/cli.rb +1 -1
  19. data/lib/berkshelf/cookbook_generator.rb +1 -1
  20. data/lib/berkshelf/cookbook_source.rb +1 -1
  21. data/lib/berkshelf/cookbook_store.rb +2 -2
  22. data/lib/berkshelf/core_ext/file_utils.rb +1 -1
  23. data/lib/berkshelf/core_ext/pathname.rb +2 -2
  24. data/lib/berkshelf/formatters.rb +1 -1
  25. data/lib/berkshelf/formatters/json.rb +1 -1
  26. data/lib/berkshelf/git.rb +2 -2
  27. data/lib/berkshelf/init_generator.rb +1 -1
  28. data/lib/berkshelf/location.rb +2 -2
  29. data/lib/berkshelf/locations/chef_api_location.rb +15 -8
  30. data/lib/berkshelf/locations/git_location.rb +2 -2
  31. data/lib/berkshelf/locations/site_location.rb +3 -3
  32. data/lib/berkshelf/resolver.rb +2 -2
  33. data/lib/berkshelf/vagrant/action/validate.rb +3 -3
  34. data/lib/berkshelf/vagrant/middleware.rb +1 -1
  35. data/lib/berkshelf/version.rb +1 -1
  36. data/spec/spec_helper.rb +6 -5
  37. data/spec/unit/berkshelf/berksfile_spec.rb +9 -9
  38. data/spec/unit/berkshelf/config_spec.rb +1 -1
  39. data/spec/unit/berkshelf/cookbook_source_spec.rb +3 -3
  40. data/spec/unit/berkshelf/cookbook_store_spec.rb +1 -1
  41. data/spec/unit/berkshelf/downloader_spec.rb +3 -3
  42. data/spec/unit/berkshelf/git_spec.rb +1 -1
  43. data/spec/unit/berkshelf/location_spec.rb +3 -3
  44. data/spec/unit/berkshelf/locations/chef_api_location_spec.rb +10 -12
  45. data/spec/unit/berkshelf/locations/git_location_spec.rb +2 -2
  46. data/spec/unit/berkshelf/lockfile_spec.rb +1 -1
  47. data/spec/unit/berkshelf/resolver_spec.rb +5 -5
  48. metadata +38 -54
@@ -1,7 +1,9 @@
1
1
  rvm:
2
2
  - 1.9.2
3
3
  - 1.9.3
4
+ - ruby-head
4
5
  matrix:
5
6
  allow_failures:
6
7
  - rvm: 1.9.2
8
+ - rvm: ruby-head
7
9
  script: 'bundle exec thor spec:ci'
data/Gemfile CHANGED
@@ -3,15 +3,15 @@ source :rubygems
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem 'yard'
7
- gem 'spork'
6
+ gem 'coolline'
8
7
  gem 'guard', '>= 1.5.0'
9
- gem 'guard-yard'
8
+ gem 'guard-cucumber'
10
9
  gem 'guard-rspec'
11
10
  gem 'guard-spork'
12
- gem 'guard-cucumber'
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 'thor'
39
- gem 'rake', '>= 0.9.2.2'
40
- gem 'rspec'
38
+ gem 'aruba'
41
39
  gem 'fuubar'
42
40
  gem 'json_spec'
43
- gem 'webmock'
41
+ gem 'rake', '>= 0.9.2.2'
42
+ gem 'rspec'
43
+ gem 'thor'
44
44
  gem 'vcr'
45
- gem 'aruba'
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', version: 2, cli: "--color --drb --format Fuubar", all_on_start: false, all_after_pass: false do
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
 
@@ -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.add_runtime_dependency 'chozo', '>= 0.2.1'
30
- s.add_runtime_dependency 'ridley', '>= 0.0.5'
31
- s.add_runtime_dependency 'solve', '>= 0.4.0.rc1'
32
- s.add_runtime_dependency 'chef', '~> 10.12'
33
- s.add_runtime_dependency 'minitar'
34
- s.add_runtime_dependency 'thor', '~> 0.16.0'
35
- s.add_runtime_dependency 'vagrant', '~> 1.0.5'
36
- s.add_runtime_dependency 'activesupport'
37
- s.add_runtime_dependency 'multi_json'
38
- s.add_runtime_dependency 'hashie'
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
@@ -1,5 +1,5 @@
1
1
  Feature: cookbook creation with a config file
2
- As a Cookbook author
2
+ As a Cookbook author
3
3
  I want to quickly generate a cookbook with my own customizations
4
4
  So that I don't have to spend time modifying the default generated output each time
5
5
 
@@ -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 :knife
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 :knife
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 :knife
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 :knife
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 :knife
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
@@ -1,5 +1,5 @@
1
1
  Feature: initialize command
2
- As a Cookbook author
2
+ As a Cookbook author
3
3
  I want a way to quickly prepare a Cookbook on my local disk with Berkshelf files
4
4
  So that I can resolve my Cookbook's dependencies with Berkshelf
5
5
 
@@ -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
@@ -62,6 +62,6 @@ end
62
62
 
63
63
  Spork.each_run do
64
64
  Berkshelf::RSpec::Knife.load_knife_config(File.join(APP_ROOT, 'spec/knife.rb'))
65
-
65
+
66
66
  require 'berkshelf'
67
67
  end
@@ -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
  """
@@ -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 :InitGenerator, 'berkshelf/init_generator'
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 :Uploader, 'berkshelf/uploader'
40
+ autoload :Git, 'berkshelf/git'
41
+ autoload :InitGenerator, 'berkshelf/init_generator'
42
+ autoload :Lockfile, 'berkshelf/lockfile'
44
43
  autoload :Resolver, 'berkshelf/resolver'
45
- autoload :Config, 'berkshelf/config'
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|
@@ -8,7 +8,7 @@ module Berkshelf
8
8
  Berkshelf.root.join("generator_files")
9
9
  end
10
10
  end
11
-
11
+
12
12
  include Thor::Actions
13
13
 
14
14
  def initialize(*args)
@@ -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 Knife config
94
- # cookbook 'artifact', chef_api: :knife
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 :knife can be provided
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
- # knife configuration.
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 :knife can be provided
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
- # knife configuration.
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 :knife as the value of the chef_api default location will attempt to use the
212
- # contents of your user's Knife.rb to find the Chef API to interact with.
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 :knife to add a Chef API default location
215
- # chef_api :knife
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|
@@ -11,7 +11,7 @@ module Berkshelf
11
11
  Berkshelf.formatter.cleanup_hook unless config[:current_task].name == "help"
12
12
  end
13
13
  end
14
-
14
+
15
15
  def initialize(*args)
16
16
  super(*args)
17
17