# \[ANN\] ruby\_archive 0.1.0 released

**URL:** <https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923>\
**Category:** ruby-talk\
**Created:** [3 September 2010 22:07 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923 "2010-09-03T22:07:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jonathan\_Nielsen](https://rubytalk.org/u/Jonathan_Nielsen)\
**Post date:** [3 September 2010 22:07 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/1 "2010-09-03T22:07:17Z")

</div>

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](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 Nielsen

---

<div class="post-metadata">

**Author:** ![JEG2](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@JEG2](https://rubytalk.org/u/JEG2)\
**Post date:** [3 September 2010 22:40 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/2 "2010-09-03T22:40:06Z")

</div>

Holy smoke. This is freaking awesome!

James Edward Gray II

> **···**
>
> On Sep 3, 2010, at 5:07 PM, Jonathan Nielsen 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](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)'

---

<div class="post-metadata">

**Author:** ![Chad\_Perrin](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/chad_perrin/32/2234_2.png) [@Chad\_Perrin](https://rubytalk.org/u/Chad_Perrin)\
**Post date:** [4 September 2010 16:13 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/3 "2010-09-04T16:13:33Z")

</div>

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

> **···**
>
> On Sat, Sep 04, 2010 at 07:07:17AM +0900, Jonathan Nielsen 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)'
> 
> --  
> Chad Perrin [original content licensed OWL: [http://owl.apotheon.org](http://owl.apotheon.org) ]

---

<div class="post-metadata">

**Author:** ![botp1](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@botp1](https://rubytalk.org/u/botp1)\
**Post date:** [4 September 2010 17:48 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/4 "2010-09-04T17:48:30Z")

</div>

how do you resolve pathnames w "!"

best regards -botp

> **···**
>
> On Sat, Sep 4, 2010 at 6:07 AM, Jonathan Nielsen \<jonathan@jmnet.us\> wrote:
> 
> > '(filename)!/(file\_inside\_archive)'

---

<div class="post-metadata">

**Author:** ![David\_Masover](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@David\_Masover](https://rubytalk.org/u/David_Masover)\
**Post date:** [4 September 2010 18:46 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/5 "2010-09-04T18:46:09Z")

</div>

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.

> **···**
>
> On Friday, September 03, 2010 05:07:17 pm Jonathan Nielsen 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.

---

<div class="post-metadata">

**Author:** ![botp1](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@botp1](https://rubytalk.org/u/botp1)\
**Post date:** [5 September 2010 07:17 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/6 "2010-09-05T07:17:04Z")

</div>

even something like a,  
&nbsp;&nbsp;&nbsp;require "programs.zip"

would be great.

> **···**
>
> On Sat, Sep 4, 2010 at 6:07 AM, Jonathan Nielsen \<jonathan@jmnet.us\> wrote:
> 
> > It also allows you to package your entire program in one file and run it  
> > using the included 'rba\_launch' program.

---

<div class="post-metadata">

**Author:** ![7rans](https://avatars.discourse-cdn.com/v4/letter/7/a8b319/32.png) [@7rans](https://rubytalk.org/u/7rans)\
**Post date:** [5 September 2010 15:36 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/7 "2010-09-05T15:36:03Z")

</div>

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:

&nbsp;&nbsp;'(filename).zip/(file\_inside\_archive)'

would work as well and be clearer.

> **···**
>
> On Sep 3, 6:07 pm, Jonathan Nielsen \<jonat...@jmnet.us\> 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)'

---

<div class="post-metadata">

**Author:** ![Jonathan\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jonathan\_Nielsen](https://rubytalk.org/u/Jonathan_Nielsen)\
**Post date:** [4 September 2010 16:43 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/8 "2010-09-04T16:43:26Z")

</div>

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 Nielsen

> **···**
>
> On Sat, Sep 4, 2010 at 10:13 AM, Chad Perrin \<code@apotheon.net\> wrote:
> 
> > Are there any plans to support other compression formats such as gzip and  
> > bzip2, or archive formats like tar?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Nielsen](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jonathan\_Nielsen](https://rubytalk.org/u/Jonathan_Nielsen)\
**Post date:** [4 September 2010 17:58 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/9 "2010-09-04T17:58:03Z")

</div>

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 Nielsen

> **···**
>
> On Sat, Sep 4, 2010 at 11:48 AM, botp \<botpena@gmail.com\> wrote:
> 
> > how do you resolve pathnames w "!"
> > 
> > best regards -botp

---

<div class="post-metadata">

**Author:** ![botp1](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@botp1](https://rubytalk.org/u/botp1)\
**Post date:** [5 September 2010 07:08 UTC](https://rubytalk.org/t/ann-ruby-archive-0-1-0-released/59923/10 "2010-09-05T07:08:50Z")

</div>

how about using constant flags as options, like eg,  
&nbsp;&nbsp;File::FNM\_ASZIP -- basename/actual file is zip itself  
&nbsp;&nbsp;File::FNM\_INZIP -- same as ! behaviour but no need of !, ie file  
is contained in zip

thank you and best regards -botp

> **···**
>
> On Sun, Sep 5, 2010 at 1:58 AM, Jonathan Nielsen \<jonathan@jmnet.us\> 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.
