问题描述
我可以将宝石源重定向到我的Web服务器路径,我将在那里下载所有必要的宝石套件并放在那里?我想使用
使用 bundle install 创建gem。
遵循以下步骤:-
下载文件(使用任何可以使用的方法,例如使用http_proxy,从)
-
将下载的文件放入文件夹,例如 vendor / gems / rails_admin ,其中的文件应该如下所示:
$ ls vendor / gems / rails_admin
app config Gemfile Gemfile31 lib LICENSE.md rails_admin.gemspec Rakefile README.md screenshots spec
$ p $现在让我们来修改你的Gemfile:
$ 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从本地资源安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!