Ruby 2.0.0-p247的默认宝石集中有哪些宝石



我意外地运行了rvm gemset empty default

有人能为ruby-2.0.0-p247列出宝石集default中的所有宝石吗?这样我就可以手动重新安装它们了?

谢谢!

别担心,仍然可以恢复所有宝石:

#!/usr/bin/env bash
CURRENT_GEMSET=$( rvm current )
CACHE_FOLDER=~/.rvm/gems/$CURRENT_GEMSET/cache
CACHED_GEMS=$CACHE_FOLDER/*.gem
for gem_file in $CACHED_GEMS
do
  GEM_FILES=$GEM_FILES' '$gem_file
done
gem install $GEM_FILES

您可以先看一下~/.rvm/gems/$( rvm current )/cache文件夹。所有gem都应该在那里。

编辑:

rvm gemset empty

删除所有为gemset安装的宝石。但是gem仍然在~/.rvm/gems/$( rvm current )/cache文件夹中(例如~/.rvm/gems/ruby-2.0.0-p247/cache~/.rvm/gems/jruby-1.7.3@my_gemset/cache),您仍然可以安装它们。

关于脚本的一些解释:

  1. rvm current打印当前Ruby版本和正在使用的任何宝石集的名称(来自rvm usage current)。您可以先调用rvm gemset use来选择要恢复的宝石集
  2. ~/.rvm/gems/$( rvm current )/cache是当前gemset的缓存文件夹,与$GEM_HOME/cache相同
  3. ~/.rvm/gems/$( rvm current )/cache/*.gem是缓存文件夹中gems的正则表达式
  4. 循环浏览文件名并将它们连接到单个字符串中

    for gem_file in $CACHED_GEMS
    do
      GEM_FILES=$gem_file' '$GEM_FILES
    done
    
  5. gem install $GEM_FILES为您重新安装宝石。

你是这个意思吗?

alexandr@alexandr-2pcdesktop:~/RailsWork/Achivity$ ruby -v
ruby 2.0.0dev (2013-01-07 trunk 38733) [i686-linux]
alexandr@alexandr-2pcdesktop:~/RailsWork/Achivity$ rvm @global do gem list
*** LOCAL GEMS ***
bundler (1.3.5)
bundler-unload (1.0.1)
rake (10.1.0)
rubygems-bundler (1.2.0)
rvm (1.11.3.8)

======更新======

alexandr@alexandr-2pcdesktop:~/RailsWork/Achivity$ rvm default do gem list
*** LOCAL GEMS ***
actionmailer (4.0.0, 3.2.13)
actionpack (4.0.0, 3.2.13)
actionpack-action_caching (1.0.0)
actionpack-page_caching (1.0.0)
activemodel (4.0.0, 3.2.13)
activerecord (4.0.0, 3.2.13)
activerecord-deprecated_finders (1.0.3)
activerecord-postgresql-adapter (0.0.1)
activeresource (3.2.13)
activesupport (4.0.0, 3.2.13)
arel (4.0.0, 3.0.2)
atomic (1.1.10)
bcrypt-ruby (3.0.1)
builder (3.1.4, 3.0.4)
bundler (1.3.5)
bundler-unload (1.0.1)
capybara (2.1.0)
childprocess (0.3.9)
climate_control (0.0.3)
cocaine (0.5.1)
coffee-rails (4.0.0, 3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.3, 1.6.2)
commonjs (0.2.6)
database_cleaner (1.0.1)
devise (3.0.0.rc, 2.2.4, 1.5.4)
diff-lcs (1.2.4)
erubis (2.7.0)
execjs (1.4.0)
factory_girl (4.2.0)
factory_girl_rails (4.2.1)
ffi (1.9.0)
hike (1.2.3)
i18n (0.6.4, 0.6.1)
jar_wrapper (0.1.7)
jbuilder (1.4.2)
journey (1.0.4)
jquery-rails (3.0.2, 3.0.1)
json (1.8.0)
less (2.3.2)
less-rails (2.3.3)
libv8 (3.11.8.17 x86-linux)
mail (2.5.4)
mime-types (1.23)
mini_portile (0.5.0)
minitest (4.7.5)
multi_json (1.7.7)
mysql2 (0.3.11)
nokogiri (1.6.0)
orm_adapter (0.4.0, 0.0.7)
paperclip (3.4.2)
pg (0.15.1)
polyglot (0.3.3)
protected_attributes (1.0.3)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (4.0.0)
rails-observers (0.1.1)
railties (4.0.0, 3.2.13)
rake (10.1.0)
rdoc (3.12.2)
ref (1.0.5)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
rspec-mocks (2.13.1)
rspec-rails (2.13.2)
rubygems-bundler (1.2.0)
rubyzip (0.9.9)
rvm (1.11.3.8)
sass (3.2.9)
sass-rails (4.0.0)
sdoc (0.3.20)
selenium (0.2.10)
selenium-webdriver (2.33.0)
shoulda-matchers (2.2.0)
sprockets (2.10.0, 2.2.2)
sprockets-rails (2.0.0)
sqlite3 (1.3.7)
therubyracer (0.11.4)
thor (0.18.1)
thread_safe (0.1.0)
tilt (1.4.1)
treetop (1.4.14)
turbolinks (1.2.0)
twitter-bootstrap-rails (2.2.7)
tzinfo (0.3.37)
uglifier (2.1.1)
warden (1.2.1)
websocket (1.0.7)
xpath (2.0.0)
zip (2.0.2)

但他们都来自Gemfile。

相关内容

  • 没有找到相关文章

最新更新