Project

packer

0.0
No commit activity in last 3 years
No release in over 3 years
Use different versions of the same Cargo-compatible gems.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
= 0.0.1

Runtime

>= 0
 Project Readme

Packer

Require different versions of the same Cargo-compatible gem.

Description

Cargo lets you import two versions of the same library, and Packer brings the same functionality to Cargo-compatible gems.

Consider these two versions of the same library:

$ gem list

*** LOCAL GEMS ***

par (0.0.2)
par (0.0.1)

You can now load both versions side by side:

>> Par1 = package("par", "= 0.0.1")
=> #<Module:0x000001009ffa28>::Par
>> Par2 = package("par", "= 0.0.2")
=> #<Module:0x000001009f2828>::Par
>> Par1::VERSION
=> "0.0.1"
>> Par2::VERSION
=> "0.0.2"

How does it work?

First, check how Cargo works. Packer just combines Cargo with RubyGems.

Usage

After requiring packer in the calling program, the methods package, import and export become available. Both import and export come from Cargo, and package is defined in Packer.

This is how you use package in the calling program:

require "packer"

MyFoo = package("foo", "= 1.0.0")

And for that to work, the imported gem should look like this:

class Foo
  VERSION = "1.0.0"
end

export(Foo)

Installation

$ gem install packer