berkshelf 5.5.0 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -3
  3. data/Gemfile +31 -31
  4. data/Gemfile.lock +3 -3
  5. data/Guardfile +13 -13
  6. data/Rakefile +1 -0
  7. data/Thorfile +16 -16
  8. data/berkshelf.gemspec +35 -35
  9. data/features/step_definitions/chef/config_steps.rb +4 -4
  10. data/features/step_definitions/chef_server_steps.rb +6 -6
  11. data/features/step_definitions/cli_steps.rb +3 -3
  12. data/features/step_definitions/config_steps.rb +5 -5
  13. data/features/step_definitions/filesystem_steps.rb +12 -11
  14. data/features/support/env.rb +21 -21
  15. data/lib/berkshelf.rb +66 -66
  16. data/lib/berkshelf/base_generator.rb +10 -11
  17. data/lib/berkshelf/berksfile.rb +38 -38
  18. data/lib/berkshelf/cached_cookbook.rb +7 -7
  19. data/lib/berkshelf/cli.rb +126 -126
  20. data/lib/berkshelf/commands/shelf.rb +19 -18
  21. data/lib/berkshelf/commands/test_command.rb +2 -2
  22. data/lib/berkshelf/community_rest.rb +38 -38
  23. data/lib/berkshelf/config.rb +42 -41
  24. data/lib/berkshelf/cookbook_generator.rb +38 -38
  25. data/lib/berkshelf/cookbook_store.rb +4 -4
  26. data/lib/berkshelf/core_ext/file_utils.rb +1 -1
  27. data/lib/berkshelf/dependency.rb +23 -21
  28. data/lib/berkshelf/downloader.rb +24 -25
  29. data/lib/berkshelf/errors.rb +17 -17
  30. data/lib/berkshelf/file_syncer.rb +9 -8
  31. data/lib/berkshelf/formatters/human.rb +3 -3
  32. data/lib/berkshelf/formatters/json.rb +2 -2
  33. data/lib/berkshelf/init_generator.rb +64 -64
  34. data/lib/berkshelf/installer.rb +103 -102
  35. data/lib/berkshelf/location.rb +9 -9
  36. data/lib/berkshelf/locations/git.rb +16 -16
  37. data/lib/berkshelf/locations/github.rb +1 -1
  38. data/lib/berkshelf/locations/path.rb +2 -2
  39. data/lib/berkshelf/lockfile.rb +309 -315
  40. data/lib/berkshelf/mixin/git.rb +3 -3
  41. data/lib/berkshelf/packager.rb +4 -4
  42. data/lib/berkshelf/resolver.rb +2 -2
  43. data/lib/berkshelf/resolver/graph.rb +1 -1
  44. data/lib/berkshelf/shell.rb +1 -1
  45. data/lib/berkshelf/source.rb +6 -6
  46. data/lib/berkshelf/source_uri.rb +2 -2
  47. data/lib/berkshelf/ssl_policies.rb +3 -3
  48. data/lib/berkshelf/thor.rb +1 -1
  49. data/lib/berkshelf/uploader.rb +48 -48
  50. data/lib/berkshelf/validator.rb +2 -2
  51. data/lib/berkshelf/version.rb +1 -1
  52. data/lib/berkshelf/visualizer.rb +11 -11
  53. data/spec/config/knife.rb +2 -2
  54. data/spec/fixtures/Berksfile +3 -3
  55. data/spec/fixtures/cookbook-path/jenkins-config/metadata.rb +3 -3
  56. data/spec/fixtures/cookbook-store/jenkins-2.0.3/metadata.rb +5 -5
  57. data/spec/fixtures/cookbook-store/jenkins-2.0.4/metadata.rb +4 -4
  58. data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +3 -3
  59. data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +3 -3
  60. data/spec/spec_helper.rb +9 -9
  61. data/spec/support/chef_api.rb +11 -12
  62. data/spec/support/chef_server.rb +10 -10
  63. data/spec/support/git.rb +23 -23
  64. data/spec/support/kitchen.rb +2 -2
  65. data/spec/support/matchers/filepath_matchers.rb +2 -2
  66. data/spec/support/path_helpers.rb +12 -12
  67. data/spec/support/shared_examples/formatter.rb +1 -1
  68. data/spec/unit/berkshelf/berksfile_spec.rb +78 -78
  69. data/spec/unit/berkshelf/cached_cookbook_spec.rb +42 -42
  70. data/spec/unit/berkshelf/cli_spec.rb +6 -6
  71. data/spec/unit/berkshelf/community_rest_spec.rb +83 -83
  72. data/spec/unit/berkshelf/config_spec.rb +13 -13
  73. data/spec/unit/berkshelf/cookbook_generator_spec.rb +39 -39
  74. data/spec/unit/berkshelf/cookbook_store_spec.rb +41 -41
  75. data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +5 -6
  76. data/spec/unit/berkshelf/core_ext/pathname_spec.rb +1 -1
  77. data/spec/unit/berkshelf/dependency_spec.rb +43 -43
  78. data/spec/unit/berkshelf/downloader_spec.rb +20 -20
  79. data/spec/unit/berkshelf/errors_spec.rb +3 -3
  80. data/spec/unit/berkshelf/file_syncer_spec.rb +86 -86
  81. data/spec/unit/berkshelf/formatters/base_spec.rb +23 -23
  82. data/spec/unit/berkshelf/formatters/human_spec.rb +2 -2
  83. data/spec/unit/berkshelf/formatters/json_spec.rb +2 -2
  84. data/spec/unit/berkshelf/formatters/null_spec.rb +3 -3
  85. data/spec/unit/berkshelf/init_generator_spec.rb +92 -92
  86. data/spec/unit/berkshelf/installer_spec.rb +8 -8
  87. data/spec/unit/berkshelf/location_spec.rb +11 -11
  88. data/spec/unit/berkshelf/locations/base_spec.rb +35 -35
  89. data/spec/unit/berkshelf/locations/git_spec.rb +87 -87
  90. data/spec/unit/berkshelf/locations/path_spec.rb +40 -40
  91. data/spec/unit/berkshelf/lockfile_parser_spec.rb +71 -71
  92. data/spec/unit/berkshelf/lockfile_spec.rb +197 -197
  93. data/spec/unit/berkshelf/logger_spec.rb +3 -3
  94. data/spec/unit/berkshelf/mixin/logging_spec.rb +5 -5
  95. data/spec/unit/berkshelf/packager_spec.rb +2 -2
  96. data/spec/unit/berkshelf/resolver/graph_spec.rb +1 -1
  97. data/spec/unit/berkshelf/resolver_spec.rb +17 -17
  98. data/spec/unit/berkshelf/shell_spec.rb +34 -34
  99. data/spec/unit/berkshelf/source_spec.rb +12 -11
  100. data/spec/unit/berkshelf/source_uri_spec.rb +1 -1
  101. data/spec/unit/berkshelf/ssl_policies_spec.rb +25 -25
  102. data/spec/unit/berkshelf/uploader_spec.rb +54 -54
  103. data/spec/unit/berkshelf/validator_spec.rb +16 -16
  104. data/spec/unit/berkshelf/visualizer_spec.rb +17 -17
  105. data/spec/unit/berkshelf_spec.rb +18 -18
  106. metadata +5 -5
