Download all gems dependencies

我只是一个虾纸丫 提交于 2019-12-20 08:18:12

问题


I want to install compass by downloading any required file and taking them to another machine without internet connection. I have downloaded the source package for compass and when I run gem on it in the non connected machine it complains about missing dependencies. Any solution?


回答1:


Thats exactly the problem I had.
After searching around a while I found a Solution who works using Bundler https://bundler.io/

Getting Gem with Dependencies:

  • Create a new Folder with a File named Gemfile in it.
  • Write a Source and the Gem you want to have the dependencys for into the File
  • Bsp:

    source "http://rubygems.org"
    gem 'rails', '3.2.1'

  • Open a Commandline at this Folder an Execute: bundle install
  • This should download and install all Dependencys
  • Execute the Command bundle list if you wanna see it
  • Execute the Command bundle package
  • This should create the Directory Structure vendor/cache
  • Inside the cache Directory are now all the Dependencys you need for your gem

Install Gem on Machine without internet connection:

  • Copy the cache Folder to the Machine
  • Open a Commandline inside the Cache Folder and execute gem install --local Gemname.gem
  • Bsp:

    gem install --local rails-3.2.1.gem




回答2:


I did

export GEM_HOME=.
export GEM_PATH=.
gem install --no-ri --no-rdoc --install-dir . <gem>



回答3:


Hm. That's a little tough. gem dependency will show you dependencies for one gem, but it won't go all the way down the tree.

➔ gem dependency compass
Gem compass-0.10.5
  haml (>= 3.0.4, runtime)

Gem compass-0.10.6
  haml (>= 3.0.4, runtime)

➔ gem dependency haml   
Gem haml-3.0.21
  maruku (>= 0.5.9, development)
  yard (>= 0.5.3, development)

Gem haml-3.0.22
  maruku (>= 0.5.9, development)
  yard (>= 0.5.3, development)

Gem haml-3.0.23
  maruku (>= 0.5.9, development)
  yard (>= 0.5.3, development)

Gem haml-3.0.24
  maruku (>= 0.5.9, development)
  yard (>= 0.5.3, development)

"development" means it's only required if you are developing the gem itself. "runtime" means you need it to use it.

so in this case, the only dependency is haml. if it were a more complicated gem, i don't know a good way to generate the whole tree.



来源:https://stackoverflow.com/questions/4402819/download-all-gems-dependencies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!