如何为某些未安装的gem列出gem依赖项?

时间:2014-12-29 22:32:59

标签: ruby-on-rails ruby gem rubygems

我试图在Arch Linux计算机上安装rails。我遇到了have already appeared here的网络问题。我在任何地方都没有找到满意的答案。

每次我尝试时,gem都无法下载不同的gem(我认为所有都是rails的依赖项),我想尝试单独下载这些,并且只有在我安装完所有的时候才会尝试再次安装导轨。

这就是尝试安装rails的目的:

[lurch ~]$ time gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ETIMEDOUT: Connection timed out - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/api/v1/dependencies?gems=rails-html-sanitizer)

real    4m59.698s
user    0m1.170s
sys     0m0.117s


[lurch ~]$ gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ETIMEDOUT: Connection timed out - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/quick/Marshal.4.8/thread_safe-0.3.4.gemspec.rz)


[lurch ~]$ gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ETIMEDOUT: Connection timed out - connect(2) for "api.rubygems.org" port 443 (https://api.rubygems.org/api/v1/dependencies?gems=i18n)


[lurch ~]$ time gem install rails
ERROR:  While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
    no such name (https://api.rubygems.org/api/v1/dependencies?gems=bundler)

real    1m28.495s
user    0m0.883s
sys     0m0.083s


[lurch ~]$ gem update --system
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ETIMEDOUT: Connection timed out - connect(2) for "s3.amazonaws.com" port 443 (https://api.rubygems.org/specs.4.8.gz)

现在,我的问题是:我在哪里可以获得rails的所有gem依赖项的列表? gem dependency命令无效:

[lurch ~]$ gem dependency rails     
No gems found matching rails (>= 0)

事实上,this documentation pagegem dependency命令描述为[强调我的]"显示已安装宝石的依赖关系"。

所以,为了清楚起见,我的问题是:如何获取某些特定gem的所有gem依赖项的列表?当然,如果有人设法解决命令gem install rails中的奇怪网络问题,我也会非常高兴。

编辑:版本信息

[lurch ~]$ uname -a
Linux lurch 3.17.6-1-ARCH #1 SMP PREEMPT Sun Dec 7 23:43:32 UTC 2014 x86_64 GNU/Linux
[lurch ~]$ gem --version
2.2.2
[lurch ~]$ ruby --version
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

2 个答案:

答案 0 :(得分:3)

找到问题的真实答案:RubyGems.org

gem dependency rails
Gem rails-4.1.6
  actionmailer (= 4.1.6)
  actionpack (= 4.1.6)
  actionview (= 4.1.6)
  activemodel (= 4.1.6)
  activerecord (= 4.1.6)
  activesupport (= 4.1.6)
  bundler (< 2.0, >= 1.3.0)
  railties (= 4.1.6)
  sprockets-rails (~> 2.0)

或Gemfile.lock

rails (4.1.6)
  actionmailer (= 4.1.6)
  actionpack (= 4.1.6)
  actionview (= 4.1.6)
  activemodel (= 4.1.6)
  activerecord (= 4.1.6)
  activesupport (= 4.1.6)
  bundler (>= 1.3.0, < 2.0)
  railties (= 4.1.6)
  sprockets-rails (~> 2.0)

答案 1 :(得分:3)

我知道这有点像死神,但我认为你可以使用gem install --explain rails。

来自http://guides.rubygems.org/command-reference/#gem-install

  

- -explain - 而不是安装宝石,指出将安装哪些

你可能必须从另一个可以访问rubygems.org服务器的系统运行该命令,获取宝石列表,将它们拉下来,然后将它们安装在你的系统上,而不是直接点击rubygems(直到你遇到网络问题)想通了)