@@ -58,13 +58,13 @@ module Berkshelf
58
58
  "files/default",
59
59
  "attributes",
60
60
  "providers",
61
- "resources"
61
+ "resources",
62
62
  ]
63
63
  files = [
64
64
  "recipes/default.rb",
65
65
  "templates/default/template.erb",
66
66
  "files/default/file.h",
67
- "attributes/default.rb"
67
+ "attributes/default.rb",
68
68
  ]
69
69
 
70
70
  directories.each do |directory|
@@ -82,7 +82,6 @@ module Berkshelf
82
82
  a << "" # ensure newline
83
83
  end.join("\n")
84
84
 
85
-
86
85
  if options[:dependencies]
87
86
  options[:dependencies].each do |name, constraint|
88
87
  metadata << "depends '#{name}', '#{constraint}'\n"
@@ -95,7 +94,7 @@ module Berkshelf
95
94
  end
96
95
  end
97
96
 
98
- File.open(cookbook_path.join("metadata.rb"), 'w+') do |f|
97
+ File.open(cookbook_path.join("metadata.rb"), "w+") do |f|
99
98
  f.write metadata
100
99
  end
101
100
 
@@ -120,14 +119,14 @@ module Berkshelf
120
119
 
121
120
  private
122
121
 
123
- def ridley
124
- @ridley ||= Ridley.new(
125
- server_url: Berkshelf::RSpec::ChefServer.server_url,
126
- client_name: Berkshelf.chef_config[:node_name],
127
- client_key: Berkshelf.chef_config[:client_key],
128
- ssl: { verify: false }
129
- )
130
- end
122
+ def ridley
123
+ @ridley ||= Ridley.new(
124
+ server_url: Berkshelf::RSpec::ChefServer.server_url,
125
+ client_name: Berkshelf.chef_config[:node_name],
126
+ client_key: Berkshelf.chef_config[:client_key],
127
+ ssl: { verify: false }
128
+ )
129
+ end
131
130
  end
