“无效的gemspec”在“捆绑安装”期间的消息工厂女孩(rails 3.1和ruby 1.9.2p290) [英] "Invalid gemspec" messages during "bundle install" of factory girl (rails 3.1 and ruby 1.9.2p290)

查看:107
本文介绍了“无效的gemspec”在“捆绑安装”期间的消息工厂女孩(rails 3.1和ruby 1.9.2p290)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意:

当我在使用 factory_girl执行 bundle install 时遇到意外消息时,提出此问题使用Ubuntu 11.10的gem。作为一个noob我有......并且仍然...不知道发生了什么。下面的更新试图概述我最终摆脱了这些信息。我将这个问题放在一个稍微相关的标题行中,以防其他人使用它。



我看Factory Girl's README.md ,我看到:

 
安装
gem install factory_girl
或将以下行添加到Gemfile中:
gem'factory_girl'
并从你的shell运行bundle install。

支持的Ruby版本
Factory Girl 3.x系列支持Ruby 1.9.x.
对于旧版本的Ruby,请使用Factory Girl 2.x系列。

因为我目前正在使用

Rails 3.1.0

ruby​​ 1.9.2p290(2011-07-09 revision 32553)[i686-linux]



我将 gem'factory_girl'添加到我的Gemfile中,并执行 bundle update



但是继续我打开使用入门.md 文件并阅读

 
更新您的Gemfile
如果您正在使用Rails,你需要更改
所需的factory_girl_rails版本:
gemfactory_girl_rails,〜> 2.0
如果你不使用Rails,你只需要
更改了factory_girl所需的版本:
gemfactory_girl,〜> 3.0
一旦您的Gemfile更新,您需要更新您的软件包。

好的,很好。我从我的Gemfile中删除了 gem'factory_girl',而是添加了

gemfactory_girl_rails,〜> 2.0 code>。

然后再次尝试 bundle update


