poise-archive 1.2.0 → 1.2.1

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: 5ba8a642607edf70f9c1cc3c985d6cd70eed6515
4
- data.tar.gz: e1e3fa40223be0e015e1dae1e5640c5a839d5077
3
+ metadata.gz: dd46ea17e4040f2682e412ffda579ad0401d4aec
4
+ data.tar.gz: dc92ac0690c79f6a37a252682cc6bce4e03299ab
5
5
  SHA512:
6
- metadata.gz: 0d64cb5a421994253e7b5d124250df5c0d020a481e55e7ac4e699ecb6296327f43efe73fa1024bb95c940402435d79f9a1ba333f27d7dfb0b4ec95ac2c35607a
7
- data.tar.gz: c54e8439eeb5b38a451636fa728fe59f3da6a9834aa8ed3609654b2e8e88292b785e24d1aafad84c9cae6367dce953f7aaa4496ca37334c577a622991f7491ca
6
+ metadata.gz: d69d2aabe6bf4eaf939b9e5816d52291225ffb3889aa19012a5b456b793a957de94fa82657e46925a2230fb71445d5fbee75463ad7abf78b86b0f63fc3627fff
7
+ data.tar.gz: 7066f0bdbbffefa0cd752a7a730b441eeada22949976316bc8ad50f3b6a160de12f9d4536a6c486b88c33aa0e12bb2a7c36adbd9461f42f84e571b9f498acbe6
data/.travis.yml CHANGED
@@ -3,7 +3,7 @@ sudo: false
3
3
  cache: bundler
4
4
  language: ruby
5
5
  rvm:
6
- - '2.2'
6
+ - 2.3.1
7
7
  env:
8
8
  global:
9
9
  - secure: OIVa/hlztLT/hICbouLmXu9F6x0ntFzUnfJbhG3LNVQk3s3YmeI8QPLh1bIxGULry+a3pLykDESYya6gpC+f+Si3FSI7VLpFds5EVIbptMVPRVHjDSNSHFjoAgjzX36HCxvWGJdb0jKZ5EUNBGBqDtnBPFAp3FcwknhkRpOAzKemzXnSZVMyxLiuNBMynLycFPjSSDZt0uSq/yvXnBAb0FXov84Zh0K+OoTEQ1J2AWSS9jXkBZncZD4rdSBqJSZwMxN9+3w6IONyWO3BMCg1QBcA0fCdcqk5ZlbGOfpt0n/FkYfUvB3Ypei+4+QT3wg9f63R14HtM1ZK/VHOrjx/h0rAC0haq2OEWmEAyrZF+pSm5l46ngWlHnifVURjOOabXg6TLNqN0JN8zjXyGYB6rb3RDeG8U0dJrdoVUQW02A4v8Fpo2wACHcz+h0cipWxh2RPOfl7/5PtDZ/ZKFaR73Ci2SXOG9Q9gTCdFDbXmEgEB8PtyoDS5gkm4QiY3Ffi1YXD46yU0YHxTVnw7S63g7gmHf4G30NAKdoSl1Zke6IvZYA5fl7vcx6Dl1ZQWJMxJgsTx7KVRENeCzpJDkty04bs1MCAy6vEWcAxYApket7TXvnAIEAQzxnp/r82zWVwanLdVcbBVvFDWNlsMquRXRwOVkcs12esLY6Wj6WBZCyQ=
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Poise-Archive Changelog
2
2
 
