berkshelf 8.0.0 → 8.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74b3f02281f737a99b466bb6e902b83e14dc4753eca57e4c53ebcc9d18147c4b
4
- data.tar.gz: e8c566401ba73574604f2427b91a414af8a10e04d20d6c78df0e5cac58bc9ebc
3
+ metadata.gz: eca450739cdb53861e1a527e0147f702b71c898bac6d3ab317fa53f8b7150dc2
4
+ data.tar.gz: 625a9e32681e15e4d553c9d56653cb16396255c347fcc45f1e9a51e61fc41324
5
5
  SHA512:
6
- metadata.gz: ad41f78382168194e5e7289a58ddb2213724839c64a5cf033551d874f935af0b2f6343a64499649499aed797a63b5d5d261298733cd4131e56b072a1671e55ee
7
- data.tar.gz: 19735889f013e0c9afca6ae0ab3b4496d2d35d09dc85592fb2b6d549a5e1224f19dc76926021f7ec5be735ff44d49299f0b6a69122e27f719a72611a91424dda
6
+ metadata.gz: 2079eaf58a614ed63b85335a02fe19bd8ae8083856341905a95c83ba4eca1185744e5164c683d8610f0b2bbb332bd5636a1814daaf7c37a149d76b979be7ccf7
7
+ data.tar.gz: 7fd481876fab292339aac18016d5727bbe197186c3e92e6093dfebba962fc7540b0141b55fce6235263db945fc7423b0e138094d3fbe85a68d041a713268977d
data/berkshelf.gemspec CHANGED
@@ -25,8 +25,13 @@ Gem::Specification.new do |s|
25
25
  s.name = "berkshelf"
26
26
  s.require_paths = ["lib"]
27
27
  s.version = Berkshelf::VERSION
28
- s.required_ruby_version = ">= 2.4.0"
28
+ s.required_ruby_version = ">= 2.7.0"
29
29
  s.required_rubygems_version = ">= 2.0.0"
30
+ s.metadata = {
31
+ "bug_tracker_uri" => "https://github.com/chef/berkshelf/issues",
32
+ "source_code_uri" => "https://github.com/chef/berkshelf",
33
+ "changelog_uri" => "https://github.com/chef/berkshelf/blob/main/CHANGELOG.md",
34
+ }
30
35
 
31
36
  s.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
32
37
  s.add_dependency "cleanroom", "~> 1.0"
@@ -1,4 +1,5 @@
1
1
  require "archive/tar/minitar"
2
+ require "find" unless defined?(Find)
2
3
  require "zlib" unless defined?(Zlib)
3
4
 
4
5
  module Berkshelf
@@ -40,8 +41,18 @@ module Berkshelf
40
41
  # @return [String]
41
42
  # path to the generated archive
42
43
  def run(source)
43
- tgz = Zlib::GzipWriter.new(File.open(out_file, "wb"))
44
- Archive::Tar::Minitar.pack(Dir.glob("#{source}/*"), tgz)
44
+ begin
45
+ dest = Zlib::GzipWriter.open(out_file)
46
+ tar = RelativeTarWriter.new(dest, source)
47
+ Find.find(source) do |entry|
48
+ next if source == entry
49
+
50
+ Archive::Tar::Minitar.pack_file(entry, tar)
51
+ end
52
+ ensure
53
+ tar.close
54
+ dest.close
55
+ end
45
56
 
46
57
  out_file
47
58
  rescue SystemCallError => ex
@@ -67,5 +78,30 @@ module Berkshelf
67
78
 
68
79
  # @return [String]
69
80
  attr_reader :filename
81
+
82
+ # A private decorator for Archive::Tar::Minitar::Writer that
83
+ # turns absolute paths into relative ones.
84
+ class RelativeTarWriter < SimpleDelegator # :nodoc:
85
+ def initialize(io, base_path)
86
+ @base_path = Pathname.new(base_path)
87
+ super(Archive::Tar::Minitar::Writer.new(io))
88
+ end
89
+
90
+ %w{add_file add_file_simple mkdir}.each do |method|
91
+ class_eval <<~RUBY
92
+ def #{method}(name, *opts, &block)
93
+ super(relative_path(name), *opts, &block)
94
+ end
95
+ RUBY
96
+ end
97
+
98
+ private
99
+
100
+ attr_reader :base_path
101
+
102
+ def relative_path(path)
103
+ Pathname.new(path).relative_path_from(base_path).to_s
104
+ end
105
+ end
70
106
  end
