berkshelf 3.2.1 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf7c3d3ea8e0b023a45bc50f25be258b223b309d
4
- data.tar.gz: 3ec8c78126055e0185a1ebdf580d09876d420f3a
3
+ metadata.gz: 9fc48892092998c6c4609f996e7a0470b6dea6af
4
+ data.tar.gz: df867ca3468c988b011781e3c645f21a4eb8bfa6
5
5
  SHA512:
6
- metadata.gz: c086ee08241ace4cc037cb88d86bd76afb102f5a8fb8edfa9af20616e236a2ef6899a08f787c407cee1a282cf026c994c0860a6e7187b375384c082979597aff
7
- data.tar.gz: 19e8906d4b3971d28f1505dc2296fc1de85a7fb2013c5f47145c397d2fe5950f4b0cb021c6c5deffb8e017c36404e7a8daad3c99410d32371c4c8c5fe990e291
6
+ metadata.gz: 0423feeb86a7f1163daabb1ebf9e98aa6a69c945162bf48b39b83b08353a9402f035640519c028d6156d3c89a9802e44119966581b2a1f2f8b91bee419b808c5
7
+ data.tar.gz: ee5e644f38a0fa4a7a86b7565f290c749c0ab10be15716c54ac477e095315807280b49d8a1c779bf1317dd4217515bfe137b61c39f4f3e007f8546421e3c9288
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  > This is a high level digest of changes. For the complete CHANGELOG diff two tags in the project's [commit history](https://github.com/berkshelf/berkshelf/commits/master).
2
2
 
3
+ # 3.2.2
4
+
5
+ * Enhancements
6
+ * Use chef.io hostname in urls instead of getchef
7
+
8
+ * Bug Fixes
9
+ * Fix syntax issue in generated Vagrantfile
10
+ * Only exclude the top level metadata.rb file when vendoring cookbooks rather than all files named metadata.rb
11
+ * Relative paths can now be passed to berks vendor
12
+
3
13
  # 3.2.1
4
14
 
5
15
  * Bug Fixes
data/README.md CHANGED
@@ -9,7 +9,7 @@ Manage a Cookbook or an Application's Cookbook dependencies
9
9
 
10
10
  ## Installation
11
11
 
12
- Berkshelf is now included as part of the [Chef-DK](http://getchef.com/downloads/chef-dk). This is fastest, easiest, and the recommended installation method for getting up and running with Berkshelf.
12
+ Berkshelf is now included as part of the [Chef-DK](http://chef.io/downloads/chef-dk). This is fastest, easiest, and the recommended installation method for getting up and running with Berkshelf.
13
13
 
14
14
  > note: You may need to uninstall the Berkshelf gem especially if you are using a Ruby version manager you may need to uninstall all Berkshelf gems from each Ruby installation.
15
15
 
@@ -2,7 +2,7 @@ Feature: Evaluating a Berksfile
2
2
  Scenario: Containing pure Ruby
3
3
  Given I write to "Berksfile" with:
4
4
  """
5
- source 'https://supermarket.getchef.com'
5
+ source 'https://supermarket.chef.io'
6
6
 
7
7
  if ENV['BACON']
8
8
  puts "If you don't got bacon..."
@@ -407,7 +407,7 @@ Feature: berks upload
407
407
  """
408
408
  And the cookbook "fake" has the file "Berksfile" with:
409
409
  """
410
- source 'https://supermarket.getchef.com'
410
+ source 'https://supermarket.chef.io'
411
411
  metadata
412
412
  """
413
413
  And the cookbook "fake" has the file "Berksfile.lock" with:
@@ -1,4 +1,4 @@
1
- source "https://supermarket.getchef.com"
1
+ source "https://supermarket.chef.io"
2
2
  <% if options[:chef_minitest] -%>
3
3
 
4
4
  group :integration do
@@ -18,7 +18,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
18
18
  #
19
19
  # $ vagrant plugin install vagrant-omnibus
20
20
  #
21
- if Vagrant.has_plugin?
21
+ if Vagrant.has_plugin?("vagrant-omnibus")
22
22
  config.omnibus.chef_version = '<%= berkshelf_config.vagrant.omnibus.version %>'
23
23
  end
24
24
 
@@ -27,7 +27,11 @@ module Berkshelf
27
27
  end
28
28
  end
29
29
 
30
- DEFAULT_API_URL = "https://supermarket.getchef.com".freeze
30
+ DEFAULT_API_URL = "https://supermarket.chef.io".freeze
31
+
32
+ # Don't vendor VCS files.
33
+ # Reference GNU tar --exclude-vcs: https://www.gnu.org/software/tar/manual/html_section/tar_49.html
34
+ EXCLUDED_VCS_FILES_WHEN_VENDORING = ['.arch-ids', '{arch}', '.bzr', '.bzrignore', '.bzrtags', 'CVS', '.cvsignore', '_darcs', '.git', '.hg', '.hgignore', '.hgrags', 'RCS', 'SCCS', '.svn'].freeze
31
35
 
32
36
  include Mixin::Logging
33
37
  include Cleanroom
@@ -168,7 +172,7 @@ module Berkshelf
168
172
  # in a second source would not be used.
169
173
  #
170
174
  # @example
171
- # source "https://supermarket.getchef.com"
175
+ # source "https://supermarket.chef.io"
172
176
  # source "https://berks-api.riotgames.com"
173
177
  #
174
178
  # @param [String] api_url
@@ -204,7 +208,7 @@ module Berkshelf
204
208
  if args.first == :opscode
205
209
  Berkshelf.formatter.deprecation "Your Berksfile contains a site location pointing to the Opscode Community " +
206
210
  "Site (site :opscode). Site locations have been replaced by the source location. Change this to: " +
207
- "'source \"https://supermarket.getchef.com\"' to remove this warning. For more information visit " +
211
+ "'source \"https://supermarket.chef.io\"' to remove this warning. For more information visit " +
208
212
  "https://github.com/berkshelf/berkshelf/wiki/deprecated-locations"
209
213
  source(DEFAULT_API_URL)
210
214
  return
@@ -444,7 +448,7 @@ module Berkshelf
444
448
  # "nginx" => {
445
449
  # "local" => #<Version 1.8.0>,
446
450
  # "remote" => {
447
- # #<Source uri: "https://supermarket.getchef.com"> #=> #<Version 2.6.2>
451
+ # #<Source uri: "https://supermarket.chef.io"> #=> #<Version 2.6.2>
448
452
  # }
449
453
  # }
450
454
  # }
@@ -574,9 +578,10 @@ module Berkshelf
574
578
  # @return [String, nil]
575
579
  # the expanded path cookbooks were vendored to or nil if nothing was vendored
576
580
  def vendor(destination)
577
- Dir.mktmpdir do |scratch|
581
+ Dir.mktmpdir('vendor') do |scratch|
578
582
  chefignore = nil
579
583
  cached_cookbooks = install
584
+ raw_metadata_files = []
580
585
 
581
586
  return nil if cached_cookbooks.empty?
582
587
 
@@ -596,6 +601,8 @@ module Berkshelf
596
601
  cookbook.compile_metadata(cookbook_destination)
597
602
  end
598
603
 
604
+ raw_metadata_files << File::join(cookbook.cookbook_name, 'metadata.rb')
605
+
599
606
  FileUtils.cp_r(files, cookbook_destination)
600
607
  end
601
608
 
@@ -614,7 +621,7 @@ module Berkshelf
614
621
  #
615
622
  # * https://tickets.opscode.com/browse/CHEF-4811
616
623
  # * https://tickets.opscode.com/browse/CHEF-4810
617
- FileSyncer.sync(scratch, destination, exclude: ['**/metadata.rb'])
624
+ FileSyncer.sync(scratch, destination, exclude: raw_metadata_files + EXCLUDED_VCS_FILES_WHEN_VENDORING)
618
625
  end
619
626
 
620
627
  destination
@@ -50,7 +50,7 @@ module Berkshelf
50
50
  end
51
51
  end
52
52
 
53
- V1_API = 'https://supermarket.getchef.com'.freeze
53
+ V1_API = 'https://supermarket.chef.io'.freeze
54
54
 
55
55
  # @return [String]
56
56
  attr_reader :api_uri
@@ -450,7 +450,7 @@ module Berkshelf
450
450
  "default Berkshelf API server, add the following code to the top of " \
451
451
  "your Berksfile:" \
452
452
  "\n\n" \
453
- " source 'https://supermarket.getchef.com'"
453
+ " source 'https://supermarket.chef.io'"
454
454
  end
455
455
  end
456
456
 
@@ -81,6 +81,7 @@ module Berkshelf
81
81
  when :link
82
82
  target = File.readlink(source_file)
83
83
 
84
+ destination = File.expand_path(destination)
84
85
  Dir.chdir(destination) do
85
86
  FileUtils.ln_sf(target, "#{destination}/#{relative_path}")
86
87
  end
@@ -57,7 +57,7 @@ module Berkshelf
57
57
  #
58
58
  # @param [Hash] hash
59
59
  # the list of outdated cookbooks in the format
60
- # { 'cookbook' => { 'supermarket.getchef.com' => #<Cookbook> } }
60
+ # { 'cookbook' => { 'supermarket.chef.io' => #<Cookbook> } }
61
61
  def outdated(hash)
62
62
  if hash.empty?
63
63
  Berkshelf.ui.info('All cookbooks up to date!')
@@ -89,7 +89,7 @@ module Berkshelf
89
89
  #
90
90
  # @param [Hash] hash
91
91
  # the list of outdated cookbooks in the format
92
- # { 'cookbook' => { 'supermarket.getchef.com' => #<Cookbook> } }
92
+ # { 'cookbook' => { 'supermarket.chef.io' => #<Cookbook> } }
93
93
  def outdated(hash)
94
94
  hash.each do |name, info|
95
95
  info['remote'].each do |remote_source, remote_version|
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = "3.2.1"
2
+ VERSION = "3.2.2"
3
3
  end
@@ -382,4 +382,28 @@ describe Berkshelf::Berksfile do
382
382
  subject.upload
383
383
  end
384
384
  end
385
+
386
+ describe '#vendor' do
387
+ let(:cached_cookbook) { double(Berkshelf::CachedCookbook, cookbook_name: 'my_cookbook', path: '/my_cookbook/path', compiled_metadata?: true) }
388
+ let(:installer) { double(Berkshelf::Installer, run: [cached_cookbook]) }
389
+ let(:raw_metadata_files) { [File::join(cached_cookbook.cookbook_name, 'metadata.rb')] }
390
+
391
+ let(:destination) { '/a/destination/path' }
392
+ let(:excludes) { { :exclude => raw_metadata_files + Berkshelf::Berksfile::EXCLUDED_VCS_FILES_WHEN_VENDORING } }
393
+
394
+ before do
395
+ allow(Berkshelf::Installer).to receive(:new).and_return(installer)
396
+ end
397
+
398
+ it 'invokes FileSyncer with correct arguments' do
399
+ expect(Berkshelf::FileSyncer).to receive(:sync).with(/vendor/, destination, excludes)
400
+
401
+ subject.vendor(destination)
402
+ end
403
+
404
+ it 'excludes the top-level metadata.rb file' do
405
+ expect(excludes[:exclude].any? { |exclude| File.fnmatch?(exclude, 'my_cookbook/recipes/metadata.rb', File::FNM_DOTMATCH) }).to be(false)
406
+ expect(excludes[:exclude].any? { |exclude| File.fnmatch?(exclude, 'my_cookbook/metadata.rb', File::FNM_DOTMATCH) }).to be(true)
407
+ end
408
+ end
385
409
  end
@@ -71,7 +71,7 @@ describe Berkshelf::CookbookGenerator do
71
71
  contains "description 'Installs/Configures sparkle_motion'"
72
72
  end
73
73
  file 'Berksfile' do
74
- contains 'source "https://supermarket.getchef.com"'
74
+ contains 'source "https://supermarket.chef.io"'
75
75
  contains 'metadata'
76
76
  end
77
77
  file 'Gemfile'
@@ -56,6 +56,45 @@ module Berkshelf
56
56
  FileUtils.touch(File.join(source, '.dot_folder', 'file_f'))
57
57
 
58
58
  FileUtils.touch(File.join(source, '.file_g'))
59
+
60
+ # VCS files: Arch
61
+ FileUtils.mkdir_p(File.join(source, '.arch-ids'))
62
+ FileUtils.mkdir_p(File.join(source, '{arch}'))
63
+
64
+ # VCS files: Bazaar
65
+ FileUtils.touch(File.join(source, '.bzr'))
66
+ FileUtils.touch(File.join(source, '.bzrignore'))
67
+ FileUtils.touch(File.join(source, '.bzrtags'))
68
+
69
+ # VCS files: CVS
70
+ FileUtils.mkdir_p(File.join(source, 'CVS'))
71
+ FileUtils.touch(File.join(source, '.cvsignore'))
72
+
73
+ # VCS files: Darcs
74
+ FileUtils.touch(File.join(source, '_darcs'))
75
+
76
+ # VCS files: git
77
+ FileUtils.mkdir_p(File.join(source, '.git', 'objects', '08'))
78
+ FileUtils.touch(File.join(source, '.git', 'HEAD'))
79
+ git_readonly_file = File.join(source, '.git', 'objects', '08', '01ddba0b1237b2e0e602cf5fdb6544561950cb')
80
+ FileUtils.touch(File.join(git_readonly_file))
81
+ FileUtils.chmod("ugo=r", git_readonly_file)
82
+ FileUtils.touch(File.join(source, '.gitignore'))
83
+
84
+ # VCS files: Mercurial
85
+ FileUtils.touch(File.join(source, '.hg'))
86
+ FileUtils.touch(File.join(source, '.hgignore'))
87
+ FileUtils.touch(File.join(source, '.hgrags'))
88
+
89
+ # VCS files: RCS
90
+ FileUtils.mkdir_p(File.join(source, 'RCS'))
91
+
92
+ # VCS files: SCCS
93
+ FileUtils.mkdir_p(File.join(source, 'SCCS'))
94
+
95
+ # VCS files: Subversion
96
+ FileUtils.mkdir_p(File.join(source, '.svn'))
97
+
59
98
  source
60
99
  end
61
100
 
@@ -99,6 +138,46 @@ module Berkshelf
99
138
  expect("#{destination}/existing_file").to_not be_a_file
100
139
  expect("#{destination}/.existing_file").to_not be_a_file
101
140
  end
141
+
142
+ it 'skips excluded VCS files' do
143
+ described_class.sync(source, destination, exclude: Berksfile::EXCLUDED_VCS_FILES_WHEN_VENDORING)
144
+
145
+ # VCS files: Arch
146
+ expect("#{destination}/.arch-ids").to_not be_a_directory
147
+ expect("#{destination}/{arch}").to_not be_a_directory
148
+
149
+ # VCS files: Bazaar
150
+ expect("#{destination}/.bzr").to_not be_a_file
151
+ expect("#{destination}/.bzrignore").to_not be_a_file
152
+ expect("#{destination}/.bzrtags").to_not be_a_file
153
+
154
+ # VCS files: CVS
155
+ expect("#{destination}/CVS").to_not be_a_directory
156
+ expect("#{destination}/.cvsignore").to_not be_a_file
157
+
158
+ # VCS files: Darcs
159
+ expect("#{destination}/_darcs").to_not be_a_file
160
+
161
+ # VCS files: git
162
+ expect("#{destination}/.git/objects/08/01ddba0b1237b2e0e602cf5fdb6544561950cb").to_not be_a_file
163
+ expect("#{destination}/.git/HEAD").to_not be_a_file
164
+ expect("#{destination}/.git").to_not be_a_directory
165
+
166
+ # VCS files: Mercurial
167
+ expect("#{destination}/.hg").to_not be_a_file
168
+ expect("#{destination}/.hgignore").to_not be_a_file
169
+ expect("#{destination}/.hgrags").to_not be_a_file
170
+
171
+ # VCS files: RCS
172
+ expect("#{destination}/RCS").to_not be_a_directory
173
+
174
+ # VCS files: SCCS
175
+ expect("#{destination}/SCCS").to_not be_a_directory
176
+
177
+ # VCS files: Subversion
178
+ expect("#{destination}/.svn").to_not be_a_directory
179
+
180
+ end
102
181
  end
103
182
 
104
183
  context 'with deeply nested paths and symlinks' do
@@ -164,6 +243,16 @@ module Berkshelf
164
243
 
165
244
  expect("#{destination}/root").to be_a_symlink_to('/foo/bar')
166
245
  end
246
+
247
+ it 'copies relative and absolute symlinks when destination is a relative path' do
248
+ described_class.sync(source, "#{destination.gsub(Dir.pwd, '.')}")
249
+
250
+ expect("#{destination}/links/index.html").to be_a_symlink_to("./home.html")
251
+ expect("#{destination}/links/default.html").to be_a_symlink_to("./home.html")
252
+ expect("#{destination}/links/apt").to be_a_symlink_to("../source/bin/apt")
253
+ expect("#{destination}/root").to be_a_symlink_to('/foo/bar')
254
+ end
255
+
167
256
  end
168
257
 
169
258
  context 'when :exclude is given' do
@@ -6,7 +6,7 @@ describe Berkshelf::Installer do
6
6
  subject { described_class.new(berksfile) }
7
7
 
8
8
  describe "#build_universe" do
9
- let(:source_one) { double('one', uri: 'https://supermarket.getchef.com') }
9
+ let(:source_one) { double('one', uri: 'https://supermarket.chef.io') }
10
10
  let(:source_two) { double('two', uri: 'https://api.chef.org') }
11
11
  let(:sources) { [ source_one, source_two ] }
12
12
 
@@ -29,7 +29,7 @@ module Berkshelf
29
29
  end
30
30
 
31
31
  it 'returns true when the scheme is different' do
32
- instance = described_class.new('http://supermarket.getchef.com')
32
+ instance = described_class.new('http://supermarket.chef.io')
33
33
  expect(instance).to be_default
34
34
  end
35
35
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berkshelf
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-11-13 00:00:00.000000000 Z
15
+ date: 2014-12-18 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: addressable