http://www.allruby.com/rpkg/archive-0.1.tar.gz
http://www.allruby.com/rpkg/version.rb
Both modules are also included in the (to be released) development
version of rpkg.
···
version.rb
Parses and compares version strings like '0.1.0-20021010',
'0.0.3-unstable'...
Examples from the tests:
v = Version['0.1.0']
assert [0, 1, 0], v.to_a
assert_equal 0, v[0]
assert_equal 1, v[1]
assert_equal 0, v[2]
v = Version['0.1.0-20021099']
assert_equal 20021099, v[3]
v = Version['0.1.4-unstable']
assert_equal 'unstable', v[3]
v1 = Version['0.1.0']
v2 = Version['0.1.0.2']
assert v2 > v1
v1 = Version['0.1.0']
v2 = Version['0.1.0-20021010']
assert v2 > v1
v1 = Version['0.1.0']
v2 = Version['0.1.0-unstable']
assert v2 > v1
archive-0.1.tar.gz (from the notes):
= What is it
A framework for reading, modifying and writing archive and
archive-like files through a uniform interface.
= How it works
The following gets a reader for an archive file of type ArcType
(e.g. Mbox, Tar, Ar…)
io = File.open(‘archive’)
reader = Archive::Reader::ArcType.new(io)
The following iterates over the archive, returning each entry as it
is found.
reader.scan do |entry|
…
end
The following scans the archive and returns a modifiable
representation of it.
entries = reader.scan
The following iterates over the archive and builds no representation
of it (i.e. sequential access only).
reader.scan(false) do |entry|
…
end
The following writes the (possibly modified) representation to disk.
io = File.open(‘target’)
writer = Archive::Writer::ArcType.new(io)
entries.each do |entry|
writer.add(entry)
end
The following is a shortcut for the previous.
io = File.open(‘target’)
Archive::Writer::ArcType.write(io, entries)
Currently supported archive types are ar, mbox, and rpkg (or Debian)
archive format.
Massimiliano
</details>