Snapshot: A Rubygems plugin

Export and Import your gems. Snapshot, copy your current gems in a single file, providing a fast and secure way to import your gems anywhere.

Tested with:

  • ruby-1.8.6-p399 [ i386 ]
  • ruby-1.8.7-p249 [ i386 ]
  • 1.3.6 gem version

Version 1 was based on Import/Export Patch from Peer Allan.

Install/Usage

gem install rubygems_snapshot

After install, you can use:

gem snapshot export gems.tar to export your gems

gem snapshot import gems.tar to import (install) gems.

Important: When importing, don’t forget to use sudo if necessary and pay attention to errors relative to native build. I don’t know how to deal with that yet! :X Hosted at Gemcutter

Others formats

Nowadays, it supports two formats:

  • tar (default)
  • yml

You can chose the format, using -f parameter. For example:

gem snapshot export gems.yml -f yml gem snapshot import gems.yml -f yml

For aditional help, execute: gem help snapshot

How it Works?

It’s very simple. When exporting, get all gems (like “gem list”), puts in a yml file. If gem file exists at cache folder from rubygems, copy to tar file too. (tar format)

When importing, copy all gems to rubygems cache folder. Read the yml file, install the gem file from cache folder or do a simple “gem install” if gem file does not exists.

For Developers

Using as API


require "rubygems"
GemsSnapshot::Exporter.export("example.tar", :format => :tar)


require "rubygems"
GemsSnapshot::Importer.import("example.tar", :format => :tar)

Use the sources Luke!

If you want help to improve Snapshot, after git clone, you’ll need the following gems:

  • rake
  • rspec
  • cucumber

Use “rake -T” to see the available tasks. I highly recomend using RVM during development. Anything, questions, suggestions etc., send me message or leave a issue.

License

(The MIT License)

Copyright © 2009 Roger Leite

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.