如何使用离线.gem文件使用Bundler? [英] How to use Bundler with offline .gem file?

查看:109
本文介绍了如何使用离线.gem文件使用Bundler?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的应用程序,我需要处理加密的ZIP文件。尽管他们的网站看起来很可怕,但似乎Chilkat的商业邮编宝石可能是最好的方式去实施这个。



因为这是一个商业的宝石,他们没有在Bundler看到的任何典型的宝石来源。我能够在Mac OS X下安装gem的Linux 64位版本(尽管我还没有试图运行它,所以如果真的有效的话,还没有关于它的文字)。然而,我首先试图让Bundler识别并加载我下载的.gem文件中的gem。
$ b Bundler有一个路径属性,我尝试过以多种方式使用,但是我还没有得到它的工作:


  1. 我尝试使用路径指向.gem文件本身,但路径需要一个目录。
  2. 我尝试添加。 gz到.gem文件的末尾并提取它 - 我有一个内含data.tar.gz和metadata.gz的目录。指向带有这两个文件的提取目录的路径不起作用。
  3. 我尝试提取data.tar.gz和metadata.gz,并将提取的版本放入我指向的目录中路径。这失败了。

  4. 我注意到gem没有gemspec文件 - 我创建了一个并将其放置在目录中。

这是我得到的错误:

  $ bundle install 
获取http://rubygems.org/
的源索引获取http://gems.github.com/
的源索引可以在/Users/username/appname/vendor/cache/chilkat-9.1.0-x86_64-linux找不到gem'chilkat(> = 0,runtime)'。
源不包含任何版本的'chilkat(> = 0,运行时)'

关于如何让Bundler看到该目录中确实存在gem的任何想法?



非常感谢!

解决方案

我使用的Rails 3.0.3,新的Rails 3和捆绑软件。

我得到了同样的错误:

  gem'mygem',:path => '/ path / to / gem'

通过指定版本号解决:

  gem'mygem','0.0.1',:path => '/ path / to / gem'

使用> = 0.0.1 版本恢复为原始错误。然而,我无法解释任何这种情况。



引用JD的有用提示,从Gemfile手册页:类似于:git选项的语义,路径选项要求相关目录包含gem的.gemspec,或者您指定了bundler应该使用的显式版本。


For my application, I need to handle encrypted ZIP files. Despite their horrific looking site, it seems that Chilkat's commercial Zip gem is probably the best way to go to implement this.

Because this is a commercial gem, they don't have it in any of the typical gem sources that Bundler looks at. I was able to install the Linux 64-bit version of the gem under Mac OS X (though I haven't tried to run it yet, so no word yet on if that will actually work). However, I'm first trying to get Bundler to recognize and load the gem from the .gem file that I downloaded.

Bundler has a path attribute which I've tried to utilize in several ways, but I haven't gotten it to work yet:

  1. I tried using path to point to the .gem file itself, but path expects a directory.
  2. I tried adding .gz to the end of the .gem file and extracting it - I got a directory with a data.tar.gz and metadata.gz inside. path pointed to the extracted directory with these two files didn't work.
  3. I tried extracting the data.tar.gz and metadata.gz and placing the extracted versions inside the directory that I pointed path to. This failed.
  4. I noticed that the gem didn't have a gemspec file - I created one and placed it inside the directory. No luck.

This is the error that I get:

$ bundle install
Fetching source index for http://rubygems.org/
Fetching source index for http://gems.github.com/
Could not find gem 'chilkat (>= 0, runtime)' in source at /Users/username/appname/vendor/cache/chilkat-9.1.0-x86_64-linux.
Source does not contain any versions of 'chilkat (>= 0, runtime)'

Any ideas on how I can get Bundler to see that the gem is indeed in this directory? Any other options other than the path attribute which doesn't seem to be working?

Many thanks!

解决方案

I'm using Rails 3.0.3, new to Rails 3 and bundler.

I got this same error with:

gem 'mygem', :path => '/path/to/gem'

Resolved by specifying the version number:

gem 'mygem', '0.0.1', :path => '/path/to/gem'

Using >=0.0.1 for the version reverted to the original error. I can't explain any of this, however.

Quoting JD's helpful commment, from the Gemfile man page: "Similar to the semantics of the :git option, the :path option requires that the directory in question either contains a .gemspec for the gem, or that you specify an explicit version that bundler should use."

这篇关于如何使用离线.gem文件使用Bundler?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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