我想通过下载必要文件并将它们带到另一台没有联网的机器上来安装Compass。我已经下载了Compass的源代码包,但是在非联网的机器上运行gem时,它会抱怨缺少依赖项。有什么解决方法吗?
我想通过下载必要文件并将它们带到另一台没有联网的机器上来安装Compass。我已经下载了Compass的源代码包,但是在非联网的机器上运行gem时,它会抱怨缺少依赖项。有什么解决方法吗?
这正是我遇到的问题。
在搜索了一段时间后,我找到了一个使用 Bundler https://bundler.io/ 的解决方案。
获取带有依赖项的 Gem:
Gemfile
的新文件夹。source "http://rubygems.org"
gem 'rails', '3.2.1'
bundle install
bundle list
bundle package
vendor/cache
在没有网络连接的机器上安装 Gem:
gem install --local rails-3.2.1.gem
bundle package --no-install
命令将跳过安装步骤。 - xoryves我做了
export GEM_HOME=.
export GEM_PATH=.
gem install --no-ri --no-rdoc --install-dir . <gem>
嗯,这有点困难。gem dependency
可以显示一个 gem 的依赖关系,但它不能一直往下展开。
➔ 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” 意味着只在开发 gem 本身时需要它。“runtime” 意味着你需要它来使用它。
因此,在这种情况下,唯一的依赖项是 haml。如果它是一个更复杂的 gem,我不知道生成整个树的好方法。