Gmail和parse_resource宝石的红宝石自动加载冲突 [英] Ruby autoload conflicts between gmail and parse_resource gems

查看:144
本文介绍了Gmail和parse_resource宝石的红宝石自动加载冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<一个href="http://stackoverflow.com/questions/12231134/why-is-autoload-failing-to-load-files-for-gems#comment16393317_12231134">Earlier,我在Gmail的宝石询问自动加载不能够找到它要载入的文件。在构建一个最小的剧本,我发现Gmail的宝石装​​好了的文件时,我并没有包括parse_resource宝石。

Earlier, I asked about autoload in the gmail gem not being able to find the files it wanted to load. In building a minimal script, I found the gmail gem loaded it's files when I didn't include the parse_resource gem.

借助 gmail的宝石,您可以从Gmail访问您的电子邮件,标签和收件箱。该 parse_resource宝石包装了的 parse.com 在一个ActiveRecord模式的API。

The gmail gem lets you access your emails, labels, and inboxes from gmail. The parse_resource gem wraps the parse.com api in an ActiveRecord pattern.

如果我包括parse_resource创业板的的Gmail的宝石,红宝石抛出LoadError。

If I include the parse_resource gem before the gmail gem, ruby throws a LoadError.

这些都是最小的剧本我写的,由差错举办的排列。

These are the permutations of the minimal script I wrote, organized by error.

require 'rubygems'
require 'parse_resource' 
require 'gmail'

Gmail.new('yourEmail@gmail.com', 'password')

正常​​工作

require 'rubygems'
#require 'parse_resource'
require 'gmail'

Gmail.new('yourEmail@gmail.com', 'password')

自动加载错误

require 'rubygems'
require 'gmail'
require 'parse_resource' 

Gmail.new('yourEmail@gmail.com', 'password')

/Library/Ruby/Gems/1.8/gems/gmail-0.4.0/lib/gmail.rb:50:in新:没有这样的文件加载 - 的Gmail /客户端( LoadError)     从emailError.rb:6

/Library/Ruby/Gems/1.8/gems/gmail-0.4.0/lib/gmail.rb:50:in 'new': no such file to load -- gmail/client (LoadError) from emailError.rb:6

我如何既包括parse_resource和Gmail宝石到我的计划?

How do I include both the parse_resource and gmail gems into my programs?

-Nick

推荐答案

我已经安装了打捆宝石。

I had installed the gems with bundler.

在装入这两个库解决这个问题,我安装了宝石命令宝石: sudo的创业板安装的Gmail parse_resource

To fix the issue with loading both libraries, I installed the gems with the gem command: sudo gem install gmail parse_resource

通过这个工作,我能要求以任意顺序库,并连接到Gmail和解析没有问题。

With this done, I was able to require the libraries in any order, and to connect to gmail and parse without issue.

-Nick

这篇关于Gmail和parse_resource宝石的红宝石自动加载冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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