$ bundle install
[/ usr / local /lib/ruby/gems/1.9.1/specifications/
factory_girl_rails-2.0.0.gemspec]:符合要求的
[#3.0.7]
[/ usr中的gemspec无效/local/lib/ruby/gems/1.9.1/specifications/
factory_girl_rails-2.0.0.gemspec]:符合要求的
[#3.0.7]
获取源索引http://rubygems.org/
使用rake(0.9.2.2)
使用ZenTest(4.7.0)
...为了简洁省略了一堆使用行......
使用deepopenstruct(0.1.2)
使用factory_girl(3.0.0)
安装factory_girl_rails(2.0.0)
中的gemspec无效[/ usr / local / lib / ruby​​ / gem / 1.9.1 / specifications / factory_girl_rails-2.0.0.gemspec]:
格式化的需求[#3.0.7]
使用haml(3.1.4)
使用jquery-rails (1.0.19)
...一堆使用为简洁而省略的行...
使用uglifier(1.2.4)
您的套件已完成!使用`bundle show [gemname]`查看
捆绑的gem的安装位置。

所以现在我想知道(1)为什么按照README中的说明显然不起作用,(2)我应该怎么做到我的Gemfile为了让工厂女孩微笑和生产力?




更新



获取我不明白的错误信息令人沮丧,摆脱它们,但并不真正确定我做了什么,错误地修复了这些东西也并不那么特别。哦,好。



诚然,尽管我一直在使用bundle,但我不知道 gem rvm bundle 也没有真正理解每个命令应该做什么。我认为通过Google发现的这个博客条目有所帮助:

RVM和Bundler在五秒钟内



认为rvm和bundle应该自动化管理一组宝石,而 gem 只是管理宝石,我看了一下gem命令。



我试过了 gem check ,IIRC什么也没做。然后我尝试了 gem cleanup ,它回来了一大串想要卸载的宝石。相信我可以(可能)通过使用 bundle install 来回到我需要的位置,我让它执行卸载。 (尽管我不得不使用 sudo gem cleanup ,因为我缺少对某些涉及目录的写入权限)。



完成这个操作后, gem check gem cleanup 回来了。然而, bundle check 返回:
$ b

 
以下宝石缺失
* activesupport(3.1.0)
* activemodel(3.1.0)
* rack-cache(1.0.3)
* actionpack(3.1.0)
使用`bundle install`安装缺少的宝石

所以我做了两个 bundle install 软件包更新。这安装了上面列出的宝石没有问题。特别是,这次我没有 获取无效的gemspec 或任何其他错误消息。 (Hurray!)



当然, bundle update 并没有像我坦言的那样没有做任何事情。

所以虽然我还不确定发生了什么事,但我的问题的最初原因还是有点儿解决了。



我会在一个星期左右没有回答这个问题,看看有没有人想提供任何意见。之后,如果没有人提供更丰富的答案,我想我会自己回答这个问题,以便将其解决。



感谢所有帮助我推动一整套完美宝石的人。

解决方案

我无法再继续看到这个问题。虽然我从来没有清楚地理解为什么我得到 gemspec无效,但是在我的问题更新中列出的步骤解决了问题。



如果有一种方法可以简单地将问题作为答案不再是我的优先事项或者甚至是只是我已经移动了。但没有。这个answer至少会将这个问题从仍然需要查看的事物列表中删除。


Note:
I asked this question when I got unexpected messages when doing bundle install with the factory_girl gem using Ubuntu 11.10. Being a noob I had ... and still have ... no idea what was going on. The update below attempts to outline what I did to eventually get rid of the messages. I am leaving the question around with a slightly more pertinent title line in case it might be of use to someone else.

I look at Factory Girl's README.md and I see:

    Install
      gem install factory_girl
    or add the following line to Gemfile:
      gem 'factory_girl'
    and run bundle install from your shell.

    Supported Ruby versions
    The Factory Girl 3.x series supports Ruby 1.9.x.
    For older versions of Ruby, please use the Factory Girl 2.x series.

Since I am currently using
Rails 3.1.0 and
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]

I add gem 'factory_girl' to my Gemfile and do bundle update.

But then continuing on I open the Getting Started.md file and read

    Update Your Gemfile
    If you're using Rails, you'll need to change
    the required version of factory_girl_rails:
      gem "factory_girl_rails", "~> 2.0"
    If you're not using Rails, you'll just have to
    change the required version of factory_girl:
      gem "factory_girl", "~> 3.0"
    Once your Gemfile is updated, you'll want to update your bundle.

OK, fine. I remove gem 'factory_girl' from my Gemfile and instead add
gem "factory_girl_rails", "~> 2.0".
I then try bundle update once again. This time, no joy.

    $bundle install
    Invalid gemspec in [/usr/local/lib/ruby/gems/1.9.1/specifications/
      factory_girl_rails-2.0.0.gemspec]: Illformed requirement
      ["# 3.0.7"]
    Invalid gemspec in [/usr/local/lib/ruby/gems/1.9.1/specifications/
      factory_girl_rails-2.0.0.gemspec]: Illformed requirement 
      ["# 3.0.7"]
    Fetching source index for http://rubygems.org/
    Using rake (0.9.2.2) 
    Using ZenTest (4.7.0) 
    ... a bunch of "Using" lines omitted for brevity ...
    Using deepopenstruct (0.1.2) 
    Using factory_girl (3.0.0) 
    Installing factory_girl_rails (2.0.0) Invalid gemspec in
      [/usr/local/lib/ruby/gems/1.9.1/specifications/factory_girl_rails-2.0.0.gemspec]:
      Illformed requirement ["# 3.0.7"]  
    Using haml (3.1.4) 
    Using jquery-rails (1.0.19) 
    ... a bunch of "Using" lines omitted for brevity ...
    Using uglifier (1.2.4) 
    Your bundle is complete! Use `bundle show [gemname]` to see where a
      bundled gem is installed.

So now I'm wondering (1) why following the instructions in the READMEs have apparently not worked and (2) what should I do to my Gemfile in order to get Factory Girl smiling and productive?


Update

While getting error messages which I do not understand is frustrating, getting rid of them but not really being sure what I did to, err, "fix" things is also less special. Oh, well.

In all honesty, though I have been using bundle I had no idea what the difference was between gem, rvm, and bundle nor did I really understand what each command is supposed to do. I think this blog entry I found via Google helped somewhat with that:
RVM and Bundler in Five Seconds

Thinking that rvm and bundle are supposed to automate the management of a group of gems while gem just manages gems, I looked at the gem commands.

I tried gem check which IIRC did nothing. I then tried gem cleanup which came back with a long list of gems it wanted to uninstall. Trusting that I could (probably) get back to where I needed to be by using bundle install, I let it do the uninstalls. (Though I had to use sudo gem cleanup because I lacked write permission to some of the directories involved).

After doing this gem check and gem cleanup came back clean. However, bundle check returned:

The following gems are missing
 * activesupport (3.1.0)
 * activemodel (3.1.0)
 * rack-cache (1.0.3)
 * actionpack (3.1.0)
Install missing gems with `bundle install`

So I did both bundle install followed by (why not?) bundle update. This installed the gems listed above with no problems. In particular, this time I did not get the Invalid gemspec or any other error messages. (Hurrah!)

Of course, bundle update did nothing as, frankly, I was expecting it to do.

So while I'm still not sure what happened, the original reason for my question has been kinda, sorta solved.

I'll leave this question unanswered for a week or so to see if anyone else wants to contribute any comments. After that if no one else provides a more informative answer, I guess I'll just "answer" this question myself to close it out.

Thanks to all who helped nudge me towards a cleaner set of gems.

解决方案

There is no point that I can see in keeping this question open any longer. While I never did clearly understand why I was getting Invalid gemspec, the steps which are listed in my update to my question "solved" that "problem".

It would be nice if there was a way to simply close a question as "An answer is no longer a priority for me" or even simply "I've moved on". But there isn't. This "answer" will at least take this question off the list of things to still be looked at.

这篇关于“无效的gemspec”在“捆绑安装”期间的消息工厂女孩(rails 3.1和ruby 1.9.2p290)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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