I'm using the Spring application preloader and just upgraded to v 0.9.0. Now I'm getting the following warning:
我正在使用Spring应用程序预加载程序,并将其升级为v0.9.0。现在我得到以下警告:
Warning: Running
gem pristine --all
to regenerate your installed gemspecs will improve the startup performance of Spring.警告:运行gem原始版本——重新生成已安装的gemspec将提高Spring的启动性能。
I tried running that command but it fails to install some of my gems, which may have to do with my recent upgrade to OS X Mavericks. How do I get rid of this warning?
我尝试运行这个命令,但它没有安装我的一些gems,这可能与我最近升级到OS X Mavericks有关。我如何摆脱这个警告?
2 个解决方案
#1
15
This was because previous versions of rubygems would load all the gemspecs whenever queried.
这是因为以前的rubygems版本在查询时都会加载所有gemspec。
This is slow to begin with and gets slower the more gems are installed.
这是缓慢的开始和越来越慢的宝石安装更多。
But with Rubygems 2.1 it has a "stubbed" gemspec that is very fast to load. See https://github.com/rubygems/rubygems/pull/435 for more info.
但是对于Rubygems 2.1,它有一个“存根化”的gemspec,加载速度非常快。更多信息请参见https://github.com/rubygems/rubygems/pull/435。
The spring people take advantage of this to not load every single gemspec when just loading bin/spring which uses just a small number to call out to the spring server.
spring人员利用这一优势,在加载bin/spring时不加载每个gemspec,而bin/spring只使用一个很小的数字来调用spring服务器。
The test it was doing (assuming you have RubyGems 2.1 or later) was essentially:
它正在进行的测试(假设您有RubyGems 2.1或更高版本)基本上是:
ruby -e 'p Gem::Specification.stubs.reject(&:stubbed?).reject(&:default_gem?).map(&:name)'
If that list was not empty, it knew that you had older gems; gems installed with RubyGems < 2.1.
如果列表不是空的,它知道你有旧的宝石;宝石安装RubyGems < 2.1。
You can use that information to generate a list of gems to run gem pristine
on:
您可以使用该信息生成一个gem列表,以运行gem原始版本:
# /tmp/dirty.rb
require 'shellwords'
Gem::Specification.stubs.reject(&:stubbed?).reject(&:default_gem?).each do |gemspec|
puts "gem pristine #{Shellwords.escape gemspec.name} --version #{Shellwords.escape gemspec.version.to_s}"
end
Then just run:
然后运行:
ruby /tmp/dirty.rb | bash
But it is easier to run gem pristine --all
and as @Beerlington mentioned, gem uninstall
any gems giving it a problem.
但是,运行gem的原始版本更容易——正如@Beerlington所提到的,gem卸载了任何给它带来问题的gem。
#2
5
I don't totally understand the source of the issue, but I was able to get rid of the warning by removing the gems that were failing to install and then rerunning gem pristine --all
. It's probably not a huge issue, but I figured I'd post my solution in case someone else comes across the same problem.
我不完全理解问题的来源,但我能够通过删除未能安装的gem,然后重新运行gem pure -all来消除警告。这可能不是一个大问题,但我想我应该发布我的解决方案,以防其他人遇到同样的问题。
#1
15
This was because previous versions of rubygems would load all the gemspecs whenever queried.
这是因为以前的rubygems版本在查询时都会加载所有gemspec。
This is slow to begin with and gets slower the more gems are installed.
这是缓慢的开始和越来越慢的宝石安装更多。
But with Rubygems 2.1 it has a "stubbed" gemspec that is very fast to load. See https://github.com/rubygems/rubygems/pull/435 for more info.
但是对于Rubygems 2.1,它有一个“存根化”的gemspec,加载速度非常快。更多信息请参见https://github.com/rubygems/rubygems/pull/435。
The spring people take advantage of this to not load every single gemspec when just loading bin/spring which uses just a small number to call out to the spring server.
spring人员利用这一优势,在加载bin/spring时不加载每个gemspec,而bin/spring只使用一个很小的数字来调用spring服务器。
The test it was doing (assuming you have RubyGems 2.1 or later) was essentially:
它正在进行的测试(假设您有RubyGems 2.1或更高版本)基本上是:
ruby -e 'p Gem::Specification.stubs.reject(&:stubbed?).reject(&:default_gem?).map(&:name)'
If that list was not empty, it knew that you had older gems; gems installed with RubyGems < 2.1.
如果列表不是空的,它知道你有旧的宝石;宝石安装RubyGems < 2.1。
You can use that information to generate a list of gems to run gem pristine
on:
您可以使用该信息生成一个gem列表,以运行gem原始版本:
# /tmp/dirty.rb
require 'shellwords'
Gem::Specification.stubs.reject(&:stubbed?).reject(&:default_gem?).each do |gemspec|
puts "gem pristine #{Shellwords.escape gemspec.name} --version #{Shellwords.escape gemspec.version.to_s}"
end
Then just run:
然后运行:
ruby /tmp/dirty.rb | bash
But it is easier to run gem pristine --all
and as @Beerlington mentioned, gem uninstall
any gems giving it a problem.
但是,运行gem的原始版本更容易——正如@Beerlington所提到的,gem卸载了任何给它带来问题的gem。
#2
5
I don't totally understand the source of the issue, but I was able to get rid of the warning by removing the gems that were failing to install and then rerunning gem pristine --all
. It's probably not a huge issue, but I figured I'd post my solution in case someone else comes across the same problem.
我不完全理解问题的来源,但我能够通过删除未能安装的gem,然后重新运行gem pure -all来消除警告。这可能不是一个大问题,但我想我应该发布我的解决方案,以防其他人遇到同样的问题。