Ruby_archive 0.1.0 released

After a summer of working on various ways to implement it, I’m happy to
announce that I’m putting the first release of my Ruby Summer of Code
project, ruby_archive 0.1.0, out into the wild.

It’s available on rubygems as well as at
http://github.com/byuni/ruby_archive

ruby_archive lets you use files within zip files much like normal files
on
your filesystem. This means you can package data files and Ruby
libraries
within convenient zip files and still use them easily from your program.
For open, load, require, and most File.*** and Dir.*** operations, you
can
access files within archives by targetting at a location like the
following:
‘(filename)!/(file_inside_archive)’

It also allows you to package your entire program in one file and run it
using the included ‘rba_launch’ program.

See the readme file at the github site or in the rdoc for full
instructions
and details.

It works on ruby-1.8.7, jruby, rubinius, and ruby-head, and probably
other
interpreters and versions. Let me know if and when you run into any
problems, I will be continuing work on this project beyond the Ruby
Summer
of Code deadline.

A goal of the project was to put this type of functionality up for
consideration to be included in the Ruby interpreter - feedback related
to
this is welcome as well.

-Jonathan N.

On Sep 3, 2010, at 5:07 PM, Jonathan N. wrote:

After a summer of working on various ways to implement it, I’m happy to
announce that I’m putting the first release of my Ruby Summer of Code
project, ruby_archive 0.1.0, out into the wild.

It’s available on rubygems as well as at
http://github.com/byuni/ruby_archive

ruby_archive lets you use files within zip files much like normal files on
your filesystem. This means you can package data files and Ruby libraries
within convenient zip files and still use them easily from your program.
For open, load, require, and most File.*** and Dir.*** operations, you can
access files within archives by targetting at a location like the following:
‘(filename)!/(file_inside_archive)’

Holy smoke. This is freaking awesome!

James Edward G. II

On Sat, Sep 4, 2010 at 6:07 AM, Jonathan N. [email protected]
wrote:

‘(filename)!/(file_inside_archive)’

how do you resolve pathnames w “!”

best regards -botp

On Sat, Sep 4, 2010 at 6:07 AM, Jonathan N. [email protected]
wrote:

It also allows you to package your entire program in one file and run it
using the included ‘rba_launch’ program.

even something like a,
require “programs.zip”

would be great.

On Sat, Sep 4, 2010 at 11:48 AM, botp [email protected] wrote:

how do you resolve pathnames w “!”

best regards -botp

That is a concern that needs further work in future versions, but for
now it
will always check if the file with ‘!’ exists on the filesystem before
it
trys to use the archive method.

-Jonathan N.

On Sun, Sep 5, 2010 at 1:58 AM, Jonathan N. [email protected]
wrote:

That is a concern that needs further work in future versions, but for now it
will always check if the file with ‘!’ exists on the filesystem before it
trys to use the archive method.

how about using constant flags as options, like eg,
File::FNM_ASZIP – basename/actual file is zip itself
File::FNM_INZIP – same as ! behaviour but no need of !, ie file
is contained in zip

thank you and best regards -botp

On Sep 3, 6:07 pm, Jonathan N. [email protected] wrote:

After a summer of working on various ways to implement it, I’m happy to
announce that I’m putting the first release of my Ruby Summer of Code
project, ruby_archive 0.1.0, out into the wild.

It’s available on rubygems as well as athttp://github.com/byuni/ruby_archive

ruby_archive lets you use files within zip files much like normal files on
your filesystem. This means you can package data files and Ruby libraries
within convenient zip files and still use them easily from your program.
For open, load, require, and most File.*** and Dir.*** operations, you can
access files within archives by targetting at a location like the following:
‘(filename)!/(file_inside_archive)’

I would like to suggest a more robust approach of subclassing File and
Dir, (e.g. File::Archive or ArchiveFile), rather than overriding File
and Dir methods. For #load and #require:

‘(filename).zip/(file_inside_archive)’

would work as well and be clearer.

On Sat, Sep 04, 2010 at 07:07:17AM +0900, Jonathan N. wrote:

ruby_archive lets you use files within zip files much like normal files on
your filesystem. This means you can package data files and Ruby libraries
within convenient zip files and still use them easily from your program.
For open, load, require, and most File.*** and Dir.*** operations, you can
access files within archives by targetting at a location like the following:
‘(filename)!/(file_inside_archive)’

Are there any plans to support other compression formats such as gzip
and
bzip2, or archive formats like tar?

On Sat, Sep 4, 2010 at 10:13 AM, Chad P. [email protected] wrote:

Are there any plans to support other compression formats such as gzip and
bzip2, or archive formats like tar?

I would like to support other archive formats at some point, but it may
be
down the line somewhat - first I’d like to improve the code in various
places where it is ‘less-than-ideal’. But to support other formats we
just
need to add more Handler subclasses that implement file operations, so
it
certainly is possible.

-Jonathan N.

On Friday, September 03, 2010 05:07:17 pm Jonathan N. wrote:

A goal of the project was to put this type of functionality up for
consideration to be included in the Ruby interpreter - feedback related to
this is welcome as well.

If it can work well as a Gem, especially if it doesn’t need to know much
about
the Ruby interpreter itself – for example, if it just uses some zip
library,
and is otherwise pure-Ruby, even better if it’s a pure-Ruby zip library,
or
something from the standard libs…

I’d much rather things like this not go in core. This is the whole
reason we
have gems – I think it’s pretty cool, but I’m not going to use it in
every
Ruby script I write, and when I do need to use it, it’s only a ‘gem
install’
away.