mixlib-archive 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.expeditor/config.yml +35 -0
- data/.expeditor/update_version.sh +12 -0
- data/.travis.yml +26 -8
- data/CHANGELOG.md +16 -2
- data/Gemfile +1 -3
- data/README.md +13 -8
- data/Rakefile +12 -0
- data/VERSION +1 -0
- data/lib/mixlib/archive.rb +8 -2
- data/lib/mixlib/archive/lib_archive.rb +63 -0
- data/lib/mixlib/archive/tar.rb +2 -2
- data/lib/mixlib/archive/version.rb +1 -1
- data/mixlib-archive.gemspec +1 -2
- metadata +9 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e333d2af05598e7404ffdd49f2333d5edf345e7483aa7d03270da16e10001e52
|
4
|
+
data.tar.gz: 26d5a8f15aef2788da1ce44636282e736172d6bd579b532e2c9efcb39c52e098
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d08e1d6b5e38ccf53381f412ca1d1ffb400c6262f74fc972b5f798f52abc2136f7317f2ee99b9cdb4de6ee3eb7f5358b417897d194fe315ae7fcbcba76249ee8
|
7
|
+
data.tar.gz: 878e846762cae3ca0d21dcb9dc0975ad35c40705fa3cd29accf0d91b9b3eb15a65832be0ee95e0a6ec1379b9db1b6b56c5ed066db4e98cef94b9e15c6819c750
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
slack:
|
3
|
+
notify_channel: chef-notify
|
4
|
+
|
5
|
+
github:
|
6
|
+
version_tag_format: "v{{version}}"
|
7
|
+
minor_bump_labels:
|
8
|
+
- "Version: Bump Minor"
|
9
|
+
|
10
|
+
changelog:
|
11
|
+
rollup_header: Changes not yet released to rubygems.org
|
12
|
+
|
13
|
+
rubygems:
|
14
|
+
- mixlib-archive
|
15
|
+
|
16
|
+
merge_actions:
|
17
|
+
- built_in:bump_version:
|
18
|
+
ignore_labels:
|
19
|
+
- "Version: Skip Bump"
|
20
|
+
- "Expeditor: Skip All"
|
21
|
+
- bash:.expeditor/update_version.sh:
|
22
|
+
only_if:
|
23
|
+
- built_in:bump_version
|
24
|
+
- built_in:update_changelog:
|
25
|
+
ignore_labels:
|
26
|
+
- "Changelog: Skip Update"
|
27
|
+
- "Expeditor: Skip All"
|
28
|
+
- built_in:build_gem:
|
29
|
+
only_if:
|
30
|
+
- built_in:bump_version
|
31
|
+
|
32
|
+
promote:
|
33
|
+
action:
|
34
|
+
- built_in:publish_rubygems
|
35
|
+
- built_in:rollover_changelog
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file.
|
4
|
+
# It then executes this file to update any other files/components with that new version.
|
5
|
+
#
|
6
|
+
|
7
|
+
set -evx
|
8
|
+
|
9
|
+
sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" lib/mixlib/archive/version.rb
|
10
|
+
|
11
|
+
# Once Expeditor finshes executing this script, it will commit the changes and push
|
12
|
+
# the commit as a new tag corresponding to the value in the VERSION file.
|
data/.travis.yml
CHANGED
@@ -1,12 +1,30 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
|
5
|
+
addons:
|
6
|
+
apt:
|
7
|
+
packages:
|
8
|
+
- libarchive-dev
|
9
|
+
|
10
|
+
matrix:
|
11
|
+
include:
|
12
|
+
- rvm: 2.4.4
|
13
|
+
- rvm: 2.5.1
|
14
|
+
- rvm: ruby-head
|
15
|
+
allow_failures:
|
16
|
+
- rvm: ruby-head
|
1
17
|
branches:
|
2
18
|
only:
|
3
|
-
|
19
|
+
- master
|
4
20
|
|
5
|
-
language: ruby
|
6
|
-
rvm:
|
7
|
-
- 2.1
|
8
|
-
- 2.2
|
9
|
-
- 2.3.1
|
10
|
-
before_install: gem install bundler -v 1.11.2
|
11
|
-
script: bundle exec rake ci
|
12
21
|
bundler_args: --without changelog
|
22
|
+
|
23
|
+
before_install:
|
24
|
+
- gem install bundler
|
25
|
+
- bundle --version
|
26
|
+
- gem update --system
|
27
|
+
- gem --version
|
28
|
+
|
29
|
+
script:
|
30
|
+
- bundle exec rake ci
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,24 @@
|
|
1
|
+
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
|
1
2
|
# Change Log
|
2
3
|
|
4
|
+
<!-- latest_release -->
|
5
|
+
<!-- latest_release -->
|
6
|
+
|
7
|
+
<!-- release_rollup -->
|
8
|
+
<!-- release_rollup -->
|
9
|
+
|
10
|
+
<!-- latest_stable_release -->
|
11
|
+
## [v0.4.2](https://github.com/chef/mixlib-archive/tree/v0.4.2) (2018-04-25)
|
12
|
+
|
13
|
+
#### Merged Pull Requests
|
14
|
+
- use libarchive by preference [#17](https://github.com/chef/mixlib-archive/pull/17) ([thommay](https://github.com/thommay))
|
15
|
+
<!-- latest_stable_release -->
|
16
|
+
|
3
17
|
## [v0.4.1](https://github.com/chef/mixlib-archive/tree/v0.4.1) (2017-02-02)
|
4
18
|
|
5
19
|
[Full Changelog](https://github.com/chef/mixlib-archive/compare/v0.4.0...v0.4.1)
|
6
20
|
|
7
|
-
|
21
|
+
###Merged pull requests:
|
8
22
|
|
9
23
|
- Accept a single pattern to ignore [\#8](https://github.com/chef/mixlib-archive/pull/8) ([thommay](https://github.com/thommay))
|
10
24
|
|
@@ -40,4 +54,4 @@
|
|
40
54
|
|
41
55
|
|
42
56
|
|
43
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
57
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Mixlib::Archive
|
2
|
-
|
2
|
+
|
3
|
+
[![Build Status Master](https://travis-ci.org/chef/mixlib-archive.svg?branch=master)](https://travis-ci.org/chef/mixlib-archive) [![Gem Version](https://badge.fury.io/rb/mixlib-archive.svg)](https://badge.fury.io/rb/mixlib-archive)
|
3
4
|
|
4
5
|
A very simple gem to extract archives.
|
5
6
|
|
@@ -13,25 +14,31 @@ gem 'mixlib-archive'
|
|
13
14
|
|
14
15
|
And then execute:
|
15
16
|
|
16
|
-
|
17
|
+
```shell
|
18
|
+
$ bundle
|
19
|
+
```
|
17
20
|
|
18
21
|
Or install it yourself as:
|
19
22
|
|
20
|
-
|
23
|
+
```shell
|
24
|
+
$ gem install mixlib-archive
|
25
|
+
```
|
21
26
|
|
22
27
|
## Usage
|
23
28
|
|
24
29
|
To extract an archive
|
25
30
|
|
26
31
|
```ruby
|
27
|
-
|
32
|
+
require "mixlib/archive"
|
33
|
+
tar = Mixlib::Archive.new("/path/to/tar")
|
28
34
|
tar.extract("/destination/directory")
|
29
35
|
```
|
30
36
|
|
31
37
|
To create an archive
|
32
38
|
|
33
39
|
```ruby
|
34
|
-
|
40
|
+
require "mixlib/archive"
|
41
|
+
tar = Mixlib::Archive.new("/path/to/foo.tar.gz")
|
35
42
|
tar.create(%w{ file.rb file2.rb }, gzip: true)
|
36
43
|
```
|
37
44
|
|
@@ -41,10 +48,8 @@ After checking out the repo, run `bundle` to install dependencies. Then, run `bu
|
|
41
48
|
|
42
49
|
## Contributing
|
43
50
|
|
44
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/chef/mixlib-archive
|
45
|
-
|
51
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/chef/mixlib-archive>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Community Guidelines](https://docs.chef.io/community_guidelines.html) code of conduct.
|
46
52
|
|
47
53
|
## License
|
48
54
|
|
49
55
|
The gem is available as open source under the terms of the Apache License, v2
|
50
|
-
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rspec/core/rake_task"
|
3
|
+
require "mixlib/archive/version"
|
3
4
|
|
4
5
|
RSpec::Core::RakeTask.new(:spec)
|
5
6
|
|
@@ -17,3 +18,14 @@ begin
|
|
17
18
|
rescue LoadError
|
18
19
|
puts "chefstyle/rubocop is not available. gem install chefstyle to do style checking."
|
19
20
|
end
|
21
|
+
|
22
|
+
begin
|
23
|
+
require "github_changelog_generator/task"
|
24
|
+
|
25
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
26
|
+
config.issues = false
|
27
|
+
config.future_release = Mixlib::Archive::VERSION
|
28
|
+
end
|
29
|
+
rescue LoadError
|
30
|
+
puts "github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs"
|
31
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.4.3
|
data/lib/mixlib/archive.rb
CHANGED
@@ -11,8 +11,14 @@ module Mixlib
|
|
11
11
|
@empty = empty
|
12
12
|
|
13
13
|
archive = File.expand_path(archive)
|
14
|
-
|
15
|
-
|
14
|
+
begin
|
15
|
+
# we prefer to use libarchive, which supports a great big pile o' stuff
|
16
|
+
require "mixlib/archive/lib_archive"
|
17
|
+
@archiver = Mixlib::Archive::LibArchive.new(archive)
|
18
|
+
rescue LoadError
|
19
|
+
# but if we can't use that, we'll fall back to ruby's native tar implementation
|
20
|
+
@archiver = Mixlib::Archive::Tar.new(archive)
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
24
|
class Log
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require "ffi-libarchive"
|
2
|
+
|
3
|
+
module Mixlib
|
4
|
+
class Archive
|
5
|
+
class LibArchive
|
6
|
+
attr_reader :options
|
7
|
+
attr_reader :archive
|
8
|
+
|
9
|
+
def initialize(archive, options = {})
|
10
|
+
@archive = archive
|
11
|
+
@options = options
|
12
|
+
end
|
13
|
+
|
14
|
+
# Extracts the archive to the given +destination+
|
15
|
+
#
|
16
|
+
# === Parameters
|
17
|
+
# perms<Boolean>:: should the extracter use permissions from the archive.
|
18
|
+
# ignore[Array]:: an array of matches of file paths to ignore
|
19
|
+
def extract(destination, perms: true, ignore: [])
|
20
|
+
ignore_re = Regexp.union(ignore)
|
21
|
+
flags = perms ? ::Archive::EXTRACT_PERM : nil
|
22
|
+
Dir.chdir(destination) do
|
23
|
+
reader = ::Archive::Reader.open_filename(@archive)
|
24
|
+
|
25
|
+
reader.each_entry do |entry|
|
26
|
+
if entry.pathname =~ ignore_re
|
27
|
+
Mixlib::Archive::Log.warn "ignoring entry #{entry.pathname}"
|
28
|
+
next
|
29
|
+
end
|
30
|
+
|
31
|
+
reader.extract(entry, flags.to_i)
|
32
|
+
end
|
33
|
+
reader.close
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Creates an archive with the given set of +files+
|
38
|
+
#
|
39
|
+
# === Parameters
|
40
|
+
# gzip<Boolean>:: should the archive be gzipped?
|
41
|
+
def create(files, gzip: false)
|
42
|
+
compression = gzip ? ::Archive::COMPRESSION_GZIP : ::Archive::COMPRESSION_NONE
|
43
|
+
# "PAX restricted" will use PAX extensions when it has to, but will otherwise
|
44
|
+
# use ustar for maximum compatibility
|
45
|
+
format = ::Archive::FORMAT_TAR_PAX_RESTRICTED
|
46
|
+
|
47
|
+
::Archive.write_open_filename(archive, compression, format) do |tar|
|
48
|
+
files.each do |fn|
|
49
|
+
tar.new_entry do |entry|
|
50
|
+
entry.pathname = fn
|
51
|
+
entry.copy_stat(fn)
|
52
|
+
tar.write_header(entry)
|
53
|
+
if File.file?(fn)
|
54
|
+
content = File.read(fn)
|
55
|
+
tar.write_data(content)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/mixlib/archive/tar.rb
CHANGED
@@ -119,11 +119,11 @@ module Mixlib
|
|
119
119
|
ensure
|
120
120
|
if file
|
121
121
|
file.close unless file.closed?
|
122
|
-
file = nil
|
122
|
+
file = nil # rubocop:disable Lint/UselessAssignment
|
123
123
|
end
|
124
124
|
if raw
|
125
125
|
raw.close unless raw.closed?
|
126
|
-
raw = nil
|
126
|
+
raw = nil # rubocop:disable Lint/UselessAssignment
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
data/mixlib-archive.gemspec
CHANGED
@@ -17,8 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_development_dependency "
|
21
|
-
spec.add_development_dependency "rake", "~> 11.0"
|
20
|
+
spec.add_development_dependency "rake", "~> 12"
|
22
21
|
spec.add_development_dependency "rspec", "~> 3.0"
|
23
22
|
spec.add_development_dependency "chefstyle"
|
24
23
|
spec.add_dependency "mixlib-log"
|
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.11'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.11'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: rake
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
19
|
+
version: '12'
|
34
20
|
type: :development
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
26
|
+
version: '12'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rspec
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,6 +73,8 @@ executables: []
|
|
87
73
|
extensions: []
|
88
74
|
extra_rdoc_files: []
|
89
75
|
files:
|
76
|
+
- ".expeditor/config.yml"
|
77
|
+
- ".expeditor/update_version.sh"
|
90
78
|
- ".gitignore"
|
91
79
|
- ".rspec"
|
92
80
|
- ".travis.yml"
|
@@ -95,7 +83,9 @@ files:
|
|
95
83
|
- LICENSE
|
96
84
|
- README.md
|
97
85
|
- Rakefile
|
86
|
+
- VERSION
|
98
87
|
- lib/mixlib/archive.rb
|
88
|
+
- lib/mixlib/archive/lib_archive.rb
|
99
89
|
- lib/mixlib/archive/tar.rb
|
100
90
|
- lib/mixlib/archive/version.rb
|
101
91
|
- mixlib-archive.gemspec
|
@@ -119,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
109
|
version: '0'
|
120
110
|
requirements: []
|
121
111
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
112
|
+
rubygems_version: 2.7.6
|
123
113
|
signing_key:
|
124
114
|
specification_version: 4
|
125
115
|
summary: A simple interface to various archive formats
|