132
131
  end
133
132
  end
@@ -1,5 +1,5 @@
1
- require 'chef_zero/server'
2
- require 'json'
1
+ require "chef_zero/server"
2
+ require "json"
3
3
 
4
4
  module Berkshelf::RSpec
5
5
  module ChefServer
@@ -58,18 +58,18 @@ module Berkshelf::RSpec
58
58
  end
59
59
 
60
60
  def chef_cookbook(name, hash = {})
61
- chef_server.load_data({ 'cookbooks' => { name => hash }})
61
+ chef_server.load_data({ "cookbooks" => { name => hash } })
62
62
  end
63
63
 
64
64
  def chef_cookbooks
65
- chef_server.data_store.list(['organizations', 'chef', 'cookbooks']).inject({}) do |hash, name|
66
- hash[name] = chef_server.data_store.list(['organizations', 'chef', 'cookbooks', name])
65
+ chef_server.data_store.list(%w{organizations chef cookbooks}).inject({}) do |hash, name|
66
+ hash[name] = chef_server.data_store.list(["organizations", "chef", "cookbooks", name])
67
67
  hash
68
68
  end
69
69
  end
70
70
 
71
71
  def chef_data_bag(name, hash = {})
72
- chef_server.load_data({ 'data' => { name => hash }})
72
+ chef_server.load_data({ "data" => { name => hash } })
73
73
  end
74
74
 
75
75
  def chef_environment(name, hash = {})
@@ -77,7 +77,7 @@ module Berkshelf::RSpec
77
77
  end
78
78
 
79
79
  def chef_environment_locks(name)
80
- JSON.parse(chef_server.data_store.get(['organizations', 'chef', 'environments', name]))['cookbook_versions']
80
+ JSON.parse(chef_server.data_store.get(["organizations", "chef", "environments", name]))["cookbook_versions"]
81
81
  rescue ChefZero::DataStore::DataNotFoundError
82
82
  {}
83
83
  end
@@ -92,8 +92,8 @@ module Berkshelf::RSpec
92
92
 
93
93
  private
94
94
 
95
- def load_data(key, name, hash)
96
- chef_server.load_data({ key.to_s => { name => JSON.generate(hash) }})
97
- end
95
+ def load_data(key, name, hash)
96
+ chef_server.load_data({ key.to_s => { name => JSON.generate(hash) } })
97
+ end
98
98
  end
99
99
  end
@@ -1,10 +1,10 @@
1
1
  module Berkshelf
2
2
  module RSpec
3
3
  module Git
4
- require 'buff/shell_out'
4
+ require "buff/shell_out"
5
5
  include Buff::ShellOut
6
6
 
7
- require_relative 'path_helpers'
7
+ require_relative "path_helpers"
8
8
  include Berkshelf::RSpec::PathHelpers
9
9
 
10
10
  def git_origin_for(repo, options = {})
@@ -12,8 +12,8 @@ module Berkshelf
12
12
  end
13
13
 
14
14
  def generate_fake_git_remote(uri, options = {})
15
- name = uri.split('/').last || 'rspec_cookbook'
16
- name = name.gsub('.git', '')
15
+ name = uri.split("/").last || "rspec_cookbook"
16
+ name = name.gsub(".git", "")
17
17
  path = remotes.join(name)
18
18
 
19
19
  capture(:stdout) do
@@ -86,16 +86,16 @@ module Berkshelf
86
86
  # The path to store the local git clones.
87
87
  #
88
88
  # @return [Pathname]
89
- def clones
90
- ensure_and_return(tmp_path.join('clones'))
91
- end
89
+ def clones
90
+ ensure_and_return(tmp_path.join("clones"))
91
+ end
92
92
 
93
93
  # The path to store the git remotes.
94
94
  #
95
95
  # @return [Pathname]
96
- def remotes
97
- ensure_and_return(tmp_path.join('remotes'))
98
- end
96
+ def remotes
97
+ ensure_and_return(tmp_path.join("remotes"))
98
+ end
99
99
 
100
100
  # Generate a cookbook by the given name.
101
101
  #
@@ -103,15 +103,15 @@ module Berkshelf
103
103
  # the name of the cookbook to create
104
104
  # @param [Hash] options
105
105
  # the list ooptions to pass to the generator
106
- def generate_git_cookbook(name, options = {})
107
- options = {
108
- skip_vagrant: true,
109
- skip_test_kitchen: true,
110
- force: true,
111
- }.merge(options)
112
-
113
- Berkshelf::Cli.new.invoke(:cookbook, [name.to_s], options)
114
- end
106
+ def generate_git_cookbook(name, options = {})
107
+ options = {
108
+ skip_vagrant: true,
109
+ skip_test_kitchen: true,
110
+ force: true,
111
+ }.merge(options)
112
+
113
+ Berkshelf::Cli.new.invoke(:cookbook, [name.to_s], options)
114
+ end
115
115
 
116
116
  # Make sure the given path exists and return the path
117
117
  #
@@ -119,10 +119,10 @@ module Berkshelf
119
119
  # the path to create and return
120
120
  #
121
121
  # @return [Pathname]
122
- def ensure_and_return(path)
123
- FileUtils.mkdir(path) unless File.exist?(path)
124
- return Pathname.new(path).expand_path
125
- end
122
+ def ensure_and_return(path)
123
+ FileUtils.mkdir(path) unless File.exist?(path)
124
+ return Pathname.new(path).expand_path
125
+ end
126
126
  end
127
127
  end
128
128
  end
@@ -1,10 +1,10 @@
1
1
  module Berkshelf
2
2
  module RSpec
3
3
  module Kitchen
4
- require 'kitchen/generator/init'
4
+ require "kitchen/generator/init"
5
5
 
6
6
  def stub_kitchen!
7
- generator = double('kitchen-generator', invoke_all: nil)
7
+ generator = double("kitchen-generator", invoke_all: nil)
8
8
  allow(::Kitchen::Generator::Init).to receive(:new)
9
9
  .with(any_args())
10
10
  .and_return(generator)
@@ -1,5 +1,5 @@
1
- require 'rspec/expectations'
2
- require 'pathname'
1
+ require "rspec/expectations"
2
+ require "pathname"
3
3
 
4
4
  RSpec::Matchers.define :be_relative_path do
5
5
  match do |given|
@@ -5,7 +5,7 @@ module Berkshelf
5
5
  #
6
6
  # @return [Pathname]
7
7
  def berkshelf_path
8
- tmp_path.join('berkshelf').expand_path
8
+ tmp_path.join("berkshelf").expand_path
9
9
  end
10
10
 
11
11
  # The Berkshelf cookbook store
@@ -19,21 +19,21 @@ module Berkshelf
19
19
  #
20
20
  # @return [Pathname]
21
21
  def tmp_path
22
- Berkshelf.root.join('spec/tmp')
22
+ Berkshelf.root.join("spec/tmp")
23
23
  end
24
24
 
25
25
  # The path to the spec fixtures
26
26
  #
27
27
  # @return [Pathname]
28
28
  def fixtures_path
29
- Berkshelf.root.join('spec/fixtures')
29
+ Berkshelf.root.join("spec/fixtures")
30
30
  end
31
31
 
32
32
  # The path to the Chef config fixture
33
33
  #
34
34
  # @return [String]
35
35
  def chef_config_path
36
- Berkshelf.root.join('spec/config/knife.rb').to_s
36
+ Berkshelf.root.join("spec/config/knife.rb").to_s
37
37
  end
38
38
 
39
39
  # The actual Chef config object
@@ -54,16 +54,16 @@ module Berkshelf
54
54
  # directory on each run.
55
55
  #
56
56
  # @return [nil]
57
- def reload_configs
58
- Berkshelf.chef_config = chef_config
57
+ def reload_configs
58
+ Berkshelf.chef_config = chef_config
59
59
 
60
- # This fucking sucks...
61
- # load 'berkshelf/chef/config.rb'
62
- load 'berkshelf/config.rb'
60
+ # This fucking sucks...
61
+ # load 'berkshelf/chef/config.rb'
62
+ load "berkshelf/config.rb"
63
63
 
64
- Berkshelf.config = Berkshelf::Config.new
65
- nil
66
- end
64
+ Berkshelf.config = Berkshelf::Config.new
65
+ nil
66
+ end
67
67
  end
68
68
  end
69
69
  end
@@ -1,4 +1,4 @@
1
- require 'rspec'
1
+ require "rspec"
2
2
 
3
3
  RSpec.shared_examples "a formatter object" do
4
4
  Berkshelf::BaseFormatter.instance_methods(false).each do |name|
@@ -1,8 +1,8 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Berkshelf::Berksfile do
4
4
  describe "ClassMethods" do
5
- describe '::from_file' do
5
+ describe "::from_file" do
6
6
  let(:content) do
7
7
  <<-EOF.strip
8
8
  cookbook 'ntp', '<= 1.0.0'
@@ -12,13 +12,13 @@ describe Berkshelf::Berksfile do
12
12
  solver :foo, :required
13
13
  EOF
14
14
  end
15
- let(:berksfile) { tmp_path.join('Berksfile') }
15
+ let(:berksfile) { tmp_path.join("Berksfile") }
16
16
 
17
- before { File.open(berksfile, 'w+') { |f| f.write(content) } }
17
+ before { File.open(berksfile, "w+") { |f| f.write(content) } }
18
18
  subject(:from_file) { described_class.from_file(berksfile) }
19
19
 
20
20
  it "reads the content of the Berksfile and binds them to a new instance" do
21
- %w(ntp mysql nginx ssh_known_hosts2).each do |name|
21
+ %w{ntp mysql nginx ssh_known_hosts2}.each do |name|
22
22
  expect(subject).to have_dependency(name)
23
23
  end
24
24
  end
@@ -27,62 +27,62 @@ describe Berkshelf::Berksfile do
27
27
  expect(subject).to be_a(described_class)
28
28
  end
29
29
 
30
- context 'when Berksfile does not exist at given path' do
31
- let(:bad_path) { tmp_path.join('thisdoesnotexist') }
30
+ context "when Berksfile does not exist at given path" do
31
+ let(:bad_path) { tmp_path.join("thisdoesnotexist") }
32
32
 
33
- it 'raises BerksfileNotFound' do
34
- expect {
33
+ it "raises BerksfileNotFound" do
34
+ expect do
35
35
  Berkshelf::Berksfile.from_file(bad_path)
36
- }.to raise_error(Berkshelf::BerksfileNotFound)
36
+ end.to raise_error(Berkshelf::BerksfileNotFound)
37
37
  end
38
38
  end
39
39
  end
40
40
  end
41
41
 
42
- let(:dependency_one) { double('dependency_one', name: 'nginx') }
43
- let(:dependency_two) { double('dependency_two', name: 'mysql') }
42
+ let(:dependency_one) { double("dependency_one", name: "nginx") }
43
+ let(:dependency_two) { double("dependency_two", name: "mysql") }
44
44
 
45
45
  subject do
46
- berksfile_path = tmp_path.join('Berksfile').to_s
46
+ berksfile_path = tmp_path.join("Berksfile").to_s
47
47
  FileUtils.touch(berksfile_path)
48
48
  Berkshelf::Berksfile.new(berksfile_path)
49
49
  end
50
50
 
51
- describe '#cookbook' do
52
- let(:name) { 'artifact' }
53
- let(:constraint) { double('constraint') }
51
+ describe "#cookbook" do
52
+ let(:name) { "artifact" }
53
+ let(:constraint) { double("constraint") }
54
54
  let(:default_options) { { group: [] } }
55
55
 
56
- it 'sends the add_dependency message with the name, constraint, and options to the instance of the includer' do
56
+ it "sends the add_dependency message with the name, constraint, and options to the instance of the includer" do
57
57
  expect(subject).to receive(:add_dependency).with(name, constraint, default_options)
58
58
  subject.cookbook(name, constraint, default_options)
59
59
  end
60
60
 
61
- it 'merges the default options into specified options' do
62
- expect(subject).to receive(:add_dependency)do |arg_name, arg_constraint, arg_options|
61
+ it "merges the default options into specified options" do
62
+ expect(subject).to receive(:add_dependency) do |arg_name, arg_constraint, arg_options|
63
63
  expect(arg_name).to eq(name)
64
64
  expect(arg_constraint).to eq(constraint)
65
65
  expect(arg_options[:path]).to match(%r{/Users/reset})
66
66
  expect(arg_options[:group]).to eq([])
67
67
  end
68
68
 
69
- subject.cookbook(name, constraint, path: '/Users/reset')
69
+ subject.cookbook(name, constraint, path: "/Users/reset")
70
70
  end
71
71
 
72
- it 'converts a single specified group option into an array of groups' do
72
+ it "converts a single specified group option into an array of groups" do
73
73
  expect(subject).to receive(:add_dependency).with(name, constraint, group: [:production])
74
74
  subject.cookbook(name, constraint, group: :production)
75
75
  end
76
76
 
77
- context 'when no constraint specified' do
78
- it 'sends the add_dependency message with a nil value for constraint' do
77
+ context "when no constraint specified" do
78
+ it "sends the add_dependency message with a nil value for constraint" do
79
79
  expect(subject).to receive(:add_dependency).with(name, nil, default_options)
80
80
  subject.cookbook(name, default_options)
81
81
  end
82
82
  end
83
83
 
84
- context 'when no options specified' do
85
- it 'sends the add_dependency message with an empty Hash for the value of options' do
84
+ context "when no options specified" do
85
+ it "sends the add_dependency message with an empty Hash for the value of options" do
86
86
  expect(subject).to receive(:add_dependency).with(name, constraint, default_options)
87
87
  subject.cookbook(name, constraint)
88
88
  end
@@ -93,11 +93,11 @@ describe Berkshelf::Berksfile do
93
93
  end
94
94
  end
95
95
 
96
- describe '#group' do
97
- let(:name) { 'artifact' }
98
- let(:group) { 'production' }
96
+ describe "#group" do
97
+ let(:name) { "artifact" }
98
+ let(:group) { "production" }
99
99
 
100
- it 'sends the add_dependency message with an array of groups determined by the parameter to the group block' do
100
+ it "sends the add_dependency message with an array of groups determined by the parameter to the group block" do
101
101
  expect(subject).to receive(:add_dependency).with(name, nil, group: [group])
102
102
 
103
103
  subject.group(group) do
@@ -110,14 +110,14 @@ describe Berkshelf::Berksfile do
110
110
  end
111
111
  end
112
112
 
113
- describe '#metadata' do
114
- let(:path) { fixtures_path.join('cookbooks/example_cookbook') }
115
- subject { Berkshelf::Berksfile.new(path.join('Berksfile')) }
113
+ describe "#metadata" do
114
+ let(:path) { fixtures_path.join("cookbooks/example_cookbook") }
115
+ subject { Berkshelf::Berksfile.new(path.join("Berksfile")) }
116
116
 
117
117
  before { Dir.chdir(path) }
118
118
 
119
- it 'sends the add_dependency message with an explicit version constraint and the path to the cookbook' do
120
- expect(subject).to receive(:add_dependency).with('example_cookbook', nil, path: path.to_s, metadata: true)
119
+ it "sends the add_dependency message with an explicit version constraint and the path to the cookbook" do
120
+ expect(subject).to receive(:add_dependency).with("example_cookbook", nil, path: path.to_s, metadata: true)
121
121
  subject.metadata
122
122
  end
123
123
 
@@ -171,9 +171,9 @@ describe Berkshelf::Berksfile do
171
171
  describe "#sources" do
172
172
  context "when there are no sources" do
173
173
  it "raises an exception" do
174
- expect {
174
+ expect do
175
175
  subject.sources
176
- }.to raise_error(Berkshelf::NoAPISourcesDefined)
176
+ end.to raise_error(Berkshelf::NoAPISourcesDefined)
177
177
  end
178
178
  end
179
179
 
@@ -212,21 +212,21 @@ describe Berkshelf::Berksfile do
212
212
  end
213
213
  end
214
214
 
215
- describe '#extension' do
215
+ describe "#extension" do
216
216
  it "is a DSL method" do
217
217
  expect(subject).to have_exposed_method(:extension)
218
218
  end
219
219
  end
220
220
 
221
- describe '#dependencies' do
221
+ describe "#dependencies" do
222
222
  let(:groups) do
223
223
  [
224
224
  :nautilus,
225
- :skarner
225
+ :skarner,
226
226
  ]
227
227
  end
228
228
 
229
- it 'returns all Berkshelf::Dependencys added to the instance of Berksfile' do
229
+ it "returns all Berkshelf::Dependencys added to the instance of Berksfile" do
230
230
  subject.add_dependency(dependency_one.name)
231
231
  subject.add_dependency(dependency_two.name)
232
232
 
@@ -236,15 +236,15 @@ describe Berkshelf::Berksfile do
236
236
  end
237
237
  end
238
238
 
239
- describe '#cookbooks' do
240
- it 'raises an exception if a cookbook is not installed' do
241
- subject.add_dependency('bacon', nil)
239
+ describe "#cookbooks" do
240
+ it "raises an exception if a cookbook is not installed" do
241
+ subject.add_dependency("bacon", nil)
242
242
  expect { subject.cookbooks }.to raise_error(Berkshelf::DependencyNotFound)
243
243
  end
244
244
 
245
- it 'retrieves the locked (cached) cookbook for each dependency' do
246
- subject.add_dependency('bacon', nil)
247
- subject.add_dependency('ham', nil)
245
+ it "retrieves the locked (cached) cookbook for each dependency" do
246
+ subject.add_dependency("bacon", nil)
247
+ subject.add_dependency("ham", nil)
248
248
  allow(subject).to receive(:retrive_locked)
249
249
 
250
250
  expect(subject).to receive(:retrieve_locked).twice
@@ -252,29 +252,29 @@ describe Berkshelf::Berksfile do
252
252
  end
253
253
  end
254
254
 
255
- describe '#groups' do
255
+ describe "#groups" do
256
256
  before do
257
257
  allow(subject).to receive(:dependencies) { [dependency_one, dependency_two] }
258
258
  allow(dependency_one).to receive(:groups) { [:nautilus, :skarner] }
259
259
  allow(dependency_two).to receive(:groups) { [:nautilus, :riven] }
260
260
  end
261
261
 
262
- it 'returns a hash containing keys for every group a dependency is a member of' do
262
+ it "returns a hash containing keys for every group a dependency is a member of" do
263
263
  expect(subject.groups.keys.size).to eq(3)
264
264
  expect(subject.groups).to have_key(:nautilus)
265
265
  expect(subject.groups).to have_key(:skarner)
266
266
  expect(subject.groups).to have_key(:riven)
267
267
  end
268
268
 
269
- it 'returns an Array of Berkshelf::Dependencys who are members of the group for value' do
269
+ it "returns an Array of Berkshelf::Dependencys who are members of the group for value" do
270
270
  expect(subject.groups[:nautilus].size).to eq(2)
271
271
  expect(subject.groups[:riven].size).to eq(1)
272
272
  end
273
273
  end
274
274
 
275
- describe '#add_dependency' do
276
- let(:name) { 'cookbook_one' }
277
- let(:constraint) { '= 1.2.0' }
275
+ describe "#add_dependency" do
276
+ let(:name) { "cookbook_one" }
277
+ let(:constraint) { "= 1.2.0" }
278
278
  let(:options) { Hash.new }
279
279
 
280
280
  before(:each) do
@@ -283,7 +283,7 @@ describe Berkshelf::Berksfile do
283
283
 
284
284
  let(:dependency) { subject.dependencies.first }
285
285
 
286
- it 'adds new dependency to the list of dependencies' do
286
+ it "adds new dependency to the list of dependencies" do
287
287
  expect(subject.dependencies.size).to eq(1)
288
288
  end
289
289
 
@@ -299,10 +299,10 @@ describe Berkshelf::Berksfile do
299
299
  expect(dependency.version_constraint.to_s).to eq(constraint)
300
300
  end
301
301
 
302
- it 'raises DuplicateDependencyDefined if multiple dependencies of the same name are found' do
303
- expect {
302
+ it "raises DuplicateDependencyDefined if multiple dependencies of the same name are found" do
303
+ expect do
304
304
  subject.add_dependency(name)
305
- }.to raise_error(Berkshelf::DuplicateDependencyDefined)
305
+ end.to raise_error(Berkshelf::DuplicateDependencyDefined)
306
306
  end
307
307
 
308
308
  it "has a nil location if no location options are provided" do
@@ -326,7 +326,7 @@ describe Berkshelf::Berksfile do
326
326
  end
327
327
 
328
328
  context "when given the :path option" do
329
- let(:options) { { path: fixtures_path.join('cookbooks', 'example_cookbook') } }
329
+ let(:options) { { path: fixtures_path.join("cookbooks", "example_cookbook") } }
330
330
 
331
331
  it "has a PathLocation location" do
332
332
  expect(dependency.location).to be_a(Berkshelf::PathLocation)
@@ -334,23 +334,23 @@ describe Berkshelf::Berksfile do
334
334
  end
335
335
  end
336
336
 
337
- describe '#retrieve_locked' do
338
- let(:lockfile) { double('lockfile') }
339
- let(:dependency) { double('dependency', name: 'bacon') }
340
- let(:locked) { double('locked', cached_cookbook: cached, locked_version: '1.0.0') }
341
- let(:cached) { double('cached') }
337
+ describe "#retrieve_locked" do
338
+ let(:lockfile) { double("lockfile") }
339
+ let(:dependency) { double("dependency", name: "bacon") }
340
+ let(:locked) { double("locked", cached_cookbook: cached, locked_version: "1.0.0") }
341
+ let(:cached) { double("cached") }
342
342
 
343
343
  before do
344
344
  allow(subject).to receive(:lockfile).and_return(lockfile)
345
345
  end
346
346
 
347
- it 'delegates to the lockfile' do
347
+ it "delegates to the lockfile" do
348
348
  expect(lockfile).to receive(:retrieve).with(dependency)
349
349
  subject.retrieve_locked(dependency)
350
350
  end
351
351
  end
352
352
 
353
- describe '#upload' do
353
+ describe "#upload" do
354
354
  let(:uploader) { double(Berkshelf::Uploader, run: nil) }
355
355
 
356
356
  before do
@@ -361,22 +361,22 @@ describe Berkshelf::Berksfile do
361
361
  allow(Berkshelf::Uploader).to receive(:new).and_return(uploader)
362
362
  end
363
363
 
364
- it 'validates the lockfile is present' do
364
+ it "validates the lockfile is present" do
365
365
  expect(subject).to receive(:validate_lockfile_present!).once
366
366
  subject.upload
367
367
  end
368
368
 
369
- it 'validates the lockfile is trusted' do
369
+ it "validates the lockfile is trusted" do
370
370
  expect(subject).to receive(:validate_lockfile_trusted!).once
371
371
  subject.upload
372
372
  end
373
373
 
374
- it 'validates the dependencies are installed' do
374
+ it "validates the dependencies are installed" do
375
375
  expect(subject).to receive(:validate_dependencies_installed!).once
376
376
  subject.upload
377
377
  end
378
378
 
379
- it 'creates a new Uploader' do
379
+ it "creates a new Uploader" do
380
380
  expect(Berkshelf::Uploader).to receive(:new).with(subject)
381
381
  expect(uploader).to receive(:run)
382
382
 
@@ -384,31 +384,31 @@ describe Berkshelf::Berksfile do
384
384
  end
385
385
  end
386
386
 
387
- describe '#vendor' do
388
- let(:cached_cookbook) { double(Berkshelf::CachedCookbook, cookbook_name: 'my_cookbook', path: '/my_cookbook/path', compiled_metadata?: true) }
387
+ describe "#vendor" do
388
+ let(:cached_cookbook) { double(Berkshelf::CachedCookbook, cookbook_name: "my_cookbook", path: "/my_cookbook/path", compiled_metadata?: true) }
389
389
  let(:installer) { double(Berkshelf::Installer, run: [cached_cookbook]) }
390
- let(:raw_metadata_files) { [File::join(cached_cookbook.cookbook_name, 'metadata.rb')] }
390
+ let(:raw_metadata_files) { [File.join(cached_cookbook.cookbook_name, "metadata.rb")] }
391
391
 
392
- let(:destination) { '/a/destination/path' }
393
- let(:options) { { :exclude => raw_metadata_files + Berkshelf::Berksfile::EXCLUDED_VCS_FILES_WHEN_VENDORING, delete: nil } }
392
+ let(:destination) { "/a/destination/path" }
393
+ let(:options) { { :exclude => raw_metadata_files + Berkshelf::Berksfile::EXCLUDED_VCS_FILES_WHEN_VENDORING, delete: nil } }
394
394
 
395
395
  before do
396
396
  allow(Berkshelf::Installer).to receive(:new).and_return(installer)
397
397
  end
398
398
 
399
- it 'invokes FileSyncer with correct arguments' do
399
+ it "invokes FileSyncer with correct arguments" do
400
400
  expect(Berkshelf::FileSyncer).to receive(:sync).with(/vendor/, destination, options)
401
401
 
402
402
  subject.vendor(destination)
403
403
  end
404
404
 
405
- it 'excludes the top-level metadata.rb file' do
406
- expect(options[:exclude].any? { |exclude| File.fnmatch?(exclude, 'my_cookbook/recipes/metadata.rb', File::FNM_DOTMATCH) }).to be(false)
407
- expect(options[:exclude].any? { |exclude| File.fnmatch?(exclude, 'my_cookbook/metadata.rb', File::FNM_DOTMATCH) }).to be(true)
405
+ it "excludes the top-level metadata.rb file" do
406
+ expect(options[:exclude].any? { |exclude| File.fnmatch?(exclude, "my_cookbook/recipes/metadata.rb", File::FNM_DOTMATCH) }).to be(false)
407
+ expect(options[:exclude].any? { |exclude| File.fnmatch?(exclude, "my_cookbook/metadata.rb", File::FNM_DOTMATCH) }).to be(true)
408
408
  end
409
409
  end
410
410
 
411
- describe '#solver' do
411
+ describe "#solver" do
412
412
 
413
413
  let(:solver_precedence) { :please_dont_exist }
414
414