3
+ ## v1.2.1
4
+
5
+ * [#1](https://github.com/poise/poise-archive/issues/1) Restore file permissions
6
+ for ZIP files.
7
+
3
8
  ## v1.2.0
4
9
 
5
10
  * Add back a tar-binary provider called `GnuTar`, used by default on Linux.
@@ -55,12 +55,31 @@ module PoiseArchive
55
55
  # If strip_components wiped out the name, don't process this entry.
56
56
  next if entry_name.empty?
57
57
  entry_path = ::File.join(new_resource.destination, entry_name)
58
+ # Ensure parent directories exist because some ZIP files don't
59
+ # include those for some reason.
60
+ ensure_directory(entry_path)
58
61
  entry.extract(entry_path)
62
+ # Make sure we restore file permissions. RubyZip won't do this
63
+ # unless we also turn on UID/GID restoration, which we don't want.
64
+ # Mask filters out setuid and setgid bits because no.
65
+ ::File.chmod(entry.unix_perms & 01777, entry_path) if !node.platform_family?('windows') && entry.unix_perms
59
66
  @zip_entry_paths << [entry.directory? ? :directory : entry.file? ? :file : :link, entry_path]
60
67
  end
61
68
  end
62
69
  end
63
70
 
71
+ # Make sure all enclosing directories exist before writing a path.
72
+ #
73
+ # @param oath [String] Path to check.
74
+ def ensure_directory(path)
75
+ base = ::File.dirname(path)
76
+ unless ::File.exist?(base)
77
+ ensure_directory(base)
78
+ Dir.mkdir(base)
79
+ @zip_entry_paths << [:directory, base]
80
+ end
81
+ end
82
+
64
83
  def chown_entries
65
84
  paths = @zip_entry_paths
66
85
  notifying_block do
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module PoiseArchive
19
- VERSION = '1.2.0'
19
+ VERSION = '1.2.1'
20
20
  end
Binary file
Binary file
Binary file
@@ -38,6 +38,10 @@ RSpec.shared_examples 'a poise_archive test' do |ext|
38
38
  describe file("#{base}/src/main.c") do
39
39
  it { is_expected.to be_a_file }
40
40
  end
41
+ describe file("#{base}/bin/run.sh") do
42
+ it { is_expected.to be_a_file }
43
+ it { is_expected.to be_mode '755' } unless os[:family] == 'windows'
44
+ end
41
45
  describe file("#{base}_0/myapp-1.0.0/src/main.c") do
42
46
  it { is_expected.to be_a_file }
43
47
  end
@@ -52,6 +56,10 @@ RSpec.shared_examples 'a poise_archive test' do |ext|
52
56
  it { is_expected.to be_owned_by 'poise' }
53
57
  it { is_expected.to be_mode '644' } unless os[:family] == 'windows'
54
58
  end
59
+ describe file("#{base}_user/bin/run.sh") do
60
+ it { is_expected.to be_owned_by 'poise' }
61
+ it { is_expected.to be_mode '755' } unless os[:family] == 'windows'
62
+ end
55
63
  end
56
64
 
57
65
  describe 'default provider' do
@@ -52,14 +52,18 @@ describe PoiseArchive::ArchiveProviders::Tar do
52
52
  expect_file('/test/myapp/LICENSE', "This is in the public domain.\n", 0644)
53
53
  expect_file('/test/myapp/README', "This is a project!\n\n", 0644)
54
54
  expect(Dir).to receive(:mkdir).with('/test/myapp/src', 0755)
55
+ expect(Dir).to receive(:mkdir).with('/test/myapp/bin', 0755)
55
56
  expect_file('/test/myapp/src/main.c', "int main(int argc, char **argv)\n{\n return 0;\n}\n\n", 0644)
57
+ expect_file('/test/myapp/bin/run.sh', "#!/bin/sh\necho \"Started!\"\n", 0755)
56
58
  run_chef
57
59
  expect(archive_provider).to be_a described_class
58
60
  expect(chef_run).to create_directory('/test/myapp').with(user: 'myuser', group: nil)
59
61
  expect(chef_run).to create_directory('/test/myapp/src').with(user: 'myuser', group: nil)
62
+ expect(chef_run).to create_directory('/test/myapp/bin').with(user: 'myuser', group: nil)
60
63
  expect(chef_run).to create_file('/test/myapp/LICENSE').with(user: 'myuser', group: nil)
61
64
  expect(chef_run).to create_file('/test/myapp/README').with(user: 'myuser', group: nil)
62
65
  expect(chef_run).to create_file('/test/myapp/src/main.c').with(user: 'myuser', group: nil)
66
+ expect(chef_run).to create_file('/test/myapp/bin/run.sh').with(user: 'myuser', group: nil)
63
67
  end
64
68
  end
65
69
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poise-archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Kantrowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-26 00:00:00.000000000 Z
11
+ date: 2016-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: halite
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project:
131
- rubygems_version: 2.6.2
131
+ rubygems_version: 2.6.4
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: A Chef cookbook for unpacking file archives like tar and zip.
@@ -155,4 +155,3 @@ test_files:
155
155
  - test/spec/archive_providers/zip_spec.rb
156
156
  - test/spec/resources/poise_archive_spec.rb
157
157
  - test/spec/spec_helper.rb
158
- has_rdoc: