Skip to content

Instantly share code, notes, and snippets.

@Phrogz
Created April 26, 2010 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Phrogz/379744 to your computer and use it in GitHub Desktop.
Save Phrogz/379744 to your computer and use it in GitHub Desktop.
# mkdir vendor; cd vendor; mkdir gems; cd gems
# gem unpack rack
# gem unpack sinatra
# gem unpack haml
# gem unpack sequel
# gem unpack ruby-net-ldap
GEMS = {
'rack' => 'rack-1.1.0',
'sinatra' => 'sinatra-1.0',
'haml' => 'haml-2.2.23',
'net/ldap' => 'ruby-net-ldap-0.0.4',
'sequel' => 'sequel-3.10.0'
}
# You can't just chdir to each, because one gem might require another (e.g. sinatra requires rack).
$:.unshift( *GEMS.values.map{ |path| File.expand_path( File.join('vendor','gems',path,'lib') ) } )
GEMS.each{ |gem,path| require gem }
@Phrogz
Copy link
Author

Phrogz commented Sep 29, 2010

Simpler, if less precise:
$:.unshift( Dir['vendor/gems//lib'] )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment