minitar-cli 0.9 → 1.0.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 +4 -4
- data/Code-of-Conduct.md +128 -0
- data/Contributing.md +33 -34
- data/History.md +17 -8
- data/Licence.md +4 -4
- data/Manifest.txt +1 -0
- data/README.rdoc +1 -6
- data/Rakefile +16 -24
- data/bin/minitar +3 -3
- data/lib/minitar/cli/command/create.rb +16 -16
- data/lib/minitar/cli/command/extract.rb +29 -29
- data/lib/minitar/cli/command/help.rb +6 -6
- data/lib/minitar/cli/command/list.rb +42 -42
- data/lib/minitar/cli/command.rb +2 -2
- data/lib/minitar/cli/commander.rb +7 -7
- data/lib/minitar/cli.rb +23 -21
- data/test/fixtures/spaces.tar.gz +0 -0
- data/test/minitest_helper.rb +6 -5
- data/test/support/minitar_cli_test_helper.rb +7 -1
- data/test/test_cli_help.rb +11 -11
- data/test/test_cli_list.rb +42 -57
- metadata +53 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11572498bcd45ede5ca69b29310d1e087c69b83dae809496a4e0e457a0a794e8
|
4
|
+
data.tar.gz: 2822a3ffc81ed9ceb622f06a4f631677294b40e3ecca8cd728fb2a95dc7fadb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40558f4b57f502b7139d463c2bbf0e4355b73395ea127ac625f8ce57b3eba6a952cd44303c46c61a437d1b08ecea41041c7939e55f6c08ace85d32205f7bea69
|
7
|
+
data.tar.gz: 6657646298c8f16c7926362f04ae5c6c04572f6b8868b95fc4a0c60d5123db5312bb261318f8885a29ed2b249cf0b3652c43591a8758be56538ac2ed8287f544
|
data/Code-of-Conduct.md
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
- Demonstrating empathy and kindness toward other people
|
21
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
- Giving and gracefully accepting constructive feedback
|
23
|
+
- Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
- Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
- The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
- Public or private harassment
|
34
|
+
- Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at [INSERT CONTACT
|
63
|
+
METHOD]. All complaints will be reviewed and investigated promptly and fairly.
|
64
|
+
|
65
|
+
All community leaders are obligated to respect the privacy and security of the
|
66
|
+
reporter of any incident.
|
67
|
+
|
68
|
+
## Enforcement Guidelines
|
69
|
+
|
70
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
71
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
72
|
+
|
73
|
+
### 1. Correction
|
74
|
+
|
75
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
76
|
+
unprofessional or unwelcome in the community.
|
77
|
+
|
78
|
+
**Consequence**: A private, written warning from community leaders, providing
|
79
|
+
clarity around the nature of the violation and an explanation of why the
|
80
|
+
behavior was inappropriate. A public apology may be requested.
|
81
|
+
|
82
|
+
### 2. Warning
|
83
|
+
|
84
|
+
**Community Impact**: A violation through a single incident or series of
|
85
|
+
actions.
|
86
|
+
|
87
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
88
|
+
interaction with the people involved, including unsolicited interaction with
|
89
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
90
|
+
includes avoiding interactions in community spaces as well as external channels
|
91
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
92
|
+
ban.
|
93
|
+
|
94
|
+
### 3. Temporary Ban
|
95
|
+
|
96
|
+
**Community Impact**: A serious violation of community standards, including
|
97
|
+
sustained inappropriate behavior.
|
98
|
+
|
99
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
100
|
+
communication with the community for a specified period of time. No public or
|
101
|
+
private interaction with the people involved, including unsolicited interaction
|
102
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
103
|
+
Violating these terms may lead to a permanent ban.
|
104
|
+
|
105
|
+
### 4. Permanent Ban
|
106
|
+
|
107
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
108
|
+
standards, including sustained inappropriate behavior, harassment of an
|
109
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
110
|
+
|
111
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
112
|
+
community.
|
113
|
+
|
114
|
+
## Attribution
|
115
|
+
|
116
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
117
|
+
version 2.1, available at
|
118
|
+
<https://www.contributor-covenant.org/version/2/1/code_of_conduct.html>.
|
119
|
+
|
120
|
+
Community Impact Guidelines were inspired by
|
121
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
122
|
+
|
123
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
124
|
+
<https://www.contributor-covenant.org/faq>. Translations are available at
|
125
|
+
<https://www.contributor-covenant.org/translations>.
|
126
|
+
|
127
|
+
[homepage]: https://www.contributor-covenant.org
|
128
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
data/Contributing.md
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
## Contributing
|
2
2
|
|
3
|
-
I value any contribution to minitar-cli you can provide: a bug report, a
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
3
|
+
I value any contribution to minitar-cli you can provide: a bug report, a feature
|
4
|
+
request, or code contributions. There are a few guidelines for contributing to
|
5
|
+
minitar-cli:
|
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
17
|
|
18
18
|
### Test Dependencies
|
19
19
|
|
20
|
-
minitar-cli uses Ryan Davis’s [Hoe][] to manage the release process, and it
|
21
|
-
|
20
|
+
minitar-cli uses Ryan Davis’s [Hoe][] to manage the release process, and it adds
|
21
|
+
a number of rake tasks. You will mostly be interested in:
|
22
22
|
|
23
23
|
$ rake
|
24
24
|
|
@@ -29,14 +29,14 @@ which runs the tests the same way that:
|
|
29
29
|
|
30
30
|
will do.
|
31
31
|
|
32
|
-
To assist with the installation of the development dependencies for
|
33
|
-
|
34
|
-
|
32
|
+
To assist with the installation of the development dependencies for minitar-cli,
|
33
|
+
I have provided the simplest possible Gemfile pointing to the (generated)
|
34
|
+
`minitar-cli.gemspec` file. This will permit you to do:
|
35
35
|
|
36
36
|
$ bundle install
|
37
37
|
|
38
|
-
to get the development dependencies. If you aleady have `hoe` installed, you
|
39
|
-
|
38
|
+
to get the development dependencies. If you aleady have `hoe` installed, you can
|
39
|
+
accomplish the same thing with:
|
40
40
|
|
41
41
|
$ rake newb
|
42
42
|
|
@@ -51,21 +51,20 @@ You can run tests with code coverage analysis by running:
|
|
51
51
|
|
52
52
|
Here's the most direct way to get your work merged into the project:
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
change does and the why you think it should be merged.
|
54
|
+
- Fork the project.
|
55
|
+
- Clone down your fork (`git clone git://github.com/<username>/minitar-cli.git`).
|
56
|
+
- Create a topic branch to contain your change (`git checkout -b my_awesome_feature`).
|
57
|
+
- Hack away, add tests. Not necessarily in that order.
|
58
|
+
- Make sure everything still passes by running `rake`.
|
59
|
+
- If necessary, rebase your commits into logical chunks, without errors.
|
60
|
+
- Push the branch up (`git push origin my_awesome_feature`).
|
61
|
+
- Create a pull request against halostatue/minitar-cli and describe what your
|
62
|
+
change does and the why you think it should be merged.
|
64
63
|
|
65
64
|
### Contributors
|
66
65
|
|
67
|
-
|
66
|
+
- Austin Ziegler created minitar-cli, extracted from Archive::Tar::Minitar.
|
68
67
|
|
69
|
-
[
|
68
|
+
[minitest]: https://github.com/seattlerb/minitest
|
70
69
|
[quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
71
|
-
[
|
70
|
+
[hoe]: https://github.com/seattlerb/hoe
|
data/History.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
+
# History
|
2
|
+
|
3
|
+
## 1.0.0 / 2024-08-07
|
4
|
+
|
5
|
+
- Updated for compatibility with minitar 1.0.0.
|
6
|
+
|
7
|
+
## 0.12 / 2024-08-06
|
8
|
+
|
9
|
+
- Updated for compatibility with minitar 0.12.
|
10
|
+
|
1
11
|
## 0.9 / 2024-07-02
|
2
12
|
|
3
|
-
- Updated for compatibility with minitar 0.9. Provided in [#4][] by
|
13
|
+
- Updated for compatibility with minitar 0.9. Provided in [#4][#4] by
|
4
14
|
david22swan. Thanks!
|
5
15
|
|
6
16
|
## 0.8 / 2019-01-05
|
@@ -13,8 +23,7 @@
|
|
13
23
|
|
14
24
|
## 0.6.1 / 2017-02-08
|
15
25
|
|
16
|
-
- Fixed an issue where `bin/minitar` was not loading zlib for compressed
|
17
|
-
files.
|
26
|
+
- Fixed an issue where `bin/minitar` was not loading zlib for compressed files.
|
18
27
|
|
19
28
|
## 0.6 / 2017-02-07
|
20
29
|
|
@@ -23,15 +32,15 @@
|
|
23
32
|
|
24
33
|
- Enhancements:
|
25
34
|
|
26
|
-
- Extracted `bin/minitar` from [minitar][].
|
27
|
-
- Replaced Satoru Takabayashi’s [Ruby Progress Bar][] with
|
28
|
-
[busyloop/powerbar][].
|
35
|
+
- Extracted `bin/minitar` from [minitar][minitar].
|
36
|
+
- Replaced Satoru Takabayashi’s [Ruby Progress Bar][Ruby Progress Bar] with
|
37
|
+
[busyloop/powerbar][busyloop/powerbar].
|
29
38
|
- Added filename filtering to `minitar list`.
|
30
39
|
|
31
40
|
- Bugs:
|
32
41
|
|
33
|
-
- Fixed a problem where `bin/minitar create` would not include dotfiles
|
34
|
-
|
42
|
+
- Fixed a problem where `bin/minitar create` would not include dotfiles on
|
43
|
+
Unix systems.
|
35
44
|
|
36
45
|
- Development:
|
37
46
|
|
data/Licence.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
## Licence
|
2
2
|
|
3
|
-
minitar-cli is free software that may be redistributed and/or modified under
|
4
|
-
|
3
|
+
minitar-cli is free software that may be redistributed and/or modified under the
|
4
|
+
terms of Ruby’s licence or the Simplified BSD licence.
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
- Copyright 2004–2024 Austin Ziegler.
|
7
|
+
- Portions copyright 2004 Mauricio Julio Fernández Pradier.
|
8
8
|
|
9
9
|
### Simplified BSD Licence
|
10
10
|
|
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -3,10 +3,7 @@
|
|
3
3
|
home :: https://github.com/halostatue/minitar-cli/
|
4
4
|
code :: https://github.com/halostatue/minitar-cli/
|
5
5
|
bugs :: https://github.com/halostatue/minitar-cli/issues
|
6
|
-
rdoc ::
|
7
|
-
travis :: {<img src="https://travis-ci.org/halostatue/minitar-cli.svg" />}[https://travis-ci.org/halostatue/minitar-cli]
|
8
|
-
appveyor :: {<img src="https://ci.appveyor.com/api/projects/status/bj4gqn3gp3gu45sa?svg=true" />}[https://ci.appveyor.com/project/halostatue/minitar-cli]
|
9
|
-
coveralls :: {<img src="https://coveralls.io/repos/halostatue/minitar-cli/badge.svg" alt="Coverage Status" />}[https://coveralls.io/r/halostatue/minitar-cli]
|
6
|
+
rdoc :: https://rdoc.info/gems/minitar-cli/
|
10
7
|
|
11
8
|
== Description
|
12
9
|
|
@@ -14,8 +11,6 @@ coveralls :: {<img src="https://coveralls.io/repos/halostatue/minitar-cli/badge.
|
|
14
11
|
{minitar}[https://github.com/halostatue/minitar] to provide a command-line
|
15
12
|
tool, +minitar+, for working with POSIX tar(1) archive files.
|
16
13
|
|
17
|
-
This is release 0.7, extracted from {minitar}[https://halostatue.ca/minitar],
|
18
|
-
with modernizations.
|
19
14
|
|
20
15
|
== Synopsis
|
21
16
|
|
data/Rakefile
CHANGED
@@ -6,41 +6,33 @@ require "rake/clean"
|
|
6
6
|
|
7
7
|
Hoe.plugin :doofus
|
8
8
|
Hoe.plugin :gemspec2
|
9
|
-
Hoe.plugin :
|
9
|
+
Hoe.plugin :git2
|
10
10
|
Hoe.plugin :minitest
|
11
|
-
Hoe.plugin :
|
12
|
-
Hoe.plugin :email unless ENV["CI"] || ENV["TRAVIS"]
|
11
|
+
Hoe.plugin :rubygems
|
13
12
|
|
14
|
-
|
13
|
+
Hoe.spec "minitar-cli" do
|
15
14
|
developer("Austin Ziegler", "halostatue@gmail.com")
|
16
15
|
|
17
|
-
require_ruby_version ">= 1.8"
|
18
|
-
|
19
16
|
self.history_file = "History.md"
|
20
17
|
self.readme_file = "README.rdoc"
|
18
|
+
|
19
|
+
require_ruby_version ">= 3.1"
|
20
|
+
|
21
21
|
self.licenses = ["Ruby", "BSD-2-Clause"]
|
22
22
|
|
23
|
-
|
23
|
+
spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }
|
24
|
+
|
25
|
+
extra_deps << ["minitar", "~> 1.0.0"]
|
24
26
|
extra_deps << ["powerbar", "~> 1.0"]
|
25
27
|
|
28
|
+
extra_dev_deps << ["hoe", "~> 4.0"]
|
26
29
|
extra_dev_deps << ["hoe-doofus", "~> 1.0"]
|
27
30
|
extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
|
28
|
-
extra_dev_deps << ["hoe-
|
31
|
+
extra_dev_deps << ["hoe-git2", "~> 1.7"]
|
29
32
|
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
|
30
|
-
extra_dev_deps << ["
|
31
|
-
extra_dev_deps << ["minitest", "~>
|
32
|
-
extra_dev_deps << ["minitest-
|
33
|
-
extra_dev_deps << ["rake", "<14"]
|
34
|
-
|
35
|
-
|
36
|
-
if RUBY_VERSION >= "2.0" && RUBY_ENGINE == "ruby"
|
37
|
-
namespace :test do
|
38
|
-
desc "Run test coverage"
|
39
|
-
task :coverage do
|
40
|
-
spec.test_prelude = 'load ".simplecov-prelude.rb"'
|
41
|
-
Rake::Task["test"].execute
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
Rake::Task["travis"].prerequisites.replace(%w[test:coverage])
|
33
|
+
extra_dev_deps << ["minitest", "~> 5.16"]
|
34
|
+
extra_dev_deps << ["minitest-autotest", "~> 1.0"]
|
35
|
+
extra_dev_deps << ["minitest-focus", "~> 1.0"]
|
36
|
+
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
|
37
|
+
extra_dev_deps << ["standard", "~> 1.0"]
|
46
38
|
end
|
data/bin/minitar
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
|
-
git_path = File.expand_path(
|
4
|
+
git_path = File.expand_path("../../.git", __FILE__)
|
5
5
|
if File.exist?(git_path)
|
6
|
-
$LOAD_PATH.unshift(File.expand_path(
|
6
|
+
$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__))
|
7
7
|
end
|
8
8
|
|
9
|
-
require
|
9
|
+
require "minitar/cli"
|
10
10
|
|
11
11
|
exit Minitar::CLI.run(ARGV)
|
@@ -5,14 +5,14 @@
|
|
5
5
|
# 1.9 support have been dropped.
|
6
6
|
class Minitar::CLI::Command::Create < Minitar::CLI::Command
|
7
7
|
def name
|
8
|
-
|
8
|
+
"create"
|
9
9
|
end
|
10
10
|
|
11
11
|
def altname
|
12
|
-
|
12
|
+
"cr"
|
13
13
|
end
|
14
14
|
|
15
|
-
HELP = <<-EOH
|
15
|
+
HELP = <<-EOH
|
16
16
|
minitar create [OPTIONS] <tarfile|-> <file|directory|-->+
|
17
17
|
|
18
18
|
Creates a new tarfile. If the tarfile is named .tar.gz or .tgz, then it
|
@@ -37,7 +37,7 @@ create Options:
|
|
37
37
|
|
38
38
|
while (arg = args.shift)
|
39
39
|
case arg
|
40
|
-
when
|
40
|
+
when "--compress", "-z"
|
41
41
|
opts[:compress] = true
|
42
42
|
else
|
43
43
|
argv << arg
|
@@ -46,33 +46,33 @@ create Options:
|
|
46
46
|
|
47
47
|
if argv.size < 2
|
48
48
|
ioe[:output] << "Not enough arguments.\n\n"
|
49
|
-
commander.command(
|
49
|
+
commander.command("help").call(%w(create))
|
50
50
|
return 255
|
51
51
|
end
|
52
52
|
|
53
53
|
output = argv.shift
|
54
|
-
if
|
55
|
-
opts[:name] =
|
54
|
+
if output == "-"
|
55
|
+
opts[:name] = "STDOUT"
|
56
56
|
output = ioe[:output]
|
57
57
|
opts[:output] = ioe[:error]
|
58
58
|
else
|
59
59
|
opts[:name] = output
|
60
|
-
output = File.open(output,
|
60
|
+
output = File.open(output, "wb")
|
61
61
|
opts[:output] = ioe[:output]
|
62
62
|
end
|
63
63
|
|
64
|
-
if
|
65
|
-
require
|
64
|
+
if /\.tar\.gz$|\.tgz$/ =~ opts[:name] || opts[:compress]
|
65
|
+
require "zlib"
|
66
66
|
output = Zlib::GzipWriter.new(output)
|
67
67
|
end
|
68
68
|
|
69
69
|
files = []
|
70
|
-
if argv.include?(
|
70
|
+
if argv.include?("--")
|
71
71
|
# Read stdin for the list of files.
|
72
|
-
files =
|
72
|
+
files = ""
|
73
73
|
files << ioe[:input].read until ioe[:input].eof?
|
74
74
|
files = files.split(/\r\n|\n|\r/)
|
75
|
-
args.delete(
|
75
|
+
args.delete("--")
|
76
76
|
end
|
77
77
|
|
78
78
|
files << argv.to_a
|
@@ -87,7 +87,7 @@ create Options:
|
|
87
87
|
silent
|
88
88
|
end
|
89
89
|
|
90
|
-
|
90
|
+
Minitar.pack(files, output, &watcher)
|
91
91
|
finisher.call
|
92
92
|
0
|
93
93
|
ensure
|
@@ -110,7 +110,7 @@ create Options:
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def progress
|
113
|
-
require
|
113
|
+
require "powerbar"
|
114
114
|
progress = PowerBar.new(:msg => opts[:name], :total => 1)
|
115
115
|
[
|
116
116
|
lambda { |action, name, stats|
|
@@ -140,6 +140,6 @@ create Options:
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def silent
|
143
|
-
[
|
143
|
+
[lambda { |_, _, _| }, lambda {}]
|
144
144
|
end
|
145
145
|
end
|
@@ -5,14 +5,14 @@
|
|
5
5
|
# and 1.9 support have been dropped.
|
6
6
|
class Minitar::CLI::Command::Extract < Minitar::CLI::Command
|
7
7
|
def name
|
8
|
-
|
8
|
+
"extract"
|
9
9
|
end
|
10
10
|
|
11
11
|
def altname
|
12
|
-
|
12
|
+
"ex"
|
13
13
|
end
|
14
14
|
|
15
|
-
HELP = <<-EOH
|
15
|
+
HELP = <<-EOH
|
16
16
|
minitar extract [OPTIONS] <tarfile|-> [<file>+]
|
17
17
|
|
18
18
|
Extracts files from an existing tarfile. If the tarfile is named .tar.gz
|
@@ -36,19 +36,19 @@ extract Options:
|
|
36
36
|
include CatchMinitarErrors
|
37
37
|
|
38
38
|
def run(args, opts = {})
|
39
|
-
argv
|
40
|
-
output
|
41
|
-
dest
|
42
|
-
files
|
39
|
+
argv = []
|
40
|
+
output = nil
|
41
|
+
dest = "."
|
42
|
+
files = []
|
43
43
|
|
44
44
|
while (arg = args.shift)
|
45
45
|
case arg
|
46
|
-
when
|
46
|
+
when "--uncompress", "-z"
|
47
47
|
opts[:uncompress] = true
|
48
|
-
when
|
48
|
+
when "--pipe"
|
49
49
|
output = ioe[:output]
|
50
50
|
ioe[:output] = ioe[:error]
|
51
|
-
when
|
51
|
+
when "--output", "-o"
|
52
52
|
dest = args.shift
|
53
53
|
else
|
54
54
|
argv << arg
|
@@ -57,21 +57,21 @@ extract Options:
|
|
57
57
|
|
58
58
|
if argv.empty?
|
59
59
|
ioe[:output] << "Not enough arguments.\n\n"
|
60
|
-
commander.command(
|
60
|
+
commander.command("help").call(%w(extract))
|
61
61
|
return 255
|
62
62
|
end
|
63
63
|
|
64
64
|
input = argv.shift
|
65
|
-
if
|
66
|
-
opts[:name] =
|
65
|
+
if input == "-"
|
66
|
+
opts[:name] = "STDIN"
|
67
67
|
input = ioe[:input]
|
68
68
|
else
|
69
69
|
opts[:name] = input
|
70
|
-
input = File.open(input,
|
70
|
+
input = File.open(input, "rb")
|
71
71
|
end
|
72
72
|
|
73
|
-
if
|
74
|
-
require
|
73
|
+
if /\.tar\.gz$|\.tgz$/ =~ opts[:name] || opts[:uncompress]
|
74
|
+
require "zlib"
|
75
75
|
input = Zlib::GzipReader.new(input)
|
76
76
|
end
|
77
77
|
|
@@ -88,21 +88,21 @@ extract Options:
|
|
88
88
|
end
|
89
89
|
|
90
90
|
if output.nil?
|
91
|
-
|
91
|
+
Minitar.unpack(input, dest, files, &watcher)
|
92
92
|
finisher.call
|
93
93
|
else
|
94
|
-
|
94
|
+
Minitar::Input.each_entry(input) do |entry|
|
95
95
|
next unless files.empty? || files.include?(entry.full_name)
|
96
96
|
|
97
97
|
stats = {
|
98
|
-
:mode
|
99
|
-
:mtime
|
100
|
-
:size
|
101
|
-
:gid
|
102
|
-
:uid
|
103
|
-
:current
|
104
|
-
:currinc
|
105
|
-
:entry
|
98
|
+
:mode => entry.mode,
|
99
|
+
:mtime => entry.mtime,
|
100
|
+
:size => entry.size,
|
101
|
+
:gid => entry.gid,
|
102
|
+
:uid => entry.uid,
|
103
|
+
:current => 0,
|
104
|
+
:currinc => 0,
|
105
|
+
:entry => entry
|
106
106
|
}
|
107
107
|
|
108
108
|
if entry.directory?
|
@@ -134,14 +134,14 @@ extract Options:
|
|
134
134
|
def verbose
|
135
135
|
[
|
136
136
|
lambda { |action, name, _stats|
|
137
|
-
ioe[:output] << "#{name}\n" if action == :dir
|
137
|
+
ioe[:output] << "#{name}\n" if action == :dir || action == :file_done
|
138
138
|
},
|
139
139
|
lambda { ioe[:output] << "\n" }
|
140
140
|
]
|
141
141
|
end
|
142
142
|
|
143
143
|
def progress
|
144
|
-
require
|
144
|
+
require "powerbar"
|
145
145
|
progress = PowerBar.new(:msg => opts[:name], :total => 1)
|
146
146
|
[
|
147
147
|
lambda { |action, name, stats|
|
@@ -170,6 +170,6 @@ extract Options:
|
|
170
170
|
end
|
171
171
|
|
172
172
|
def silent
|
173
|
-
[
|
173
|
+
[lambda { |_, _, _| }, lambda {}]
|
174
174
|
end
|
175
175
|
end
|
@@ -5,10 +5,10 @@
|
|
5
5
|
# support have been dropped.
|
6
6
|
class Minitar::CLI::Command::Help < Minitar::CLI::Command
|
7
7
|
def name
|
8
|
-
|
8
|
+
"help"
|
9
9
|
end
|
10
10
|
|
11
|
-
COMMANDS = <<-EOS
|
11
|
+
COMMANDS = <<-EOS
|
12
12
|
The commands known to minitar are:
|
13
13
|
|
14
14
|
minitar create Creates a new tarfile.
|
@@ -25,24 +25,24 @@ mutually exclusive. In "minitar list", --progress means the same as
|
|
25
25
|
|
26
26
|
EOS
|
27
27
|
|
28
|
-
BASIC = <<-EOS
|
28
|
+
BASIC = <<-EOS
|
29
29
|
This is a basic help message containing pointers to more information on
|
30
30
|
how to use this command-line tool. Try:
|
31
31
|
|
32
32
|
minitar help commands list all 'minitar' commands
|
33
33
|
minitar help <COMMAND> show help on <COMMAND>
|
34
34
|
(e.g., 'minitar help create')
|
35
|
-
EOS
|
35
|
+
EOS
|
36
36
|
|
37
37
|
def call(args, _opts = {})
|
38
38
|
help_on = args.shift
|
39
39
|
|
40
40
|
if commander.command?(help_on)
|
41
41
|
ioe[:output] << commander[help_on].help
|
42
|
-
elsif help_on ==
|
42
|
+
elsif help_on == "commands"
|
43
43
|
ioe[:output] << COMMANDS
|
44
44
|
else
|
45
|
-
unless help_on.nil?
|
45
|
+
unless help_on.nil? || help_on.empty?
|
46
46
|
ioe[:output] << "Unknown command: #{help_on}\n"
|
47
47
|
end
|
48
48
|
ioe[:output] << help
|