berkshelf 6.2.2 → 6.3.0

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
  SHA1:
3
- metadata.gz: 957ca7b1c871821c5d91be2ff270c37ad90044fa
4
- data.tar.gz: 1af13dcc965672d9e31c53425150a1c6e24e9e55
3
+ metadata.gz: 8e620a63bb67ebae68ad87fad7690fe42ef45561
4
+ data.tar.gz: '093db285607a11b1d6af5006b86d2053cc42a387'
5
5
  SHA512:
6
- metadata.gz: 1f1d111e55146320ac610f666ff5d27ce3e6bbaa91c7f53a4d350705698b61b3a0ae2cd2d383a9953c3e0a33ef21ee3bdfee33b5dcdc1ba5c69117e24e502d88
7
- data.tar.gz: d32ad02c06048835d13552410b5764dfa79f976547ac96bac38e758327b5a138840af94f476a9db1c5dc042412bf0676ac0d5ab1daab7dc12bef381a12eeca93
6
+ metadata.gz: c165040371c0ac425b1bfe92d45e5355c6e2ffdb62d43648d77a877379512642f7519c3ba971d602680b9fb8af1073e2e7e05232497b17e24eaa87c053533462
7
+ data.tar.gz: f2191da269c43f42eddc36532f9b785dbfb59fd8df1cce24ac109f9ca504088b5798a0a49f7ccb6fec98db877403cec86466b2133189a4e13ed6caf25f5fd071
@@ -1,5 +1,22 @@
1
1
  # Change Log
2
2
 
3
+ ## [6.3.0](https://github.com/berkshelf/berkshelf/tree/6.3.0) (2017-08-08)
4
+ [Full Changelog](https://github.com/berkshelf/berkshelf/compare/v6.2.2...6.3.0)
5
+
6
+ **Merged pull requests:**
7
+
8
+ - Remove stale comment [\#1724](https://github.com/berkshelf/berkshelf/pull/1724) ([jaym](https://github.com/jaym))
9
+ - Fix up Dir.glob for windows [\#1722](https://github.com/berkshelf/berkshelf/pull/1722) ([jaym](https://github.com/jaym))
10
+ - bump the gemfile.lock [\#1721](https://github.com/berkshelf/berkshelf/pull/1721) ([lamont-granquist](https://github.com/lamont-granquist))
11
+
12
+ ## [v6.2.2](https://github.com/berkshelf/berkshelf/tree/v6.2.2) (2017-08-02)
13
+ [Full Changelog](https://github.com/berkshelf/berkshelf/compare/v6.2.1...v6.2.2)
14
+
15
+ **Merged pull requests:**
16
+
17
+ - fix verify false and add tests [\#1720](https://github.com/berkshelf/berkshelf/pull/1720) ([lamont-granquist](https://github.com/lamont-granquist))
18
+ - Docs update [\#1715](https://github.com/berkshelf/berkshelf/pull/1715) ([iennae](https://github.com/iennae))
19
+
3
20
  ## [v6.2.1](https://github.com/berkshelf/berkshelf/tree/v6.2.1) (2017-07-18)
4
21
  [Full Changelog](https://github.com/berkshelf/berkshelf/compare/v6.2.0...v6.2.1)
5
22
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- berkshelf (6.2.2)
4
+ berkshelf (6.3.0)
5
5
  buff-config (~> 2.0)
6
6
  buff-extensions (~> 2.0)
7
7
  chef (>= 12.7.2)
@@ -119,7 +119,7 @@ GEM
119
119
  domain_name (0.5.20170404)
120
120
  unf (>= 0.0.5, < 1.0.0)
121
121
  erubis (2.7.0)
122
- faraday (0.12.1)
122
+ faraday (0.12.2)
123
123
  multipart-post (>= 1.2, < 3)
124
124
  faraday-http-cache (2.0.0)
125
125
  faraday (~> 0.8)
@@ -142,7 +142,7 @@ GEM
142
142
  hashdiff (0.3.4)
143
143
  hashie (3.5.6)
144
144
  highline (1.7.8)
145
- hitimes (1.2.5)
145
+ hitimes (1.2.6)
146
146
  http (2.2.2)
147
147
  addressable (~> 2.3)
148
148
  http-cookie (~> 1.0)
@@ -160,7 +160,7 @@ GEM
160
160
  json (2.1.0)
161
161
  libyajl2 (1.2.0)
162
162
  minitar (0.6.1)
163
- minitest (5.10.2)
163
+ minitest (5.10.3)
164
164
  mixlib-archive (0.4.1)
165
165
  mixlib-log
166
166
  mixlib-authentication (1.4.1)
@@ -169,7 +169,7 @@ GEM
169
169
  mixlib-config (2.2.4)
170
170
  mixlib-log (1.7.1)
171
171
  mixlib-shellout (2.3.2)
172
- molinillo (0.6.0)
172
+ molinillo (0.6.1)
173
173
  multi_json (1.12.1)
174
174
  multi_test (0.1.2)
175
175
  multipart-post (2.0.0)
@@ -199,7 +199,7 @@ GEM
199
199
  plist (~> 3.1)
200
200
  systemu (~> 2.6.4)
201
201
  wmi-lite (~> 1.0)
202
- parallel (1.11.2)
202
+ parallel (1.12.0)
203
203
  parser (2.4.0.0)
204
204
  ast (~> 2.2)
205
205
  plist (3.3.0)
@@ -262,16 +262,16 @@ GEM
262
262
  addressable (>= 2.3.5, < 2.6)
263
263
  faraday (~> 0.8, < 1.0)
264
264
  semverse (2.0.0)
265
- serverspec (2.39.1)
265
+ serverspec (2.39.2)
266
266
  multi_json
267
267
  rspec (~> 3.0)
268
268
  rspec-its
269
269
  specinfra (~> 2.68)
270
270
  sfl (2.3)
271
- solve (3.1.0)
271
+ solve (3.1.1)
272
272
  molinillo (>= 0.5)
273
273
  semverse (>= 1.1, < 3.0)
274
- specinfra (2.70.0)
274
+ specinfra (2.70.1)
275
275
  net-scp
276
276
  net-ssh (>= 2.7, < 5.0)
277
277
  net-telnet
@@ -104,9 +104,12 @@ module Berkshelf
104
104
  if File.cookbook?(extracted)
105
105
  extracted
106
106
  else
107
- Dir.glob(File.join(extracted, "*")).find do |dir|
108
- File.cookbook?(dir)
107
+ dir = Dir.chdir(extracted) do
108
+ Dir.glob("*").find do |dir|
109
+ File.cookbook?(dir)
110
+ end
109
111
  end
112
+ File.join(extracted, dir) if dir
110
113
  end
111
114
  ensure
112
115
  archive.unlink unless archive.nil?
@@ -48,7 +48,9 @@ module Berkshelf
48
48
 
49
49
  # Destroy the contents of the initialized storage path.
50
50
  def clean!
51
- FileUtils.rm_rf(Dir.glob(File.join(storage_path, "*")))
51
+ Dir.chdir(storage_path) do
52
+ FileUtils.rm_rf(Dir.glob("*"))
53
+ end
52
54
  end
53
55
 
54
56
  # Import a cookbook found on the local filesystem into this instance of the cookbook store.
@@ -17,6 +17,13 @@ module Berkshelf
17
17
  # @return [Array<String>]
18
18
  # the list of all files
19
19
  #
20
+ # @note
21
+ # Globbing on windows is strange. Do not pass a path that contains
22
+ # "symlinked" directories. Dir.glob will not see them. As an example,
23
+ # 'C:\Documents and Settings' is not a real directory and int recent
24
+ # versions of windows points at 'C:\users'. Some users have their
25
+ # temp directory still referring to 'C:\Documents and Settings'.
26
+ #
20
27
  def glob(pattern)
21
28
  Dir.glob(pattern, File::FNM_DOTMATCH).sort.reject do |file|
22
29
  basename = File.basename(file)
@@ -58,24 +65,18 @@ module Berkshelf
58
65
  [exclude, "#{exclude}/*"]
59
66
  end.flatten
60
67
 
61
- # let glob expand the source directory in case it is an abbreviated windows
62
- # user directory: C:/Users/MATTWR~1/AppData/Local/Temp
63
- # so that it matches the parent of source_files
64
- source = glob(source).first
65
-
66
- source_files = glob(File.join(source, "**/*"))
67
- source_files = source_files.reject do |source_file|
68
- basename = relative_path_for(source_file, source)
69
- excludes.any? { |exclude| File.fnmatch?(exclude, basename, File::FNM_DOTMATCH) }
68
+ source_files = Dir.chdir(source) do
69
+ glob("**/*").reject do |source_file|
70
+ excludes.any? { |exclude| File.fnmatch?(exclude, source_file, File::FNM_DOTMATCH) }
71
+ end
70
72
  end
71
73
 
72
74
  # Ensure the destination directory exists
73
75
  FileUtils.mkdir_p(destination) unless File.directory?(destination)
74
76
 
75
77
  # Copy over the filtered source files
76
- source_files.each do |source_file|
77
- relative_path = relative_path_for(source_file, source)
78
-
78
+ source_files.each do |relative_path|
79
+ source_file = File.join(source, relative_path)
79
80
  # Create the parent directory
80
81
  parent = File.join(destination, File.dirname(relative_path))
81
82
  FileUtils.mkdir_p(parent) unless File.directory?(parent)
@@ -102,20 +103,13 @@ module Berkshelf
102
103
 
103
104
  if options[:delete]
104
105
  # Remove any files in the destination that are not in the source files
105
- destination_files = glob("#{destination}/**/*")
106
-
107
- # Calculate the relative paths of files so we can compare to the
108
- # source.
109
- relative_source_files = source_files.map do |file|
110
- relative_path_for(file, source)
111
- end
112
- relative_destination_files = destination_files.map do |file|
113
- relative_path_for(file, destination)
106
+ destination_files = Dir.chdir(destination) do
107
+ glob("**/*")
114
108
  end
115
109
 
116
110
  # Remove any extra files that are present in the destination, but are
117
111
  # not in the source list
118
- extra_files = relative_destination_files - relative_source_files
112
+ extra_files = destination_files - source_files
119
113
  extra_files.each do |file|
120
114
  FileUtils.rm_rf(File.join(destination, file))
121
115
  end
@@ -123,21 +117,5 @@ module Berkshelf
123
117
 
124
118
  true
125
119
  end
126
-
127
- private
128
-
129
- #
130
- # The relative path of the given +path+ to the +parent+.
131
- #
132
- # @param [String] path
133
- # the path to get relative with
134
- # @param [String] parent
135
- # the parent where the path is contained (hopefully)
136
- #
137
- # @return [String]
138
- #
139
- def relative_path_for(path, parent)
140
- Pathname.new(path).relative_path_from(Pathname.new(parent)).to_s
141
- end
142
120
  end
143
121
  end
@@ -31,9 +31,11 @@ module Berkshelf
31
31
  end
32
32
 
33
33
  def set_custom_certs
34
- ::Dir.glob("#{trusted_certs_dir}/" "{*.crt,*.pem}").each do |cert|
35
- cert = OpenSSL::X509::Certificate.new(IO.read(cert))
36
- add_trusted_cert(cert)
34
+ Dir.chdir(trusted_certs_dir) do
35
+ ::Dir.glob("{*.crt,*.pem}").each do |cert|
36
+ cert = OpenSSL::X509::Certificate.new(IO.read(cert))
37
+ add_trusted_cert(cert)
38
+ end
37
39
  end
38
40
  end
39
41
  end
@@ -24,9 +24,12 @@ module Berkshelf
24
24
  Array(cookbooks).each do |cookbook|
25
25
  path = cookbook.path.to_s
26
26
 
27
- files = Dir.glob(File.join(path, "**", "*.rb")).select do |f|
28
- parent = Pathname.new(path).dirname.to_s
29
- f.gsub(parent, "") =~ /[[:space:]]/
27
+ files = Dir.chdir(path) do
28
+ Dir.glob(File.join("**", "*.rb")).select do |f|
29
+ f = File.join(path, f)
30
+ parent = Pathname.new(path).dirname.to_s
31
+ f.gsub(parent, "") =~ /[[:space:]]/
32
+ end
30
33
  end
31
34
 
32
35
  raise InvalidCookbookFiles.new(cookbook, files) unless files.empty?
@@ -1,3 +1,3 @@
1
1
  module Berkshelf
2
- VERSION = "6.2.2"
2
+ VERSION = "6.3.0"
3
3
  end
@@ -93,6 +93,7 @@ describe Berkshelf::CommunityREST do
93
93
  .and_return("/foo/nginx")
94
94
  .once
95
95
  expect(archive).to receive(:unlink).once
96
+ expect(Dir).to receive(:chdir).with("/foo/nginx")
96
97
 
97
98
  subject.download("bacon", "1.0.0")
98
99
  end
@@ -78,6 +78,7 @@ describe Berkshelf::SSLPolicy do
78
78
  before do
79
79
  allow(chef_config).to receive_messages(trusted_certs_dir: self_signed_crt_path_windows_backslashes)
80
80
  allow(File).to receive(:exist?).with(self_signed_crt_path_windows_forwardslashes).and_return(true)
81
+ allow(Dir).to receive(:chdir).with(self_signed_crt_path_windows_forwardslashes)
81
82
  end
82
83
 
83
84
  it "replaces the backslashes in trusted_certs_dir from Berkshelf config with forwardslashes" do
@@ -4,6 +4,10 @@ describe Berkshelf::Validator do
4
4
  describe "#validate_files" do
5
5
  let(:cookbook) { double("cookbook", cookbook_name: "cookbook", path: "path") }
6
6
 
7
+ before do
8
+ allow(Dir).to receive(:chdir) { |&block| block.call }
9
+ end
10
+
7
11
  it "raises an error when the cookbook has spaces in the files" do
8
12
  allow(Dir).to receive(:glob).and_return(["/there are/spaces/in this/recipes/default.rb"])
9
13
  expect do
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: 6.2.2
4
+ version: 6.3.0
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: 2017-08-02 00:00:00.000000000 Z
15
+ date: 2017-08-08 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: buff-config