gem bundle从本地资源安装 [英] gem bundle install from local resource

查看:107
本文介绍了gem bundle从本地资源安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以将宝石源重定向到我的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。

遵循以下步骤:


  1. 下载文件(使用任何可以使用的方法,例如使用http_proxy,从https://github.com/sferik/rails_admin/zipball/master


  2. 将下载的文件放入文件夹,例如 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 $ gem'rails_admin'
    ,:path => vendor / gems / rails_admin


  3. 运行 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:

  1. Download the file (using any approach you can, e.g. using http_proxy, from https://github.com/sferik/rails_admin/zipball/master)

  2. 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
    

  3. Now let's modify your Gemfile:

    gem 'rails_admin', :path => "vendor/gems/rails_admin"  
    

  4. Run bundle, works!

这篇关于gem bundle从本地资源安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