RVM - 无法使用全局gemset中的gem

时间:2012-11-08 11:19:48

标签: ruby-on-rails ruby rvm

我安装了'pry'在全球宝石集团。但是我无法使用它。那是我使用" binding.pry"在我的代码中然后它说 - 无法解决' pry'。我尝试过:require' pry'并加载' pry.rb'但没有运气。

<pre>
nikhil@nikhil-K54C:/media/media1/railscode/beasport$ rvm gemset list

gemsets for ruby-1.9.3-p194 (found in /home/nikhil/.rvm/gems/ruby-1.9.3-p194)
   (default)
=> beasport
   composer_app
   composer_app1
   global
   new_sample_app

nikhil@nikhil-K54C:/media/media1/railscode/beasport$ gem which pry
/home/nikhil/.rvm/gems/ruby-1.9.3-p194@global/gems/pry-0.9.10/lib/pry.rb
nikhil@nikhil-K54C:/media/media1/railscode/beasport$ gem list | grep pry
pry (0.9.10)
pry-debugger (0.2.0)
pry-doc (0.4.4)
pry-stack_explorer (0.4.7)
nikhil@nikhil-K54C:/media/media1/railscode/beasport$ rvm info

ruby-1.9.3-p194@beasport:

  system:
    uname:       "Linux nikhil-K54C 3.2.0-32-generic-pae #51-Ubuntu SMP Wed Sep 26 21:54:23 UTC 2012 i686 i686 i386 GNU/Linux"
    system:      "ubuntu/12.04/i386"
    bash:        "/bin/bash => GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)"
    zsh:         " => not installed"

  rvm:
    version:      "rvm 1.16.6 (master) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "1 month 5 days 1 hour 7 minutes 39 seconds ago"

  ruby:
    interpreter:  "ruby"
    version:      "1.9.3p194"
    date:         "2012-04-20"
    platform:     "i686-linux"
    patchlevel:   "2012-04-20 revision 35410"
    full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]"

  homes:
    gem:          "/home/nikhil/.rvm/gems/ruby-1.9.3-p194@beasport"
    ruby:         "/home/nikhil/.rvm/rubies/ruby-1.9.3-p194"

  binaries:
    ruby:         "/home/nikhil/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
    irb:          "/home/nikhil/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
    gem:          "/home/nikhil/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
    rake:         "/home/nikhil/.rvm/gems/ruby-1.9.3-p194@global/bin/rake"

  environment:
    PATH:         "./bundler_stubs:/home/nikhil/.rvm/gems/ruby-1.9.3-p194@beasport/bin:/home/nikhil/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/nikhil/.rvm/rubies/ruby-1.9.3-p194/bin:/home/nikhil/.rvm/bin:/usr/local/java/jre1.7.0/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
    GEM_HOME:     "/home/nikhil/.rvm/gems/ruby-1.9.3-p194@beasport"
    GEM_PATH:     "/home/nikhil/.rvm/gems/ruby-1.9.3-p194@beasport:/home/nikhil/.rvm/gems/ruby-1.9.3-p194@global"
    MY_RUBY_HOME: "/home/nikhil/.rvm/rubies/ruby-1.9.3-p194"
    IRBRC:        "/home/nikhil/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
    RUBYOPT:      ""
    gemset:       "beasport"
</pre>

我错过了什么。 我检查这个问题,但对我的情况没有帮助 RVM - Not able to use gems from the @global gemset 在此先感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

好吧..我明白了......所以要将@global gemset中的宝石用于你的项目特定gemset,你仍然需要将它们列入项目的gemfile中。我做了以下,现在我可以使用pry

group :development do
    gem 'pg', '0.14.1'
    gem 'annotate', '~> 2.4.1.beta'
    gem 'pry'
    gem 'pry-doc'
    gem 'pry-debugger'
    gem 'pry-stack_explorer'
end