71
107
  end
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = "8.0.0".freeze
2
+ VERSION = "8.0.2".freeze
3
3
  end
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: 8.0.0
4
+ version: 8.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Winsor
@@ -9,10 +9,10 @@ authors:
9
9
  - Michael Ivey
10
10
  - Justin Campbell
11
11
  - Seth Vargo
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2022-04-29 00:00:00.000000000 Z
15
+ date: 2022-06-02 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: mixlib-shellout
@@ -314,21 +314,6 @@ files:
314
314
  - spec/support/matchers/filepath_matchers.rb
315
315
  - spec/support/path_helpers.rb
316
316
  - spec/support/shared_examples/formatter.rb
317
- - spec/tmp/berkshelf/cookbooks/fake-0.1.0/attributes/default.rb
318
- - spec/tmp/berkshelf/cookbooks/fake-0.1.0/files/default/file.h
319
- - spec/tmp/berkshelf/cookbooks/fake-0.1.0/metadata.rb
320
- - spec/tmp/berkshelf/cookbooks/fake-0.1.0/recipes/default.rb
321
- - spec/tmp/berkshelf/cookbooks/fake-0.1.0/templates/default/template.erb
322
- - spec/tmp/berkshelf/cookbooks/fake-0.2.0/attributes/default.rb
323
- - spec/tmp/berkshelf/cookbooks/fake-0.2.0/files/default/file.h
324
- - spec/tmp/berkshelf/cookbooks/fake-0.2.0/metadata.rb
325
- - spec/tmp/berkshelf/cookbooks/fake-0.2.0/recipes/default.rb
326
- - spec/tmp/berkshelf/cookbooks/fake-0.2.0/templates/default/template.erb
327
- - spec/tmp/berkshelf/cookbooks/fake-1.0.0/attributes/default.rb
328
- - spec/tmp/berkshelf/cookbooks/fake-1.0.0/files/default/file.h
329
- - spec/tmp/berkshelf/cookbooks/fake-1.0.0/metadata.rb
330
- - spec/tmp/berkshelf/cookbooks/fake-1.0.0/recipes/default.rb
331
- - spec/tmp/berkshelf/cookbooks/fake-1.0.0/templates/default/template.erb
332
317
  - spec/unit/berkshelf/berksfile_spec.rb
333
318
  - spec/unit/berkshelf/berkshelf/api_client/chef_server_connection_spec.rb
334
319
  - spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb
@@ -374,8 +359,11 @@ files:
374
359
  homepage: https://docs.chef.io/berkshelf.html
375
360
  licenses:
376
361
  - Apache-2.0
377
- metadata: {}
378
- post_install_message:
362
+ metadata:
363
+ bug_tracker_uri: https://github.com/chef/berkshelf/issues
364
+ source_code_uri: https://github.com/chef/berkshelf
365
+ changelog_uri: https://github.com/chef/berkshelf/blob/main/CHANGELOG.md
366
+ post_install_message:
379
367
  rdoc_options: []
380
368
  require_paths:
381
369
  - lib
@@ -383,15 +371,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
383
371
  requirements:
384
372
  - - ">="
385
373
  - !ruby/object:Gem::Version
386
- version: 2.4.0
374
+ version: 2.7.0
387
375
  required_rubygems_version: !ruby/object:Gem::Requirement
388
376
  requirements:
389
377
  - - ">="
390
378
  - !ruby/object:Gem::Version
391
379
  version: 2.0.0
392
380
  requirements: []
393
- rubygems_version: 3.3.7
394
- signing_key:
381
+ rubygems_version: 3.2.32
382
+ signing_key:
395
383
  specification_version: 4
396
384
  summary: Manages a Chef cookbook's dependencies
397
385
  test_files: []
@@ -1,2 +0,0 @@
1
- name 'fake'
2
- version '0.1.0'
@@ -1,2 +0,0 @@
1
- name 'fake'
2
- version '0.2.0'
@@ -1,2 +0,0 @@
1
- name 'fake'
2
- version '1.0.0'