minitar 0.5.4 → 0.6
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 +7 -0
- data/Code-of-Conduct.md +74 -0
- data/Contributing.md +84 -0
- data/History.md +107 -0
- data/Licence.md +15 -0
- data/Manifest.txt +24 -0
- data/README.rdoc +81 -0
- data/Rakefile +46 -107
- data/docs/bsdl.txt +19 -0
- data/docs/ruby.txt +56 -0
- data/lib/archive-tar-minitar.rb +3 -0
- data/lib/archive/tar/minitar.rb +197 -889
- data/lib/archive/tar/minitar/input.rb +212 -0
- data/lib/archive/tar/minitar/output.rb +69 -0
- data/lib/archive/tar/minitar/posix_header.rb +259 -0
- data/lib/archive/tar/minitar/reader.rb +237 -0
- data/lib/archive/tar/minitar/writer.rb +297 -0
- data/lib/minitar.rb +12 -0
- data/test/minitest_helper.rb +11 -0
- data/test/support/tar_test_helpers.rb +119 -0
- data/test/test_tar_header.rb +74 -0
- data/test/test_tar_input.rb +167 -0
- data/test/test_tar_output.rb +53 -0
- data/test/test_tar_reader.rb +148 -0
- data/test/test_tar_writer.rb +190 -0
- metadata +232 -43
- data/ChangeLog +0 -17
- data/Install +0 -6
- data/README +0 -68
- data/bin/minitar +0 -27
- data/lib/archive/tar/minitar/command.rb +0 -814
- data/tests/tc_tar.rb +0 -629
- data/tests/testall.rb +0 -10
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 110bdb26f19a848935a086caa42ea6eb583601bb
|
4
|
+
data.tar.gz: 99b2ba5ae2238ed1aa3902287a8fd9520576323e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: daadd21c3c02bfd11bb9a6d7294d0e7bac36410d1c391cc4e97a53b89d6c6cdbf5ee763dc777736460177dc88d9332d82370048bfc8470ca8f2edfd5872e73ee
|
7
|
+
data.tar.gz: 0541e16a13d4516494f4365c0c7e607996c837e192eb5d16754d4f36a21fd8fad847df9f233f59b358be7d164d2794c54fb7312b6e85866450f7147bf9eb9180
|
data/Code-of-Conduct.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Contributing.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
## Contributing
|
2
|
+
|
3
|
+
I value any contribution to minitar you can provide: a bug report, a feature
|
4
|
+
request, or code contributions. There are a few guidelines for contributing to
|
5
|
+
minitar:
|
6
|
+
|
7
|
+
* Code changes *will not* be accepted without tests. The test suite is
|
8
|
+
written with [Minitest][].
|
9
|
+
* Match my coding style.
|
10
|
+
* Use a thoughtfully-named topic branch that contains your change. Rebase
|
11
|
+
your commits into logical chunks as necessary.
|
12
|
+
* Use [quality commit messages][].
|
13
|
+
* Do not change the version number; when your patch is accepted and a release
|
14
|
+
is made, the version will be updated at that point.
|
15
|
+
* Submit a GitHub pull request with your changes.
|
16
|
+
* New or changed behaviours require appropriate documentation.
|
17
|
+
|
18
|
+
### Test Dependencies
|
19
|
+
|
20
|
+
minitar uses Ryan Davis’s [Hoe][] to manage the release process, and it adds a
|
21
|
+
number of rake tasks. You will mostly be interested in:
|
22
|
+
|
23
|
+
$ rake
|
24
|
+
|
25
|
+
which runs the tests the same way that:
|
26
|
+
|
27
|
+
$ rake test
|
28
|
+
$ rake travis
|
29
|
+
|
30
|
+
will do.
|
31
|
+
|
32
|
+
To assist with the installation of the development dependencies for minitar, I
|
33
|
+
have provided the simplest possible Gemfile pointing to the (generated)
|
34
|
+
`minitar.gemspec` file. This will permit you to do:
|
35
|
+
|
36
|
+
$ bundle install
|
37
|
+
|
38
|
+
to get the development dependencies. If you aleady have `hoe` installed, you
|
39
|
+
can accomplish the same thing with:
|
40
|
+
|
41
|
+
$ rake newb
|
42
|
+
|
43
|
+
This task will install any missing dependencies, run the tests/specs, and
|
44
|
+
generate the RDoc.
|
45
|
+
|
46
|
+
You can run tests with code coverage analysis by running:
|
47
|
+
|
48
|
+
$ rake test:coverage
|
49
|
+
|
50
|
+
### Workflow
|
51
|
+
|
52
|
+
Here's the most direct way to get your work merged into the project:
|
53
|
+
|
54
|
+
* Fork the project.
|
55
|
+
* Clone down your fork (`git clone git://github.com/<username>/minitar.git`).
|
56
|
+
* Create a topic branch to contain your change (`git checkout -b
|
57
|
+
my_awesome_feature`).
|
58
|
+
* Hack away, add tests. Not necessarily in that order.
|
59
|
+
* Make sure everything still passes by running `rake`.
|
60
|
+
* If necessary, rebase your commits into logical chunks, without errors.
|
61
|
+
* Push the branch up (`git push origin my_awesome_feature`).
|
62
|
+
* Create a pull request against halostatue/minitar and describe what your
|
63
|
+
change does and the why you think it should be merged.
|
64
|
+
|
65
|
+
### Contributors
|
66
|
+
|
67
|
+
* Austin Ziegler created minitar, based on work originally written by
|
68
|
+
Mauricio Fernández for rpa-base.
|
69
|
+
|
70
|
+
Thanks to everyone who has contributed to minitar:
|
71
|
+
|
72
|
+
* Antoine Toulme
|
73
|
+
* Curtis Sampson
|
74
|
+
* Daniel J. Berger
|
75
|
+
* Kazuyoshi Kato
|
76
|
+
* Matthew Kent
|
77
|
+
* Michal Suchanek
|
78
|
+
* Mike Furr
|
79
|
+
* Pete Fritchman
|
80
|
+
* Zach Dennis
|
81
|
+
|
82
|
+
[Minitest]: https://github.com/seattlerb/minitest
|
83
|
+
[quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
84
|
+
[Hoe]: https://github.com/seattlerb/hoe
|
data/History.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
## 0.6 / 2017-02-07
|
2
|
+
|
3
|
+
* Breaking Changes:
|
4
|
+
|
5
|
+
* Extracted `bin/minitar` into a new gem, `minitar-cli`. No, I am *not*
|
6
|
+
going to bump the major version for this. As far as I can tell, few
|
7
|
+
people use the command-line utility anyway. (Installing
|
8
|
+
`archive-tar-minitar` will install both `minitar` and `minitar-cli`, at
|
9
|
+
least until version 1.0.)
|
10
|
+
|
11
|
+
* Minitar extraction before 0.6 traverses directories if the tarball
|
12
|
+
includes a relative directory reference, as reported in [#16][] by
|
13
|
+
@ecneladis. This has been disallowed entirely and will throw a
|
14
|
+
SecureRelativePathError when found. Additionally, if the final
|
15
|
+
destination of an entry is an already-existing symbolic link, the
|
16
|
+
existing symbolic link will be removed and the file will be written
|
17
|
+
correctly (on platforms that support symblic links).
|
18
|
+
|
19
|
+
* Enhancements:
|
20
|
+
|
21
|
+
* Licence change. After speaking with Mauricio Fernández, we have changed
|
22
|
+
the licensing of this library to Ruby and Simplified BSD and have
|
23
|
+
dropped the GNU GPL license. This takes effect from the 0.6 release.
|
24
|
+
* Printing a deprecation warning for including Archive::Tar to put
|
25
|
+
Minitar in the top-level namespace.
|
26
|
+
* Printing a deprecation warning for including Archive::Tar::Minitar into
|
27
|
+
a class (Minitar will be a class for version 1.0).
|
28
|
+
* Moved Archive::Tar::PosixHeader to Archive::Tar::Minitar::PosixHeader
|
29
|
+
with a deprecation warning. Do not depend on
|
30
|
+
Archive::Tar::Minitar::PosixHeader, as it will be moving to
|
31
|
+
::Minitar::PosixHeader in a future release.
|
32
|
+
* Added an alias, ::Minitar, for Archive::Tar::Minitar, opted in with
|
33
|
+
`require 'minitar'`. In future releases, this alias will be enabled by
|
34
|
+
default, and the Archive::Tar namespace will be removed entirely for
|
35
|
+
version 1.0.
|
36
|
+
* Modified the handling of `mtime` in PosixHeader to do an integer
|
37
|
+
conversion (#to_i) so that a Time object can be used instead of the
|
38
|
+
integer value of the time object.
|
39
|
+
* Writer::RestrictedStream was renamed to Writer::WriteOnlyStream for
|
40
|
+
clarity. No alias or deprecation warning was provided for this as it is
|
41
|
+
an internal implementation detail.
|
42
|
+
* Writer::BoundedStream was renamed to Writer::BoundedWriteStream for
|
43
|
+
clarity. A deprecation warning is provided on first use because a
|
44
|
+
BoundedWriteStream may raise a BoundedWriteStream::FileOverflow
|
45
|
+
exception.
|
46
|
+
* Writer::BoundedWriteStream::FileOverflow has been renamed to
|
47
|
+
Writer::WriteBoundaryOverflow and inherits from StandardError instead
|
48
|
+
of RuntimeError. Note that for Ruby 2.0 or higher, an error will be
|
49
|
+
raised when specifying Writer::BoundedWriteStream::FileOverflow because
|
50
|
+
Writer::BoundedWriteStream has been declared a private constant.
|
51
|
+
* Modified Writer#add_file_simple to accept the data for a
|
52
|
+
file in `opts[:data]`. When `opts[:data]` is provided, a stream block
|
53
|
+
must not be provided. Improved the documentation for this method.
|
54
|
+
* Modified Writer#add_file to accept `opts[:data]` and transparently call
|
55
|
+
Writer#add_file_simple in this case.
|
56
|
+
* Methods that require blocks are no longer required, so the
|
57
|
+
Archive::Tar::Minitar::BlockRequired exception has been removed with a
|
58
|
+
warning (this may not work on Ruby 1.8).
|
59
|
+
* Dramatically reduced the number of strings created when creating a
|
60
|
+
POSIX tarball header.
|
61
|
+
* Added a helper, Input.each_entry that iterates over each entry in an
|
62
|
+
opened entry object.
|
63
|
+
|
64
|
+
* Bugs:
|
65
|
+
|
66
|
+
* Fix [#2][] to handle IO streams that are not seekable, such as pipes,
|
67
|
+
STDIN, or STDOUT.
|
68
|
+
* Fix [#3][] to make the test timezone resilient.
|
69
|
+
* Fix [#4][] for supporting the reading of tar files with filenames in
|
70
|
+
the GNU long filename extension format. Ported from @atoulme’s fork,
|
71
|
+
originally provided by Curtis Sampson.
|
72
|
+
* Fix [#6][] by making it raise the correct error for a long filename
|
73
|
+
with no path components.
|
74
|
+
* Fix [#13][] provided by @fetep fixes an off-by-one error on filename
|
75
|
+
splitting.
|
76
|
+
* Fix [#14][] provided by @kzys should fix Windows detection issues.
|
77
|
+
* Fix [#16][] as specified above.
|
78
|
+
* Fix an issue where Minitar.pack would not include Unix hidden files
|
79
|
+
when creating a tarball.
|
80
|
+
|
81
|
+
* Development:
|
82
|
+
|
83
|
+
* Modernized minitar tooling around Hoe.
|
84
|
+
* Added travis and coveralls.
|
85
|
+
|
86
|
+
## 0.5.2 / 2008-02-26
|
87
|
+
|
88
|
+
* Bugs:
|
89
|
+
* Fixed a Ruby 1.9 compatibility error.
|
90
|
+
|
91
|
+
## 0.5.1 / 2004-09-27
|
92
|
+
|
93
|
+
* Bugs:
|
94
|
+
* Fixed a variable name error.
|
95
|
+
|
96
|
+
## 0.5.0
|
97
|
+
|
98
|
+
* Initial release. Does files and directories. Command does create, extract,
|
99
|
+
and list.
|
100
|
+
|
101
|
+
[#2]: https://github.com/halostatue/minitar/issues/2
|
102
|
+
[#3]: https://github.com/halostatue/minitar/issues/3
|
103
|
+
[#4]: https://github.com/halostatue/minitar/issues/4
|
104
|
+
[#6]: https://github.com/halostatue/minitar/issues/6
|
105
|
+
[#13]: https://github.com/halostatue/minitar/issues/13
|
106
|
+
[#14]: https://github.com/halostatue/minitar/issues/14
|
107
|
+
[#16]: https://github.com/halostatue/minitar/issues/16
|
data/Licence.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
## Licence
|
2
|
+
|
3
|
+
minitar is free software that may be redistributed and/or modified under the
|
4
|
+
terms of Ruby’s licence or the Simplified BSD licence.
|
5
|
+
|
6
|
+
* Copyright 2004–2017 Austin Ziegler.
|
7
|
+
* Portions copyright 2004 Mauricio Julio Fernández Pradier.
|
8
|
+
|
9
|
+
### Simplified BSD Licence
|
10
|
+
|
11
|
+
See the file docs/bsdl.txt in the main distribution.
|
12
|
+
|
13
|
+
### Ruby’s Licence
|
14
|
+
|
15
|
+
See the file docs/ruby.txt in the main distribution.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Code-of-Conduct.md
|
2
|
+
Contributing.md
|
3
|
+
History.md
|
4
|
+
Licence.md
|
5
|
+
Manifest.txt
|
6
|
+
README.rdoc
|
7
|
+
Rakefile
|
8
|
+
docs/bsdl.txt
|
9
|
+
docs/ruby.txt
|
10
|
+
lib/archive-tar-minitar.rb
|
11
|
+
lib/archive/tar/minitar.rb
|
12
|
+
lib/archive/tar/minitar/input.rb
|
13
|
+
lib/archive/tar/minitar/output.rb
|
14
|
+
lib/archive/tar/minitar/posix_header.rb
|
15
|
+
lib/archive/tar/minitar/reader.rb
|
16
|
+
lib/archive/tar/minitar/writer.rb
|
17
|
+
lib/minitar.rb
|
18
|
+
test/minitest_helper.rb
|
19
|
+
test/support/tar_test_helpers.rb
|
20
|
+
test/test_tar_header.rb
|
21
|
+
test/test_tar_input.rb
|
22
|
+
test/test_tar_output.rb
|
23
|
+
test/test_tar_reader.rb
|
24
|
+
test/test_tar_writer.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
= minitar
|
2
|
+
|
3
|
+
home :: https://github.com/halostatue/minitar/
|
4
|
+
code :: https://github.com/halostatue/minitar/
|
5
|
+
bugs :: https://github.com/halostatue/minitar/issues
|
6
|
+
rdoc :: http://rdoc.info/gems/minitar/
|
7
|
+
cli :: https://github.com/halostatue/minitar-cli
|
8
|
+
continuous integration :: {<img src="https://travis-ci.org/halostatue/minitar.svg" />}[https://travis-ci.org/halostatue/minitar]
|
9
|
+
{<img src="https://ci.appveyor.com/api/projects/status/bj4gqn3gp3gu45sa?svg=true" />}[https://ci.appveyor.com/project/halostatue/minitar]
|
10
|
+
test coverage :: {<img src="https://coveralls.io/repos/halostatue/minitar/badge.svg" alt="Coverage Status" />}[https://coveralls.io/r/halostatue/minitar]
|
11
|
+
|
12
|
+
== Description
|
13
|
+
|
14
|
+
The minitar library is a pure-Ruby library that provides the ability to deal
|
15
|
+
with POSIX tar(1) archive files.
|
16
|
+
|
17
|
+
This is release 0.6, providing a number of bug fixes including a directory
|
18
|
+
traversal vulnerability, CVE-2016-10173. This release starts the migration and
|
19
|
+
modernization of the code:
|
20
|
+
|
21
|
+
* the licence has been changed to match the modern Ruby licensing scheme
|
22
|
+
(Ruby and Simplified BSD instead of Ruby and GNU GPL);
|
23
|
+
* the +minitar+ command-line program has been separated into the
|
24
|
+
+minitar-cli+ gem; and
|
25
|
+
* the +archive-tar-minitar+ gem now points to the +minitar+ and +minitar-cli+
|
26
|
+
gems and discourages its installation.
|
27
|
+
|
28
|
+
Some of these changes may break existing programs that depend on the internal
|
29
|
+
structure of the minitar library, but every effort has been made to ensure
|
30
|
+
compatibility; inasmuch as is possible, this compatibility will be maintained
|
31
|
+
through the release of minitar 1.0 (which will have strong breaking changes).
|
32
|
+
|
33
|
+
minitar (previously called Archive::Tar::Minitar) is based heavily on code
|
34
|
+
originally written by Mauricio Julio Fernández Pradier for the rpa-base
|
35
|
+
project.
|
36
|
+
|
37
|
+
== Synopsis
|
38
|
+
|
39
|
+
Using minitar is easy. The simplest case is:
|
40
|
+
|
41
|
+
require 'minitar'
|
42
|
+
|
43
|
+
# Packs everything that matches Find.find('tests').
|
44
|
+
# test.tar will automatically be closed by Minitar.pack.
|
45
|
+
Minitar.pack('tests', File.open('test.tar', 'wb'))
|
46
|
+
|
47
|
+
# Unpacks 'test.tar' to 'x', creating 'x' if necessary.
|
48
|
+
Minitar.unpack('test.tar', 'x')
|
49
|
+
|
50
|
+
A gzipped tar can be written with:
|
51
|
+
|
52
|
+
require 'zlib'
|
53
|
+
# test.tgz will be closed automatically.
|
54
|
+
Minitar.pack('tests', Zlib::GzipWriter.new(File.open('test.tgz', 'wb'))
|
55
|
+
|
56
|
+
# test.tgz will be closed automatically.
|
57
|
+
Minitar.unpack(Zlib::GzipReader.new(File.open('test.tgz', 'rb')), 'x')
|
58
|
+
|
59
|
+
As the case above shows, one need not write to a file. However, it will
|
60
|
+
sometimes require that one dive a little deeper into the API, as in the case of
|
61
|
+
StringIO objects. Note that I'm not providing a block with Minitar::Output, as
|
62
|
+
Minitar::Output#close automatically closes both the Output object and the
|
63
|
+
wrapped data stream object.
|
64
|
+
|
65
|
+
begin
|
66
|
+
sgz = Zlib::GzipWriter.new(StringIO.new(String.new))
|
67
|
+
tar = Output.new(sgz)
|
68
|
+
Find.find('tests') do |entry|
|
69
|
+
Minitar.pack_file(entry, tar)
|
70
|
+
end
|
71
|
+
ensure
|
72
|
+
# Closes both tar and sgz.
|
73
|
+
tar.close
|
74
|
+
end
|
75
|
+
|
76
|
+
== minitar Semantic Versioning
|
77
|
+
|
78
|
+
The minitar library uses a {Semantic Versioning}[http://semver.org/] scheme
|
79
|
+
with one change:
|
80
|
+
|
81
|
+
* When PATCH is zero (+0+), it will be omitted from version references.
|
data/Rakefile
CHANGED
@@ -1,113 +1,52 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift('lib')
|
1
|
+
# -*- ruby encoding: utf-8 -*-
|
3
2
|
|
4
3
|
require 'rubygems'
|
5
|
-
require '
|
6
|
-
require 'rake/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
desc "Build the RubyGem for Archive::Tar::Minitar."
|
50
|
-
task :gem => [ :test ]
|
51
|
-
Rake::GemPackageTask.new(spec) do |g|
|
52
|
-
g.need_tar = false
|
53
|
-
g.need_zip = false
|
54
|
-
g.package_dir = ".."
|
55
|
-
end
|
56
|
-
|
57
|
-
desc "Build an Archive::Tar::Minitar .tar.gz distribution."
|
58
|
-
task :tar => [ TARDIST ]
|
59
|
-
file TARDIST do |t|
|
60
|
-
current = File.basename(Dir.pwd)
|
61
|
-
Dir.chdir("..") do
|
62
|
-
begin
|
63
|
-
files = Dir["#{current}/**/*"].select { |dd| dd !~ %r{(?:/CVS/?|~$)} }
|
64
|
-
files.map! do |dd|
|
65
|
-
ddnew = dd.gsub(/^#{current}/, DISTDIR)
|
66
|
-
mtime = ReleaseDate || File.stat(dd).mtime
|
67
|
-
if File.directory?(dd)
|
68
|
-
{ :name => ddnew, :mode => 0755, :dir => true, :mtime => mtime }
|
69
|
-
else
|
70
|
-
if dd =~ %r{bin/}
|
71
|
-
mode = 0755
|
72
|
-
else
|
73
|
-
mode = 0644
|
74
|
-
end
|
75
|
-
data = File.read(dd)
|
76
|
-
{ :name => ddnew, :mode => mode, :data => data, :size => data.size,
|
77
|
-
:mtime => mtime }
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
ff = File.open(t.name.gsub(%r{^\.\./}o, ''), "wb")
|
82
|
-
gz = Zlib::GzipWriter.new(ff)
|
83
|
-
tw = Archive::Tar::Minitar::Writer.new(gz)
|
84
|
-
|
85
|
-
files.each do |entry|
|
86
|
-
if entry[:dir]
|
87
|
-
tw.mkdir(entry[:name], entry)
|
88
|
-
else
|
89
|
-
tw.add_file_simple(entry[:name], entry) { |os| os.write(entry[:data]) }
|
90
|
-
end
|
91
|
-
end
|
92
|
-
ensure
|
93
|
-
tw.close if tw
|
94
|
-
gz.close if gz
|
4
|
+
require 'hoe'
|
5
|
+
require 'rake/clean'
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift('support')
|
8
|
+
|
9
|
+
Hoe.plugin :doofus
|
10
|
+
Hoe.plugin :gemspec2
|
11
|
+
Hoe.plugin :git
|
12
|
+
Hoe.plugin :minitest
|
13
|
+
Hoe.plugin :travis
|
14
|
+
Hoe.plugin :deprecated_gem
|
15
|
+
Hoe.plugin :email unless ENV['CI'] or ENV['TRAVIS']
|
16
|
+
|
17
|
+
spec = Hoe.spec 'minitar' do
|
18
|
+
developer('Austin Ziegler', 'halostatue@gmail.com')
|
19
|
+
|
20
|
+
require_ruby_version '>= 1.8'
|
21
|
+
|
22
|
+
self.history_file = 'History.md'
|
23
|
+
self.readme_file = 'README.rdoc'
|
24
|
+
self.licenses = ['Ruby', 'BSD-2-Clause']
|
25
|
+
|
26
|
+
self.post_install_message = <<-EOS
|
27
|
+
The `minitar` executable is no longer bundled with `minitar`. If you are
|
28
|
+
expecting this executable, make sure you also install `minitar-cli`.
|
29
|
+
EOS
|
30
|
+
|
31
|
+
extra_dev_deps << ['hoe-doofus', '~> 1.0']
|
32
|
+
extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
|
33
|
+
extra_dev_deps << ['hoe-git', '~> 1.6']
|
34
|
+
extra_dev_deps << ['hoe-rubygems', '~> 1.0']
|
35
|
+
extra_dev_deps << ['hoe-travis', '~> 1.2']
|
36
|
+
extra_dev_deps << ['minitest', '~> 5.3']
|
37
|
+
extra_dev_deps << ['minitest-autotest', ['>= 1.0', '<2']]
|
38
|
+
extra_dev_deps << ['rake', '>= 10.0', '< 12']
|
39
|
+
extra_dev_deps << ['rdoc', '>= 0.0']
|
40
|
+
end
|
41
|
+
|
42
|
+
if RUBY_VERSION >= '2.0' && RUBY_ENGINE == 'ruby'
|
43
|
+
namespace :test do
|
44
|
+
desc 'Run test coverage'
|
45
|
+
task :coverage do
|
46
|
+
spec.test_prelude = 'load ".simplecov-prelude.rb"'
|
47
|
+
Rake::Task['test'].execute
|
95
48
|
end
|
96
49
|
end
|
97
|
-
end
|
98
|
-
task TARDIST => [ :test ]
|
99
|
-
|
100
|
-
def sign(file)
|
101
|
-
sh %("C:\\Program Files\\Windows Privacy Tools\\GnuPG\\Gpg.exe" -ba #{file})
|
102
|
-
end
|
103
|
-
|
104
|
-
task :signtar => [ :tar ] do
|
105
|
-
sign TARDIST
|
106
|
-
end
|
107
|
-
task :signgem => [ :gem ] do
|
108
|
-
sign "../#{DISTDIR}.gem"
|
109
|
-
end
|
110
50
|
|
111
|
-
|
112
|
-
task :default => [ :signtar, :signgem ] do
|
51
|
+
Rake::Task['travis'].prerequisites.replace(%w(test:coverage))
|
113
52
|
end
|