问题描述
我的工作场所禁止我们访问互联网,因此我们无法连接到rubygems.org以远程安装gem。
My workplace has banned us from internet access so we can't connect to rubygems.org to install gems remotely.
我可以在家访问rubygems.org。有没有一种简单的方法可以让我下载并更新我们在家中需要的宝石,然后将它们(通过便携式硬盘或任何东西)同步到我的工作场所的本地宝石镜像服务器,以便其他同事可以安装宝石
从那个镜像服务器?
I can access rubygems.org at home. Is there a simple way to enable me download and update the gems we need at home ,then sync them(by a portable hard disk or somthing) to a local gems mirror server at my workplace so that other colleagues caninstall gems from that mirror server?
推荐答案
您可以使用来镜像宝石和来托管它们。
You can use rubygems-mirror to mirror the gems and Gem in a box to host them.
安装rubygems-mirror:
>
Once mirroring finishes edit ~/.gem/mirror/config.ru:
require "rubygems" require "geminabox" Geminabox.data = "./" run Geminabox安装Gem:
$ gem install geminabox启动gem服务器:
$ bStart gem server:
$ cd ~/.gem/mirror $ rackup编辑您的应用程序的 Gemfile 使用你的宝石服务器:
Edit your application's Gemfile to use your gem server:
source "http://your.servers.ip:9292" .或者将它添加为本地 for rubygems.org,所以你不必改变你的 Gemfile :
Or add it as a local mirror for rubygems.org, so you don't have to change your Gemfile:
$ bundle config mirror.https://rubygems.org https://localgems.lan $ bundle config mirror.http://rubygems.org http://localgems.lan不时重新建立镜像:
$ gem generate_index --directory ~/.gem/mirror这篇关于如何构建一个rubygems镜像服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!