gem bundle从本地资源安装 [英] gem bundle install from local resource
问题描述
我可以将宝石源重定向到我的Web服务器路径,我将在那里下载所有必要的宝石套件并放在那里?我想使用 bundle install
GemFile将从 http://rubygems.org ,因为它在那里定义。
我通常会遇到像请求太多这样的错误(似乎互联网拥塞问题)。
是否可以将gem源路径重定向到本地服务器? gemfile.5.html#PATH-path - > :path
选项。
假设您想从不可到达的资源中安装gem,例如:
# Gemfile
gem'rails_admin',:git => 'git://github.com/sferik/rails_admin.git'
您无法安装
使用 bundle install
创建gem。
-
下载文件(使用任何可以使用的方法,例如使用http_proxy,从https://github.com/sferik/rails_admin/zipball/master )
-
将下载的文件放入文件夹,例如
vendor / gems / rails_admin
,其中的文件应该如下所示:
$ ls vendor / gems / rails_admin
$ p $现在让我们来修改你的Gemfile:
app config Gemfile Gemfile31 lib LICENSE.md rails_admin.gemspec Rakefile README.md screenshots spec
$ p $gem'rails_admin'
,:path => vendor / gems / rails_admin -
运行
c $ c>,有效!
can I redirect gem source to my web server path, where I'll download all necessary gem bundles and put there? I want to use those by "bundle install
"
GemFile will fetch those from http://rubygems.org as it is defined on there. I usually got an error like "too many requests" (seems internet congestion issues).
is it possible to redirect gem source path to my local server?
TL;DR: Use the :path
option.
Assuming you want to install a gem from a not reachable resource, such as:
# Gemfile
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
and you can't install the gem using bundle install
because of a firewall or something.
Following these steps:
Download the file (using any approach you can, e.g. using http_proxy, from https://github.com/sferik/rails_admin/zipball/master)
Put the downloaded file into a folder, such as
vendor/gems/rails_admin
, and the file in it should look like:$ ls vendor/gems/rails_admin app config Gemfile Gemfile31 lib LICENSE.md rails_admin.gemspec Rakefile README.md screenshots spec
Now let's modify your Gemfile:
gem 'rails_admin', :path => "vendor/gems/rails_admin"
Run
bundle
, works!
这篇关于gem bundle从本地资源安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!