Skip to content

Commit

Permalink
Modernize the minitar codebase.
Browse files Browse the repository at this point in the history
-   Convert the project to Hoe.
-   Convert tests from test/unit to minitest.
    -   Enable travis-ci tests.
    -   Enable test coverage runs with coveralls.

-   Resolve #3 by using UTC time for a test and test data.
-   Resolve #2 by detecting seekable streams.

-   Deprecate `include Archive::Tar` with a warning.
-   Deprecate `include Archive::Tar::Minitar` with a warning.
-   Add an optional alias `::Minitar` for `Archive::Tar::Minitar`. A
    warning will be printed if `::Minitar` already exists.
-   Moved Archive::Tar::PosixHeader temporarily to
    Archive::Tar::Minitar::PosixHeader. A future release will make it
    ::Minitar::PosixHeader.
-   PosixHeader can now handle Time objects for `mtime` and does not
    require the integer version be provided.
-   Restructured Minitar::Writer.
-   Modified both `Writer#add_file_simple` and `Writer#add_file` to accept a
    `:data` field so that a block does not need to be provided.
  • Loading branch information
halostatue committed Dec 21, 2014
1 parent c1f79f5 commit db2e5a1
Show file tree
Hide file tree
Showing 37 changed files with 3,280 additions and 2,663 deletions.
35 changes: 35 additions & 0 deletions .autotest
@@ -0,0 +1,35 @@
# -*- ruby -*-

require 'autotest/bundler'
require 'autotest/restart'
require 'autotest/timestamp'

def require_plugin(resource)
require resource
rescue LoadError
false
end

require_plugin 'autotest/clear'

Autotest.add_hook :initialize do |at|
# at.testlib = "minitest/unit"
#
# at.extra_files << "../some/external/dependency.rb"
#
# at.libs << ":../some/external"
#
# at.add_exception "vendor"
#
# at.add_mapping(/dependency.rb/) do |f, _|
# at.files_matching(/test_.*rb$/)
# end
#
# %w(TestA TestB).each do |klass|
# at.extra_class_map[klass] = "test/test_misc.rb"
# end
end

