Factory Girl 的“捆绑安装”过程中出现“Invalid gemspec”消息(rails 3.1 和 ruby​​ 1.9.2p290)

2024-04-14

Note:
当我在做时收到意外消息时,我问了这个问题bundle installfactory_girl使用 Ubuntu 11.10 的 gem。作为一个菜鸟,我曾经……并且仍然……不知道发生了什么。下面的更新试图概述我为最终摆脱这些消息所做的事情。我将问题留下一个稍微相关的标题行,以防对其他人有用。

我看《工厂女孩》自述文件.md http://github.com/thoughtbot/factory_girl/blob/master/README.md我看到:



    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.
  

由于我目前正在使用
Rails 3.1.0 and
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]

I add gem 'factory_girl'到我的 Gemfile 并执行bundle update.

但然后继续我打开入门.md http://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md文件并读取



    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.
  

好的。我删除gem 'factory_girl'从我的 Gemfile 中添加
gem "factory_girl_rails", "~> 2.0".
然后我尝试bundle update再次。这一次,没有喜悦。



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

所以现在我想知道 (1) 为什么遵循自述文件中的说明显然不起作用,以及 (2) 我应该对我的 Gemfile 做什么才能让 Factory Girl 微笑并提高工作效率?


Update

虽然收到我不理解的错误消息令人沮丧,但摆脱它们但并不确定what我所做的,呃,“修复”事情也不那么特别。那好吧。

老实说,虽然我一直在使用捆绑包,但我不知道两者之间有什么区别gem, rvm, and bundle我也不明白每个命令应该做什么。我认为我通过谷歌找到的这篇博客文章对此有所帮助:
五秒内完成 RVM 和 Bundler http://www.ginzametrics.com/rvm-bundler-in-five-seconds.html

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

I tried gem checkIIRC什么也没做。然后我尝试了gem cleanup它返回了一长串想要卸载的 gem。相信我可以(可能)通过使用回到我需要去的地方bundle install,我让它进行卸载。 (虽然我不得不使用sudo gem cleanup因为我缺乏对某些涉及的目录的写权限)。

这样做之后gem check and gem cleanup干净地回来了。然而,bundle check回到:



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`
  

所以我两者都做了bundle install接下来(为什么不呢?)bundle update。这安装了上面列出的 gem,没有任何问题。特别是,这次我做到了not得到Invalid gemspec或任何其他错误消息。 (欢呼!)

当然,bundle update坦率地说,我什么也没做,正如我所期望的那样。

因此,虽然我仍然不确定发生了什么,但我问题的最初原因已经有点解决了。

我将在一周左右的时间内不回答这个问题,看看是否还有其他人愿意发表评论。之后,如果没有其他人提供更多信息的答案,我想我会自己“回答”这个问题以结束它。

感谢所有帮助我走向更清晰的宝石的人。


我在尝试安装时遇到了几乎相同的问题factory_girl_railsgem 并能够通过删除有问题的规范文件然后运行来解决它

宝石更新--系统

其次是

捆绑安装

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Factory Girl 的“捆绑安装”过程中出现“Invalid gemspec”消息(rails 3.1 和 ruby​​ 1.9.2p290) 的相关文章

随机推荐