Rip: A New Way to Package Ruby Software

Tired of juggling Ruby gems? Try Rip. It's a one-size-fits-all, no fuss, powerful package manager.

For example, on the test machine, with Bash as the login shell, the file $HOME/.profile was amended to contain these lines.

# -- start rip config -- #
# -- end rip config -- #

RIPDIR sets the path to your Rip database. RUBYLIB is a colon-separated list of directories that are added to Ruby’s library load path. PATH is also a list of directories and is used to find executables. Rip combines these three as shown to find libraries to load and binaries to run from your active environment. (Remember, active is a symlink. Its target changes, but its name remains constant. Hence, these environment variables are much of the magic of Rip.)

If another user has already installed Rip on your system, you must (for now) manually configure Rip for your personal use. Create a directory for your Rip database and edit your shell startup file to set RIPDIR, RUBYLIB, and PATH. Be sure to set RIPDIR appropriately; you can use the latter two lines verbatim. Logout and login again or source the modified startup file to pick up the changes.

Once you start a new session, run rip check again and all should be well.

$ rip check
All systems go.

If you need assistance running Rip, type rip --help for a list of options.

$ rip --help
Usage: rip COMMAND [options]

Commands available:

For more information on a command use:
  rip help COMMAND

  -h, --help     show this help message and exit
  -v, --version  show the current version and exit

Managing Environments

To create a new environment, use the env command.

$ rip env create alpha
ripenv: created alpha
$ rip env create beta
ripenv: created beta

Whenever you create a new environment, it becomes active.

$ rip env active
ripenv: beta

You can change to another environment using env use.

$ rip env use base
ripenv: using base

You can also copy and delete an environment (rip env copy and rip env delete, respectively), query which environment is active (rip env active), and enumerate all available environments (rip env list). Copy and delete are cheap operations and combined are a great way to quickly test if a new package can be mixed among the existing contents of an environment. If something fails, just delete the broken environment and start over. Delete is also the fastest way to uninstall a large number of packages in one fell swoop.

By the way, you cannot (naturally) delete the active environment. You must activate another environment and then run delete.

$ rip env use beta
ripenv: using beta
$ rip env delete beta
ripenv: can’t delete active environment
$ rip env use base
ripenv: using base
$ rip env delete beta
ripenv: deleted beta

Installing Packages with Rip

As mentioned above, Rip can install Ruby code from four sources (with more to come): a directory, a single file, a Git repository, and a gem. Moreover, if the source of the code includes a special file named deps.rip in the root of the project, all sources named in that file are also installed. deps.rip isn’t required; but if it’s provided, the source is considered a proper Rip repository and its contents are treated as dependencies.

To demonstrate how Rip works, let’s install a package from a Git repository. Specifically, let’s install Grit, since it’s already a proper Rip package. Grit gives you object-oriented access to Git repositories via Ruby. This is Grit’s deps.rip:

git://github.com/halostatue/mime-types.git v1.16

To install Grit, run rip install git://github.com/defunkt/grit.git.

$ rip install git://github.com/defunkt/grit.git
running install hook for diff-lcs
Successfully installed diff-lcs (491fbc0)
running install hook for mime-types
Successfully installed mime-types (v1.16)
running install hook for grit
Successfully installed grit (e37664)

Here’s how rip install works:

  1. First, the latest code from the Grit GitHub repository is fetched and unpacked in the directory of the active environment.
  2. Next, the code for each dependency listed in deps.rip is fetched, unpacked, and installed in the directory associated with the current environment. Executables are placed in bin; code in lib.
  3. Recursively, the dependencies of each dependency are fetched, unpacked, and installed in the current environment.
  4. Finally, the package originally requested is installed into the active environment.

Steps 2-4 can apply to a directory, repository, or gem, if deps.rip exists. And in any case, if multiple versions of the same library are ever referenced as dependencies, the entire process halts with an error.

To install a file, just name the file. For instance, if the file object_mods.rb adds a handful of convenience functions to Object, you can install it in the current environment with rip install object_mods.rb.

$ rip install object_mods.rb
Successfully installed object_mods.rb (2009-06-16)

The operation copies the raw file to rip-packages for safekeeping and copies the file to active/lib in the Rip directory. The file can be local or on the Web. For the latter, simply provide the URL as the argument.

An individual file is versioned, too. If you edit object_mods.rb and try to install the new version into the current environment, Rip complains of a conflict.

$ vi object_mods.rb
... make some changes and save ...
$ rip install object_mods.rb
version conflict!
rip: installation failed

You can also install a directory with Rip. Just point to the directory and anything in subdirectory lib is copied to the current environment.

For example, assuming that ~/myapp is a Rails application, the command rip install ~/myapp copies the Ruby files found in ~/myapp/lib to the current environment.

$ rip install ~/myapp
unpacking myapp (unversioned)...
running install hook for myapp
Successfully installed myapp (unversioned)

You can also install a local copy of a gem from its directory. For instance, given a copy of Markaby in ~/src/Markaby, run the command rip install ~/src/Markaby to install Markaby into the current environment.

$ rip install ~/src/Markaby
unpacking markaby-0.5 (0.5)...
running install hook for markaby-0.5
Successfully installed markaby-0.5 (0.5)

You can also install a gem directly, assuming you have version 1.3.3 or later of the gem utility installed on your system. (Earlier versions of the gem utility cause this operation to fail.)

$ rip install tlsmail
Searching gems.github.com for tlsmail...
ERROR:  Could not find tlsmail in any repository
Searching gems.rubyforge.org for tlsmail...
running install hook for tlsmail
Successfully installed tlsmail (0.0.1)

Stupid Rip Tricks

Here are some other clever tricks for Rip.

  • You can create an ad hoc .rip file at any time to install a collection of libraries into an environment all at once. Of course, the dependencies for the collection and its target environment can’t conflict; otherwise, this is a convenient method to populate an environment suitable to run an existing project.
  • You can remove a single package from an environment with rip uninstall package. Add -d to remove the package and everything that depends on it.
  • If you use JRuby, you can run Ruby code with JRuby in the current environment. Just type jruby app.rb. Similarly, if you have have the Ruby 1.9 interpreter installed on your machine as ruby19, just type ruby19 app.rb to run that code in the active environment.
  • To run a daemon in the current environment, use rip ruby environment app.rb, where environment is the name of one of your environments. By default, rip ruby runs the interpreter named ruby. You can name a different interpreter with the RUBYBIN environment variable.

    For example, the command…

    $ RUBYBIN=jruby rip ruby beta app.rb

    … runs a daemon using JRuby in the beta environment.

Rip Rip Hooray!

Rip is brand new, so rough edges are to be expected. Still, its features are quite impressive and useful as-is and it can only get better. Try Rip out and follow its progress via the Rip Google Group. And happy tinkering!

Comments on "Rip: A New Way to Package Ruby Software"

I savor, lead to I discovered exactly what I used to be taking a look for.
You’ve ended my four day lengthy hunt! Good Bless you
man. Have a nice day. Bye

Here is my web site :: Cheap Car Insurance

Here is a great Blog You may Locate Interesting that we encourage you to visit.

My coder is trying tto convince mee to move to .net from PHP.
I have alwsys disliked the idea because oof the expenses. But he’s tryiong none the less.
I’ve been using WordPress on various websites for about a year
and am concerned about switdhing to another platform. I have heard fantastic things about blogengine.net.
Is there a way I can import all my wordpress posts into it?
Any help would be really appreciated!

Here iss myy site; cheap car insurance

I am actually grateful to the holder of this web
page who has shared this fantastic article at att this place.

Feel free to visit my web site -Cheap car insurance

you’re truly a excellent webmaster. The webb site loading
pacfe is incredible. It seems that youu are doing aany distinctive trick.
In addition, The contents are masterwork. you have performed
a wonderful process on this matter!

Also visit my web site: cheap car insurance for teens

I am regular visitor, how are you everybody? This piece of writing posted at this web site iis genuinely pleasant.

Here is my webpage: Cheap Car Insurance

[url=http://acheterviagrageneriquefrance.com/]viagra generique[/url] viagra
[url=http://viagraachetergenerique.net/]viagra generique[/url] viagra moins cher
[url=http://comprarviagragenericoes.net/]comprar viagra[/url] generico viagra

Definitely believe that which you stated. Your favorite
justification seemed to be on the webb the
simplest thing to be aware of. I say to you, I definitely get irked while people
think about worries that theyy plainly doo not know about.
You managed to hit the nail upon the top as well as defined out the whole
thig without havinjg side-effects , people could take a signal.
Will likely be back to get more. Thanks

Here is my blopg :: Cheap Car Insurance

I know this if off topic but I’m looking into starting
my own blog and was wondering what all iis needed to
get set up? I’m assuming having a blog like yours would cost a pretty penny?

I’m not very internet svvy sso I’m not 100% certain.
Any suggestions or advice would be greatly appreciated.

my site: Cheap Car Insurance

Keepp on working, grea job!

My web site cheap car insurance michigan

Excellent post. I used to be checking continuously this weblog and I am impressed!
Very useful information specially the last part :
) I maintain such information a lot. I used to be seeking this
particular info for a long time. Thank you and good luck.

Also visit my site: Car Insurance Companies

If yyou desire to increase your knowledge simply kep visiting this
site and bee updated with the hottest news posted here.

My page cheap car insurance

Do you mind if I quote a few of your articles as long as I provide credit and sources back to your website?

My website is in the very same niche as yours and my users would really benefit
from a lot of the information you present here. Please let me know if this ok with you.

Link exchange is nothing else but it is simply placing the other person’s weblog link
on your page at appropriate place and other person will also do same in favor of you.

my page :: cheap car insurance

Incredible story there. What happened after? Take care!

Hello all, here every person is sharing these know-how, thus
it’s nice to read this webpage, and I used to pay a
visit this web site all the time.

my web-site; cheap car insurance

magnificent points altogether, you simply gained a new reader. What may you suggest in regards to your put up that you simply made a few days in the past? Any certain?

Always a huge fan of linking to bloggers that I enjoy but really don’t get a good deal of link really like from.

Wonderful story, reckoned we could combine several unrelated information, nevertheless seriously really worth taking a look, whoa did a single master about Mid East has got much more problerms at the same time.

[url=http://canadianpharcharmyonlineusa.com/]canadian pharcharmy online[/url]
canadian pharcharmy online
http://canadianpharcharmyonlineusa.com/ canadian pharcharmy online

That is the finish of this report. Right here you will come across some web-sites that we feel you?ll enjoy, just click the hyperlinks.

Wonderful story, reckoned we could combine several unrelated information, nonetheless genuinely worth taking a appear, whoa did 1 learn about Mid East has got far more problerms too.

[url=http://acheterviagrageneriquefrance.com/]achat viagra[/url] viagra acheter
[url=http://viagraachetergenerique.net/]viagra sans ordonnance[/url] viagra generique
[url=http://comprarviagragenericoes.net/]viagra generico[/url] comprar viagra por internet

Wow that was strange. I just wrote an incredibly long
comment but after I clicked submit my comment didn’t appear.
Grrrr… well I’m not writing all that over again. Anyhow, just wanted to say wonderful

Great blog. Will read on…

I think the admin of this site is in fact working hard in support of his web page, as here
every information is quality based material.

Please check out the internet sites we stick to, including this one particular, as it represents our picks in the web.

I simply want to tell you that I am just very new to blogging and site-building and absolutely savored your blog. Almost certainly I’m likely to bookmark your blog . You actually have very good article content. With thanks for sharing with us your webpage.

Leave a Reply