Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,685 additions
and
1,109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
service_name: travis-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
*.md | ||
*.swp | ||
*~ | ||
.rake_tasks~ | ||
.source_index | ||
.vagrant | ||
Gemfile.lock | ||
Vagrantfile | ||
coverage | ||
doc | ||
html | ||
pkg | ||
publish | ||
test/cache.tst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
110 changes: 110 additions & 0 deletions
110
0001-Fix-minitar-when-working-with-non-seekable-streams.patch.for-tracker.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
From a02b9155192e6812042c016d8498c1c4730b81f7 Mon Sep 17 00:00:00 2001 | ||
Date: Sun, 13 Apr 2008 19:23:28 +0200 | ||
Subject: [PATCH] Fix minitar when working with non-seekable streams. | ||
|
||
The use of duck typing was not sufficient for pipes and files created by | ||
popen, because the relevant methods exist but throw errors. | ||
Explicitly check for a regular file before calling seek-related methods. | ||
|
||
We still support duck typing for streams that don't descend from ruby's IO, | ||
but I haven't been able to find a use or a test for that. | ||
--- | ||
|
||
Hello, here is a small bug fix for minitar. | ||
Thanks for this useful library! | ||
|
||
minitar.rb | 30 +++++++++++++++++++++++------- | ||
1 files changed, 23 insertions(+), 7 deletions(-) | ||
|
||
diff --git a/minitar.rb b/minitar.rb | ||
index 29336e0..2f14027 100644 | ||
--- a/minitar.rb | ||
+++ b/minitar.rb | ||
@@ -366,7 +366,7 @@ module Archive::Tar::Minitar | ||
def add_file(name, opts = {}) # :yields RestrictedStream, +opts+: | ||
raise Archive::Tar::Minitar::BlockRequired unless block_given? | ||
raise Archive::Tar::Minitar::ClosedStream if @closed | ||
- raise Archive::Tar::Minitar::NonSeekableStream unless @io.respond_to?(:pos=) | ||
+ raise Archive::Tar::Minitar::NonSeekableStream unless Archive::Tar::Minitar::can_seek(@io) | ||
|
||
name, prefix = split_name(name) | ||
init_pos = @io.pos | ||
@@ -480,7 +480,7 @@ module Archive::Tar::Minitar | ||
@devminor = header.devminor | ||
@prefix = header.prefix | ||
@read = 0 | ||
- @orig_pos = @io.pos | ||
+ @orig_pos = @io.pos if Archive::Tar::Minitar::can_seek(@io) | ||
end | ||
|
||
# Reads +len+ bytes (or all remaining data) from the entry. Returns | ||
@@ -528,7 +528,7 @@ module Archive::Tar::Minitar | ||
|
||
# Sets the current read pointer to the beginning of the EntryStream. | ||
def rewind | ||
- raise NonSeekableStream unless @io.respond_to?(:pos=) | ||
+ raise NonSeekableStream unless Archive::Tar::Minitar::can_seek(@io) | ||
@io.pos = @orig_pos | ||
@read = 0 | ||
end | ||
@@ -579,7 +579,7 @@ module Archive::Tar::Minitar | ||
# Creates and returns a new Reader object. | ||
def initialize(anIO) | ||
@io = anIO | ||
- @init_pos = anIO.pos | ||
+ @init_pos = anIO.pos if Archive::Tar::Minitar::can_seek(anIO) | ||
end | ||
|
||
# Iterates through each entry in the data stream. | ||
@@ -592,10 +592,10 @@ module Archive::Tar::Minitar | ||
# random access data streams that respond to #rewind and #pos. | ||
def rewind | ||
if @init_pos == 0 | ||
- raise NonSeekableStream unless @io.respond_to?(:rewind) | ||
+ raise NonSeekableStream unless Archive::Tar::Minitar::can_seek(@io) | ||
@io.rewind | ||
else | ||
- raise NonSeekableStream unless @io.respond_to?(:pos=) | ||
+ raise NonSeekableStream unless Archive::Tar::Minitar::can_seek(@io) | ||
@io.pos = @init_pos | ||
end | ||
end | ||
@@ -615,7 +615,7 @@ module Archive::Tar::Minitar | ||
|
||
skip = (512 - (size % 512)) % 512 | ||
|
||
- if @io.respond_to?(:seek) | ||
+ if Archive::Tar::Minitar::can_seek(@io) | ||
# avoid reading... | ||
@io.seek(size - entry.bytes_read, IO::SEEK_CUR) | ||
else | ||
@@ -827,6 +827,19 @@ module Archive::Tar::Minitar | ||
end | ||
|
||
class << self | ||
+ # Check whether +io+ will be able to seek without errors | ||
+ def can_seek(io) | ||
+ # The IO class will throw at runtime if we call | ||
+ # seek/rewind/pos/pos= | ||
+ # on a non-regular file. | ||
+ if io.respond_to?(:stat) then | ||
+ return io.stat.file? | ||
+ end | ||
+ | ||
+ # Support duck typing - don't know any users though | ||
+ return [:pos, :pos=, :seek, :rewind ] .all? { |m| io.respond_to?(m) } | ||
+ end | ||
+ | ||
# Tests if +path+ refers to a directory. Fixes an apparently | ||
# corrupted <tt>stat()</tt> call on Windows. | ||
def dir?(path) | ||
@@ -977,3 +990,6 @@ module Archive::Tar::Minitar | ||
end | ||
end | ||
end | ||
+ | ||
+ | ||
+ | ||
-- | ||
Gabriel | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# -*- ruby -*- | ||
|
||
# NOTE: This file is present to keep Travis CI happy. Edits to it will not | ||
# be accepted. | ||
|
||
source "https://rubygems.org/" | ||
gemspec | ||
|
||
group :development do | ||
gem 'debugger' | ||
end | ||
|
||
# vim: syntax=ruby |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
== 0.6 / YYYY-MM-DD | ||
|
||
* Bugs: | ||
|
||
* Development: | ||
* Modernized minitar tooling around Hoe. | ||
|
||
== 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. |
Oops, something went wrong.