# Autotest.add_hook :run_command do |at|
# system "rake build"
# end
2 changes: 2 additions & 0 deletions .coveralls.yml
@@ -0,0 +1,2 @@
---
service_name: travis-ci
Empty file added .gemtest
Empty file.
14 changes: 14 additions & 0 deletions .gitignore
@@ -0,0 +1,14 @@
*.md
*.swp
*~
.rake_tasks~
.source_index
.vagrant
Gemfile.lock
Vagrantfile
coverage
doc
html
pkg
publish
test/cache.tst
20 changes: 20 additions & 0 deletions .hoerc
@@ -0,0 +1,20 @@
---
exclude: !ruby/regexp '/
\.(tmp|swp)$
|
CVS/
|
(?i:TAGS)
|
\.(svn|git|hg|DS_Store|idea|vagrant)\/
|
Gemfile(?:\.lock)?
|
type-lists\/
|
\.(coveralls|pullreview|travis).yml$
|
\.gemspec
|
Vagrantfile
/x'
48 changes: 48 additions & 0 deletions .pullreview.yml
@@ -0,0 +1,48 @@
---
languages:
- ruby
excludes:
- data
- docs
- type-lists
- .minitest.rb
- lib/mime-types.rb
rules:
documentation:
except:
- test/**
- support/**
style:
except:
- db/**
duplication:
except:
- test/**
complexity:
except:
- test/**
ignore:
- space_inside_square_brackets_detected
# - add_underscores_to_large_numeric
# - avoid_using_curly_braces_for_multi-line_blocks
# - don_t_use_parentheses_around_the_condition
# - extra_blank_line_detected
# - extra_blank_line_detected_at_body_end
# - extra_blank_line_detected_at_body_beginning
# - indent_when_as_deep_as_case
# - missing_class_documentation
# - missing_method_documentation
# - prefer_map_over_collect
# - prefer_reduce_over_inject
# - prefer_ruby_19_new_hash_syntax
# - prefer_ruby_19_new_lambda_syntax
# - prefer_single_quoted_strings
# - space_between_curly_brace_and_pipe_missing
# - space_inside_parentheses_detected
# - space_inside_opening_curly_brace_missing
# - space_inside_closing_curly_brace_missing
# - space_missing_inside_opening_curly_brace
# - space_missing_inside_closing_curly_brace
# - space_missing_after_hash_sign
# - surrounding_space_missing_for_opening_curly_brace
# - use_def_with_parentheses_when_there_are_arguments
39 changes: 39 additions & 0 deletions .travis.yml
@@ -0,0 +1,39 @@
---
language: ruby
rvm:
- 2.1.0
- 2.0.0
- 1.9.3
- 1.8.7
- ree
- ruby-head
- jruby-19mode
- jruby-head
- rbx-2
matrix:
allow_failures:
- rvm: rbx-2
- rvm: jruby-head
- rvm: ruby-head
- rvm: 1.8.7
- rvm: ree
gemfile:
- Gemfile
before_script:
- |
case "${TRAVIS_RUBY_VERSION}" in
rbx*)
gem install psych
;;
esac
- rake travis:before -t
script: rake travis
after_script:
- rake travis:after -t
notifications:
email:
recipients:
- austin@rubyforge.org
on_success: change
on_failure: always
sudo: false
14 changes: 0 additions & 14 deletions ChangeLog

This file was deleted.

65 changes: 65 additions & 0 deletions Contributing.rdoc
@@ -0,0 +1,65 @@
== Contributing

I value any contribution to minitar you can provide: a bug report, a feature
request, or code contributions.

As minitar is a mature codebase, there are a few guidelines:

* Code changes *will* *not* be accepted without tests. The test suite is
written with {Minitest}[https://github.com/seattlerb/minitest].
* Match my coding style.
* Use a thoughtfully-named topic branch that contains your change. Rebase your
commits into logical chunks as necessary.
* Use {quality commit messages}[http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html].
* Do not change the version number; when your patch is accepted and a release
is made, the version will be updated at that point.
* Submit a GitHub pull request with your changes.
* New or changed behaviours require new or updated documentation.

=== Test Dependencies

minitar uses Ryan Davis’s {Hoe}[https://github.com/seattlerb/hoe] to manage
the release process, and it adds a number of rake tasks. You will mostly be
interested in:

$ rake

which runs the tests the same way that:

$ rake test
$ rake travis

will do.

To assist with the installation of the development dependencies for minitar, I
have provided the simplest possible Gemfile pointing to the (generated)
+archive-tar-minitar.gemspec+ file. This will permit you to do:

$ bundle install

to get the development dependencies. If you aleady have +hoe+ installed, you
can accomplish the same thing with:

$ rake newb

This task will install any missing dependencies, run the tests/specs, and
generate the RDoc.

=== Workflow

Here's the most direct way to get your work merged into the project:

* Fork the project.
* Clone down your fork (<tt>git clone git://github.com/<username>/minitar.git</tt>).
* Create a topic branch to contain your change (<tt>git checkout -b my\_awesome\_feature</tt>).
* Hack away, add tests. Not necessarily in that order.
* Make sure everything still passes by running +rake+.
* If necessary, rebase your commits into logical chunks, without errors.
* Push the branch up (<tt>git push origin my\_awesome\_feature</tt>).
* Create a pull request against halostatue/minitar and describe what your
change does and the why you think it should be merged.

=== Contributors

* Austin Ziegler created minitar, which is based on work originally performed
by Mauricio Fernández for rpa-base.
14 changes: 14 additions & 0 deletions Gemfile
@@ -0,0 +1,14 @@
# -*- ruby -*-

# NOTE: This file is present to keep Travis CI happy. Edits to it will not
# be accepted.

source "https://rubygems.org/"

if RUBY_VERSION < "1.9"
gem 'mime-types', '~> 1.25'
end

gemspec

# vim: syntax=ruby
54 changes: 54 additions & 0 deletions History.rdoc
@@ -0,0 +1,54 @@
== 0.6 / YYYY-MM-DD

* Enhancements:
* Printing a deprecation warning for including Archive::Tar to put Minitar in
the top-level namespace.
* Printing a deprecation warning for including Archive::Tar::Minitar into a
class (Minitar will be a class for version 1.0).
* Moved Archive::Tar::PosixHeader to Archive::Tar::Minitar::PosixHeader with
a deprecation warning. Do not depend on Archive::Tar::Minitar::PosixHeader,
as it will be moving to ::Minitar::PosixHeader in a near-future release.
* Added an alias, ::Minitar, for Archive::Tar::Minitar, opted in with
<tt>require 'minitar'</tt>. In future releases, this alias will be enabled
by default, and the Archive::Tar namespace will be removed entirely for
version 1.0.
* Modified the handling of +mtime+ in PosixHeader to do an integer conversion
(<tt>#to_i</tt>) so that a Time object can be used instead of the integer value of
the time object.
* Writer::RestrictedStream was renamed to Writer::WriteOnlyStream for
clarity. No alias or deprecation warning was provided for this as it is an
internal implementation detail.
* Writer::BoundedStream was renamed to Writer::BoundedWriteStream for
clarity. A deprecation warning is provided on first use because a
BoundedWriteStream may raise a BoundedWriteStream::FileOverflow exception.
* Modified <tt>Writer#add_file_simple</tt> to accept the data for a
file in <tt>opts[:data]</tt>. When <tt>opts[:data]</tt> is provided, a
stream block must not be provided. Improved the documentation for
this method.
* Modified <tt>Writer#add_file</tt> to accept <tt>opts[:data]</tt> and
transparently call <tt>Writer#add_file_simple </tt>in this case.

* Bugs:
* Fix {#2}[https://github.com/halostatue/minitar/issues/2] to handle IO
streams that are not seekable, such as pipes, STDIN, or STDOUT.
* Fix {#3}[https://github.com/halostatue/minitar/issues/3] to make the test
timezone resilient.

* Development:
* Modernized minitar tooling around Hoe.
* Added travis and coveralls.

== 0.5.2 / 2008-02-26

* Bugs:
* Fixed a Ruby 1.9 compatibility error.

== 0.5.1 / 2004-09-27

* Bugs:
* Fixed a variable name error.

== 0.5.0

* Initial release. Does files and directories. Command does create, extract,
and list.
15 changes: 15 additions & 0 deletions Licence.rdoc
@@ -0,0 +1,15 @@
== Licence

* Copyright 2004–2014 Austin Ziegler.
* Portions copyright 2004 Mauricio Julio Fernández Pradier.
* Portions copyright 2001–2004 Satoru Takabayashi.

This program is free software. It may be redistributed and/or modified under
the terms of the GNU GPL version 2 (or, at your option, a later version), or
Ruby’s licence.

=== GNU GPL version 2
See the file docs/COPYING.txt in the main distribution.

=== Ruby’s license
See the file docs/ruby.txt in the main distribution.
29 changes: 29 additions & 0 deletions Manifest.txt
@@ -0,0 +1,29 @@
.autotest
.gemtest
.gitignore
.hoerc
Contributing.rdoc
History.rdoc
Install
Licence.rdoc
Manifest.txt
README.rdoc
Rakefile
bin/minitar
docs/COPYING.txt
docs/ruby.txt
lib/archive-tar-minitar.rb
lib/archive/tar/minitar.rb
lib/archive/tar/minitar/command.rb
lib/archive/tar/minitar/input.rb
lib/archive/tar/minitar/output.rb
lib/archive/tar/minitar/posix_header.rb
lib/archive/tar/minitar/reader.rb
lib/archive/tar/minitar/writer.rb
lib/minitar.rb
test/minitest_helper.rb
test/test_tar_header.rb
test/test_tar_input.rb
test/test_tar_output.rb
test/test_tar_reader.rb
test/test_tar_writer.rb

0 comments on commit db2e5a1

Please sign in to comment.