minitar-cli 0.12 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Code-of-Conduct.md +128 -0
- data/Contributing.md +33 -34
- data/History.md +13 -8
- data/Licence.md +4 -4
- data/Manifest.txt +1 -0
- data/README.rdoc +1 -6
- data/Rakefile +3 -3
- 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 +6 -6
- data/test/fixtures/spaces.tar.gz +0 -0
- data/test/minitest_helper.rb +1 -1
- data/test/support/minitar_cli_test_helper.rb +4 -9
- data/test/test_cli_help.rb +11 -11
- data/test/test_cli_list.rb +30 -47
- metadata +9 -10
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,10 +1,16 @@
|
|
1
|
+
# History
|
2
|
+
|
3
|
+
## 1.0.0 / 2024-08-07
|
4
|
+
|
5
|
+
- Updated for compatibility with minitar 1.0.0.
|
6
|
+
|
1
7
|
## 0.12 / 2024-08-06
|
2
8
|
|
3
9
|
- Updated for compatibility with minitar 0.12.
|
4
10
|
|
5
11
|
## 0.9 / 2024-07-02
|
6
12
|
|
7
|
-
- Updated for compatibility with minitar 0.9. Provided in [#4][] by
|
13
|
+
- Updated for compatibility with minitar 0.9. Provided in [#4][#4] by
|
8
14
|
david22swan. Thanks!
|
9
15
|
|
10
16
|
## 0.8 / 2019-01-05
|
@@ -17,8 +23,7 @@
|
|
17
23
|
|
18
24
|
## 0.6.1 / 2017-02-08
|
19
25
|
|
20
|
-
- Fixed an issue where `bin/minitar` was not loading zlib for compressed
|
21
|
-
files.
|
26
|
+
- Fixed an issue where `bin/minitar` was not loading zlib for compressed files.
|
22
27
|
|
23
28
|
## 0.6 / 2017-02-07
|
24
29
|
|
@@ -27,15 +32,15 @@
|
|
27
32
|
|
28
33
|
- Enhancements:
|
29
34
|
|
30
|
-
- Extracted `bin/minitar` from [minitar][].
|
31
|
-
- Replaced Satoru Takabayashi’s [Ruby Progress Bar][] with
|
32
|
-
[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].
|
33
38
|
- Added filename filtering to `minitar list`.
|
34
39
|
|
35
40
|
- Bugs:
|
36
41
|
|
37
|
-
- Fixed a problem where `bin/minitar create` would not include dotfiles
|
38
|
-
|
42
|
+
- Fixed a problem where `bin/minitar create` would not include dotfiles on
|
43
|
+
Unix systems.
|
39
44
|
|
40
45
|
- Development:
|
41
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
@@ -10,19 +10,19 @@ Hoe.plugin :git2
|
|
10
10
|
Hoe.plugin :minitest
|
11
11
|
Hoe.plugin :rubygems
|
12
12
|
|
13
|
-
|
13
|
+
Hoe.spec "minitar-cli" do
|
14
14
|
developer("Austin Ziegler", "halostatue@gmail.com")
|
15
15
|
|
16
16
|
self.history_file = "History.md"
|
17
17
|
self.readme_file = "README.rdoc"
|
18
18
|
|
19
|
-
require_ruby_version ">= 1
|
19
|
+
require_ruby_version ">= 3.1"
|
20
20
|
|
21
21
|
self.licenses = ["Ruby", "BSD-2-Clause"]
|
22
22
|
|
23
23
|
spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }
|
24
24
|
|
25
|
-
extra_deps << ["minitar", "~> 0.
|
25
|
+
extra_deps << ["minitar", "~> 1.0.0"]
|
26
26
|
extra_deps << ["powerbar", "~> 1.0"]
|
27
27
|
|
28
28
|
extra_dev_deps << ["hoe", "~> 4.0"]
|
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
|
@@ -5,14 +5,14 @@
|
|
5
5
|
# support have been dropped.
|
6
6
|
class Minitar::CLI::Command::List < Minitar::CLI::Command
|
7
7
|
def name
|
8
|
-
|
8
|
+
"list"
|
9
9
|
end
|
10
10
|
|
11
11
|
def altname
|
12
|
-
|
12
|
+
"ls"
|
13
13
|
end
|
14
14
|
|
15
|
-
HELP = <<-EOH
|
15
|
+
HELP = <<-EOH
|
16
16
|
minitar list [OPTIONS] <tarfile|-> [<file>+]
|
17
17
|
|
18
18
|
Lists files in an existing tarfile. If the tarfile is named .tar.gz or
|
@@ -36,32 +36,32 @@ Sort Fields:
|
|
36
36
|
EOH
|
37
37
|
|
38
38
|
def modestr(mode)
|
39
|
-
s = String.new(
|
40
|
-
s[0] =
|
41
|
-
s[1] =
|
42
|
-
s[2] =
|
39
|
+
s = String.new("---")
|
40
|
+
s[0] = "r" if (mode & 4) == 4
|
41
|
+
s[1] = "w" if (mode & 2) == 2
|
42
|
+
s[2] = "x" if (mode & 1) == 1
|
43
43
|
s
|
44
44
|
end
|
45
45
|
|
46
46
|
include CatchMinitarErrors
|
47
47
|
|
48
48
|
def run(args, opts = {})
|
49
|
-
argv
|
50
|
-
output
|
51
|
-
files
|
52
|
-
opts[:field] =
|
49
|
+
argv = []
|
50
|
+
output = nil
|
51
|
+
files = []
|
52
|
+
opts[:field] = "name"
|
53
53
|
|
54
54
|
while (arg = args.shift)
|
55
55
|
case arg
|
56
|
-
when
|
57
|
-
opts[:sort]
|
58
|
-
opts[:field]
|
59
|
-
when
|
56
|
+
when "--sort", "-S"
|
57
|
+
opts[:sort] = true
|
58
|
+
opts[:field] = args.shift
|
59
|
+
when "--reverse", "-R"
|
60
60
|
opts[:reverse] = true
|
61
|
-
opts[:sort]
|
62
|
-
when
|
61
|
+
opts[:sort] = true
|
62
|
+
when "--uncompress", "-z"
|
63
63
|
opts[:uncompress] = true
|
64
|
-
when
|
64
|
+
when "-l"
|
65
65
|
opts[:verbose] = true
|
66
66
|
else
|
67
67
|
argv << arg
|
@@ -70,35 +70,35 @@ Sort Fields:
|
|
70
70
|
|
71
71
|
if argv.empty?
|
72
72
|
ioe[:output] << "Not enough arguments.\n\n"
|
73
|
-
commander.command(
|
73
|
+
commander.command("help").call(%w(list))
|
74
74
|
return 255
|
75
75
|
end
|
76
76
|
|
77
77
|
input = argv.shift
|
78
|
-
if
|
79
|
-
opts[:name] =
|
78
|
+
if input == "-"
|
79
|
+
opts[:name] = "STDIN"
|
80
80
|
input = ioe[:input]
|
81
81
|
else
|
82
82
|
opts[:name] = input
|
83
|
-
input = File.open(input,
|
83
|
+
input = File.open(input, "rb")
|
84
84
|
end
|
85
85
|
|
86
|
-
if
|
87
|
-
require
|
86
|
+
if /\.tar\.gz$|\.tgz$/ =~ opts[:name] || opts[:uncompress]
|
87
|
+
require "zlib"
|
88
88
|
input = Zlib::GzipReader.new(input)
|
89
89
|
end
|
90
90
|
|
91
91
|
files << argv.to_a
|
92
92
|
files.flatten!
|
93
93
|
|
94
|
-
if opts[:verbose]
|
95
|
-
format
|
96
|
-
datefmt =
|
97
|
-
timefmt =
|
98
|
-
fields
|
94
|
+
if opts[:verbose] || opts[:progress]
|
95
|
+
format = "%10s %4d %8s %8s %8d %12s %s"
|
96
|
+
datefmt = "%b %d %Y"
|
97
|
+
timefmt = "%b %d %H:%M"
|
98
|
+
fields = %w(permissions inodes user group size date fullname)
|
99
99
|
else
|
100
|
-
format
|
101
|
-
fields
|
100
|
+
format = "%s"
|
101
|
+
fields = %w(fullname)
|
102
102
|
end
|
103
103
|
|
104
104
|
opts[:field] = opts[:field].to_sym
|
@@ -109,44 +109,44 @@ Sort Fields:
|
|
109
109
|
today = Time.now
|
110
110
|
oneyear = Time.mktime(today.year - 1, today.month, today.day)
|
111
111
|
|
112
|
-
|
112
|
+
Minitar::Input.each_entry(input) do |entry|
|
113
113
|
next unless files.empty? || files.include?(entry.full_name)
|
114
114
|
|
115
115
|
value = format % fields.map { |ff|
|
116
116
|
case ff
|
117
|
-
when
|
118
|
-
s = String.new(entry.directory? ?
|
117
|
+
when "permissions"
|
118
|
+
s = String.new(entry.directory? ? "d" : "-")
|
119
119
|
s << modestr(entry.mode / 0o100)
|
120
120
|
s << modestr(entry.mode / 0o010)
|
121
121
|
s << modestr(entry.mode)
|
122
|
-
when
|
122
|
+
when "inodes"
|
123
123
|
entry.size / 512
|
124
|
-
when
|
124
|
+
when "user"
|
125
125
|
entry.uname || entry.uid || 0
|
126
|
-
when
|
126
|
+
when "group"
|
127
127
|
entry.gname || entry.gid || 0
|
128
|
-
when
|
128
|
+
when "size"
|
129
129
|
entry.size
|
130
|
-
when
|
130
|
+
when "date"
|
131
131
|
if Time.at(entry.mtime) > oneyear
|
132
132
|
Time.at(entry.mtime).strftime(timefmt)
|
133
133
|
else
|
134
134
|
Time.at(entry.mtime).strftime(datefmt)
|
135
135
|
end
|
136
|
-
when
|
136
|
+
when "fullname"
|
137
137
|
entry.full_name
|
138
138
|
end
|
139
139
|
}
|
140
140
|
|
141
141
|
if opts[:sort]
|
142
|
-
output << [
|
142
|
+
output << [entry.send(opts[:field]), value]
|
143
143
|
else
|
144
144
|
ioe[:output] << value << "\n"
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
148
|
if opts[:sort]
|
149
|
-
output = output.
|
149
|
+
output = output.sort_by { |a| a[0] }
|
150
150
|
if opts[:reverse]
|
151
151
|
output.reverse_each { |oo| ioe[:output] << oo[1] << "\n" }
|
152
152
|
else
|
data/lib/minitar/cli/command.rb
CHANGED
@@ -20,7 +20,7 @@ class Minitar::CLI::Command
|
|
20
20
|
module CatchMinitarErrors # :nodoc:
|
21
21
|
def call(args, opts)
|
22
22
|
run(args, opts)
|
23
|
-
rescue
|
23
|
+
rescue Minitar::Error => error
|
24
24
|
ioe[:error] << "#{error}\n"
|
25
25
|
5
|
26
26
|
end
|
@@ -38,7 +38,7 @@ class Minitar::CLI::Command
|
|
38
38
|
def call(_args, _opts = {})
|
39
39
|
raise Minitar::CLI::AbstractCommandError
|
40
40
|
end
|
41
|
-
|
41
|
+
alias_method :[], :call
|
42
42
|
|
43
43
|
def help
|
44
44
|
raise Minitar::CLI::AbstractCommandError
|
@@ -15,7 +15,7 @@ class Minitar::CLI::Commander
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def register(command)
|
18
|
-
command = command.new(self) if command.
|
18
|
+
command = command.new(self) if command.is_a?(Class)
|
19
19
|
raise CommandAlreadyExists if command.commander != self
|
20
20
|
raise CommandAlreadyExists if command?(command.name)
|
21
21
|
|
@@ -29,10 +29,10 @@ class Minitar::CLI::Commander
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def default_command=(command)
|
32
|
-
command = command.new if command.
|
32
|
+
command = command.new if command.is_a?(Class)
|
33
33
|
|
34
34
|
@default_command =
|
35
|
-
if command.
|
35
|
+
if command.is_a?(Minitar::CLI::Command)
|
36
36
|
register(command) unless command?(command.name)
|
37
37
|
command
|
38
38
|
elsif command?(command)
|
@@ -53,12 +53,12 @@ class Minitar::CLI::Commander
|
|
53
53
|
default_command
|
54
54
|
end
|
55
55
|
end
|
56
|
-
|
56
|
+
alias_method :[], :command
|
57
57
|
|
58
58
|
def default_ioe(ioe = {})
|
59
|
-
ioe[:input]
|
60
|
-
ioe[:output]
|
61
|
-
ioe[:error]
|
59
|
+
ioe[:input] ||= $stdin
|
60
|
+
ioe[:output] ||= $stdout
|
61
|
+
ioe[:error] ||= $stderr
|
62
62
|
ioe
|
63
63
|
end
|
64
64
|
end
|
data/lib/minitar/cli.rb
CHANGED
@@ -4,7 +4,7 @@ require "minitar"
|
|
4
4
|
|
5
5
|
# The Minitar command-line application.
|
6
6
|
class Minitar::CLI
|
7
|
-
VERSION = "0.
|
7
|
+
VERSION = "1.0.0" # :nodoc:
|
8
8
|
|
9
9
|
# rubocop:disable Lint/InheritException
|
10
10
|
class AbstractCommandError < Exception; end
|
@@ -23,9 +23,9 @@ class Minitar::CLI
|
|
23
23
|
|
24
24
|
def initialize(input = $stdin, output = $stdout, error = $stderr)
|
25
25
|
@ioe = {
|
26
|
-
input
|
27
|
-
output
|
28
|
-
error
|
26
|
+
:input => input,
|
27
|
+
:output => output,
|
28
|
+
:error => error
|
29
29
|
}
|
30
30
|
@commander = Minitar::CLI::Commander.new(ioe)
|
31
31
|
Minitar::CLI::Command.children.each do |command|
|
@@ -39,13 +39,13 @@ class Minitar::CLI
|
|
39
39
|
|
40
40
|
output << "minitar #{VERSION}\n" if argv.include?("--version")
|
41
41
|
|
42
|
-
if argv.include?("--verbose")
|
42
|
+
if argv.include?("--verbose") || argv.include?("-V")
|
43
43
|
opts[:verbose] = true
|
44
44
|
argv.delete("--verbose")
|
45
45
|
argv.delete("-V")
|
46
46
|
end
|
47
47
|
|
48
|
-
if argv.include?("--progress")
|
48
|
+
if argv.include?("--progress") || argv.include?("-P")
|
49
49
|
opts[:progress] = true
|
50
50
|
opts[:verbose] = false
|
51
51
|
argv.delete("--progress")
|
data/test/fixtures/spaces.tar.gz
CHANGED
Binary file
|
data/test/minitest_helper.rb
CHANGED
@@ -11,15 +11,10 @@ module MinitarCLITestHelper
|
|
11
11
|
Regexp.union(*r)
|
12
12
|
end
|
13
13
|
|
14
|
-
def assert_cli_output(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
assert_match pattern, out
|
19
|
-
end
|
20
|
-
else
|
21
|
-
assert_output(patterns, &)
|
22
|
-
end
|
14
|
+
def assert_cli_output(first, last, &block)
|
15
|
+
out, _err = capture_io(&block)
|
16
|
+
assert_match first, out, "first line of output"
|
17
|
+
assert_match last, out, "last line of output"
|
23
18
|
end
|
24
19
|
|
25
20
|
Minitest::Test.send(:include, self)
|
data/test/test_cli_help.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require "minitest_helper"
|
4
4
|
|
5
5
|
class TestCLIHelp < Minitest::Test
|
6
6
|
def test_help_output_with_no_args
|
@@ -11,61 +11,61 @@ class TestCLIHelp < Minitest::Test
|
|
11
11
|
|
12
12
|
def test_help_output_with_help
|
13
13
|
assert_output Minitar::CLI::Command::Help::BASIC do
|
14
|
-
assert_equal 0, cli(
|
14
|
+
assert_equal 0, cli("help")
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
def test_help_output_with_bad_command
|
19
19
|
assert_output Minitar::CLI::Command::Help::BASIC do
|
20
|
-
assert_equal 0, cli(
|
20
|
+
assert_equal 0, cli("foo")
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_help_output_with_help_bad_command
|
25
25
|
assert_output "Unknown command: foo\n#{Minitar::CLI::Command::Help::BASIC}" do
|
26
|
-
assert_equal 0, cli(
|
26
|
+
assert_equal 0, cli("help", "foo")
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_help_output_commands
|
31
31
|
assert_output Minitar::CLI::Command::Help::COMMANDS do
|
32
|
-
assert_equal 0, cli(
|
32
|
+
assert_equal 0, cli("help", "commands")
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_help_output_create
|
37
37
|
assert_output Minitar::CLI::Command::Create::HELP do
|
38
|
-
assert_equal 0, cli(
|
38
|
+
assert_equal 0, cli("help", "create")
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_help_output_create_minargs
|
43
43
|
assert_output "Not enough arguments.\n\n#{Minitar::CLI::Command::Create::HELP}" do
|
44
|
-
assert_equal 255, cli(
|
44
|
+
assert_equal 255, cli("create")
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_help_output_list
|
49
49
|
assert_output Minitar::CLI::Command::List::HELP do
|
50
|
-
assert_equal 0, cli(
|
50
|
+
assert_equal 0, cli("help", "list")
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def test_help_output_list_minargs
|
55
55
|
assert_output "Not enough arguments.\n\n#{Minitar::CLI::Command::List::HELP}" do
|
56
|
-
assert_equal 255, cli(
|
56
|
+
assert_equal 255, cli("list")
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_help_output_extract
|
61
61
|
assert_output Minitar::CLI::Command::Extract::HELP do
|
62
|
-
assert_equal 0, cli(
|
62
|
+
assert_equal 0, cli("help", "extract")
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
def test_help_output_extract_minargs
|
67
67
|
assert_output "Not enough arguments.\n\n#{Minitar::CLI::Command::Extract::HELP}" do
|
68
|
-
assert_equal 255, cli(
|
68
|
+
assert_equal 255, cli("extract")
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
data/test/test_cli_list.rb
CHANGED
@@ -17,92 +17,76 @@ class TestCLIList < Minitest::Test
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def test_list_output_bad_dir_fixture
|
20
|
-
|
20
|
+
assert_output "../qwerty\n" do
|
21
21
|
assert_equal 0, list_bad_dir
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_list_output_spaces
|
26
|
-
assert_cli_output
|
26
|
+
assert_cli_output %r{\Afirst-added$}, %r{^last-added\n\z} do
|
27
27
|
assert_equal 0, list_spaces
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_list_output_spaces_verbose
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
]
|
36
|
-
assert_cli_output patterns do
|
32
|
+
first = %r{\A-rw-r--r--\s+0\s+austin\s+staff\s+2\s+Feb\s+15\s+2007\s+first-added$}
|
33
|
+
last = %r{^-rw-r--r--\s+0\s+austin\s+staff\s+3\s+Feb\s+15\s+2008\s+last-added\n\z}
|
34
|
+
assert_cli_output first, last do
|
37
35
|
assert_equal 0, list_spaces("--verbose")
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
41
39
|
def test_list_output_spaces_verbose_sort_size
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
assert_cli_output patterns do
|
40
|
+
first = %r{\A-rw-r--r--\s+0\s+austin\s+staff\s+0\s+Feb\s+15\s+2005\s+000-bytes$}
|
41
|
+
last = %r{^-rw-r--r--\s+0\s+austin\s+staff\s+16\s+Feb\s+15\s+2006\s+largest\n\z}
|
42
|
+
|
43
|
+
assert_cli_output first, last do
|
47
44
|
assert_equal 0, list_spaces(%w[--verbose --sort size])
|
48
45
|
end
|
49
46
|
end
|
50
47
|
|
51
48
|
def test_list_output_spaces_verbose_sort_size_reverse
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
]
|
56
|
-
|
57
|
-
assert_cli_output patterns do
|
49
|
+
first = %r{\A-rw-r--r--\s+0\s+austin\s+staff\s+16\s+Feb\s+15\s+2006\s+largest$}
|
50
|
+
last = %r{^-rw-r--r--\s+0\s+austin\s+staff\s+0\s+Feb\s+15\s+2005\s+000-bytes\n\z}
|
51
|
+
assert_cli_output first, last do
|
58
52
|
assert_equal 0, list_spaces(%w[--verbose --sort size --reverse])
|
59
53
|
end
|
60
54
|
end
|
61
55
|
|
62
56
|
def test_list_output_spaces_verbose_sort_name
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
]
|
67
|
-
assert_cli_output patterns do
|
57
|
+
first = %r{\A-rw-r--r--\s+0\s+austin\s+staff\s+4\s+Feb\s+15\s+2009\s+00-name$}
|
58
|
+
last = %r{^-rw-r--r--\s+0\s+austin\s+staff\s+5\s+Feb\s+15\s+2010\s+zz-name\n\z}
|
59
|
+
assert_cli_output first, last do
|
68
60
|
assert_equal 0, list_spaces(%w[--verbose --sort name])
|
69
61
|
end
|
70
62
|
end
|
71
63
|
|
72
64
|
def test_list_output_spaces_verbose_sort_name_reverse
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
]
|
77
|
-
|
78
|
-
assert_cli_output patterns do
|
65
|
+
first = %r{\A-rw-r--r--\s+0\s+austin\s+staff\s+5\s+Feb\s+15\s+2010\s+zz-name$}
|
66
|
+
last = %r{^-rw-r--r--\s+0\s+austin\s+staff\s+4\s+Feb\s+15\s+2009\s+00-name\n\z}
|
67
|
+
assert_cli_output first, last do
|
79
68
|
assert_equal 0, list_spaces(%w[--verbose --sort name --reverse])
|
80
69
|
end
|
81
70
|
end
|
82
71
|
|
83
72
|
def test_list_output_spaces_verbose_sort_mtime
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
]
|
88
|
-
assert_cli_output patterns do
|
73
|
+
first = %r{\A-rw-r--r--\s+0\s+austin\s+staff\s+6\s+Feb\s+15\s+2004\s+earliest$}
|
74
|
+
last = %r{^-rw-r--r--\s+0\s+austin\s+staff\s+7\s+Feb\s+15\s+2014\s+latest\n\z}
|
75
|
+
assert_cli_output first, last do
|
89
76
|
assert_equal 0, list_spaces(%w[--verbose --sort mtime])
|
90
77
|
end
|
91
78
|
end
|
92
79
|
|
93
80
|
def test_list_output_spaces_verbose_sort_mtime_reverse
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
]
|
98
|
-
|
99
|
-
assert_cli_output patterns do
|
81
|
+
first = %r{\A-rw-r--r--\s+0\s+austin\s+staff\s+7\s+Feb\s+15\s+2014\s+latest$}
|
82
|
+
last = %r{^-rw-r--r--\s+0\s+austin\s+staff\s+6\s+Feb\s+15\s+2004\s+earliest\n\z}
|
83
|
+
assert_cli_output first, last do
|
100
84
|
assert_equal 0, list_spaces(%w[--verbose --sort mtime --reverse])
|
101
85
|
end
|
102
86
|
end
|
103
87
|
|
104
88
|
def test_list_stdin
|
105
|
-
|
89
|
+
assert_output "../qwerty\n" do
|
106
90
|
File.open("test/fixtures/bad-dir.tar.gz") do |f|
|
107
91
|
assert_equal 0, Minitar::CLI.run(%w[list - --uncompress], f)
|
108
92
|
end
|
@@ -110,16 +94,15 @@ class TestCLIList < Minitest::Test
|
|
110
94
|
end
|
111
95
|
|
112
96
|
def test_list_output_spaces_filtered
|
113
|
-
|
114
|
-
assert_equal 0, list_spaces("
|
97
|
+
assert_output "zz-name\n" do
|
98
|
+
assert_equal 0, list_spaces("zz-name")
|
115
99
|
end
|
116
100
|
end
|
117
101
|
|
118
102
|
def test_list_output_spaces_filtered_verbose
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
assert_equal 0, list_spaces(["./bin/minitar", "--verbose"])
|
103
|
+
pattern = %r{\A-rw-r--r--\s+0\s+austin\s+staff\s+5\s+Feb\s+15\s+2010\s+zz-name\n\z}
|
104
|
+
assert_output pattern do
|
105
|
+
assert_equal 0, list_spaces(["zz-name", "--verbose"])
|
123
106
|
end
|
124
107
|
end
|
125
108
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitar-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitar
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 1.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: powerbar
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,15 +208,13 @@ description: |-
|
|
208
208
|
<tt>minitar-cli</tt> is a pure-Ruby command-line tool that uses
|
209
209
|
{minitar}[https://github.com/halostatue/minitar] to provide a command-line
|
210
210
|
tool, +minitar+, for working with POSIX tar(1) archive files.
|
211
|
-
|
212
|
-
This is release 0.7, extracted from {minitar}[https://halostatue.ca/minitar],
|
213
|
-
with modernizations.
|
214
211
|
email:
|
215
212
|
- halostatue@gmail.com
|
216
213
|
executables:
|
217
214
|
- minitar
|
218
215
|
extensions: []
|
219
216
|
extra_rdoc_files:
|
217
|
+
- Code-of-Conduct.md
|
220
218
|
- Contributing.md
|
221
219
|
- History.md
|
222
220
|
- Licence.md
|
@@ -225,6 +223,7 @@ extra_rdoc_files:
|
|
225
223
|
- docs/bsdl.txt
|
226
224
|
- docs/ruby.txt
|
227
225
|
files:
|
226
|
+
- Code-of-Conduct.md
|
228
227
|
- Contributing.md
|
229
228
|
- History.md
|
230
229
|
- Licence.md
|
@@ -266,17 +265,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
266
265
|
requirements:
|
267
266
|
- - ">="
|
268
267
|
- !ruby/object:Gem::Version
|
269
|
-
version: '1
|
268
|
+
version: '3.1'
|
270
269
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
270
|
requirements:
|
272
271
|
- - ">="
|
273
272
|
- !ruby/object:Gem::Version
|
274
273
|
version: '0'
|
275
274
|
requirements: []
|
276
|
-
rubygems_version: 3.
|
275
|
+
rubygems_version: 3.4.19
|
277
276
|
signing_key:
|
278
277
|
specification_version: 4
|
279
278
|
summary: "<tt>minitar-cli</tt> is a pure-Ruby command-line tool that uses {minitar}[https://github.com/halostatue/minitar]
|
280
279
|
to provide a command-line tool, +minitar+, for working with POSIX tar(1) archive
|
281
|
-
files"
|
280
|
+
files."
|
282
281
|
test_files: []
|