Skip to content

Instantly share code, notes, and snippets.

@matejuh
Created February 1, 2012 09:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matejuh/1716076 to your computer and use it in GitHub Desktop.
Save matejuh/1716076 to your computer and use it in GitHub Desktop.
Embedded Ruby gems- gem path
#Inspired by Ruby sources gem initialization
void defineRuby() {
void Init_prelude(void);
RUBY_INIT_STACK;
ruby_init();
ruby_init_loadpath();
ruby_script("embed traffic profiller");
rb_define_module("Gem");
Init_prelude();
rb_require("rubygems");
rb_require("./embedded.rb");
ruby_object = rb_class_new_instance(0, NULL, rb_const_get(rb_cObject,
rb_intern("EmbeddedRubyClasss ")));
}
class EmbeddedRubyClasss
def initialize()
puts Gem.path
end
end
Output of EmbeddedRubyClass initialize:
/home/matej/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/gems/1.9.1
/home/matej/.gem/ruby/1.9.1
matej@notebook:~$ echo $GEM_PATH
/home/matej/.rvm/gems/ruby-1.9.2-p290:/home/matej/.rvm/gems/ruby-1.9.2-p290@global
matej@notebook:~$ echo $GEM_HOME
/home/matej/.rvm/gems/ruby-1.9.2-p290
matej@notebook:~$ rvm reinstall 1.9.2
Removing /home/matej/.rvm/src/ruby-1.9.2-p290...
Removing /home/matej/.rvm/rubies/ruby-1.9.2-p290...
Removing ruby-1.9.2-p290 aliases...
Removing ruby-1.9.2-p290 wrappers...
Removing ruby-1.9.2-p290 environments...
Removing ruby-1.9.2-p290 binaries...
Installing Ruby from source to: /home/matej/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...
ruby-1.9.2-p290 - #fetching
ruby-1.9.2-p290 - #extracting ruby-1.9.2-p290 to /home/matej/.rvm/src/ruby-1.9.2-p290
ruby-1.9.2-p290 - #extracted to /home/matej/.rvm/src/ruby-1.9.2-p290
ruby-1.9.2-p290 - #configuring
ruby-1.9.2-p290 - #compiling
ruby-1.9.2-p290 - #installing
Removing old Rubygems files...
Installing rubygems-1.8.15 for ruby-1.9.2-p290 ...
Installation of rubygems completed successfully.
ruby-1.9.2-p290 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.2-p290 - #importing default gemsets (/home/matej/.rvm/gemsets/)
Install of ruby-1.9.2-p290 - #complete
matej@notebook:~$ echo $GEM_PATH
/home/matej/.rvm/gems/ruby-1.9.2-p290:/home/matej/.rvm/gems/ruby-1.9.2-p290@global
matej@notebook:~$ echo $GEM_HOME
/home/matej/.rvm/gems/ruby-1.9.2-p290
matej@notebook:~$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.15
- RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [i686-linux]
- INSTALLATION DIRECTORY: /home/matej/.rvm/gems/ruby-1.9.2-p290
- RUBY EXECUTABLE: /home/matej/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
- EXECUTABLE DIRECTORY: /home/matej/.rvm/gems/ruby-1.9.2-p290/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /home/matej/.rvm/gems/ruby-1.9.2-p290
- /home/matej/.rvm/gems/ruby-1.9.2-p290@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.github.com/", "http://gems.github.com/", "http://gems.github.com/", "http://gems.github.com/"]
- "gemhome" => "/home/matej/.rvm/gems/ruby-1.9.2-p290"
- "gempath" => ["/home/matej/.rvm/gems/ruby-1.9.2-p290", "/home/matej/.rvm/gems/ruby-1.9.2-p290@global"]
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.github.com/
- http://gems.github.com/
- http://gems.github.com/
- http://gems.github.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment