Task | Ruby | Python |
Install a package |
gem install package
|
pip install package
|
Install with a version |
gem install -v 1.2.3 package
|
pip install package==1.2.3
|
Install a runtime version |
rvm install ree
|
# Install normally from source or binary distribution
|
Create a package set |
rvm gemset create mygemset
|
virtualenv myenv
|
Activate a package set |
rvm use ree@mypackages
|
source myenv/bin/activate
|
Activate a runtime version |
rvm use ree-1.8.7
|
# Happens for free via virtualenv:
python2.5 -m virtualenv myenv
source myenv/bin/activate
|
Create a package sandbox |
# Create a gemfile containing:
source :rubygems
gem mypackage
# Then bundle:
bundle
|
# Install packages normally after activating virtualenv
pip install mypackage
# Then freeze:
pip freeze > requirements.txt
|
Activate an existing package sandbox |
bundle
|
# Activate a virtualenv, then:
pip install -r requirements.txt
|
Execute a script within the sandbox |
bundle exec myscript.rb
|
# Nothing special required after activating virtualenv
|
Activate a dependency set in code |
require 'rubygems'
require 'bundler'
Bundler.setup
|
# Nothing special required after activating virtualenv
|