irr*_*ohn 3 rubygems ruby-on-rails ruby-on-rails-3 factory-bot
注:
我问这个问题时,我做了的时候意外的消息bundle install与factory_girl使用Ubuntu 11.10的宝石.作为一个菜鸟,我......并且仍然......不知道发生了什么.下面的更新试图概述我最终消除了这些消息所做的工作.我正在提出一个稍微更相关的标题行,以防它可能对其他人有用.
我看看Factory Girl的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和
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
我添加gem 'factory_girl'到我的Gemfile并做bundle update.
但接下来我打开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微笑和富有成效?
虽然收到我不理解的错误消息令人沮丧,但摆脱它们但不确定我做了什么,错误,"修复"事情也不那么特别.那好吧.
说实话,虽然我一直在使用捆绑我不知道有什么差异之间gem,rvm和bundle我也没有真正了解每个命令是应该做的.我认为我通过谷歌发现的这篇博客文章对此有所帮助:
RVM和Bundler在五秒钟内
认为rvm和bundle应该在管理宝石时自动管理一组gem宝石,我看了一下gem命令.
我试过gem check哪个IIRC什么也没做.然后我尝试gem cleanup了一些它想要卸载的宝石列表.相信我可以(可能)回到我需要使用的地方bundle install,我让它做卸载.(虽然我必须使用,sudo gem cleanup因为我缺少对所涉及的一些目录的写入权限).
这样做后gem check,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.这安装了上面列出的宝石没有问题.特别是,这一次我也没有拿到Invalid gemspec或任何其他错误消息.(欢呼!)
当然,bundle update没有做任何事,坦率地说,我期待它做到.
因此,虽然我仍然不确定发生了什么,但我的问题的原因有点,有点解决了.
我会在一个星期左右的时间内回答这个问题,看看是否有其他人想要提出任何意见.在此之后,如果没有其他人提供更具信息性的答案,我想我会自己"回答"这个问题,然后将其关闭.
感谢所有帮助我推动更清洁宝石的人.
在尝试安装factory_girl_railsgem 时遇到了几乎相同的问题,并且能够通过删除有问题的规范文件然后运行来解决它
gem update --system
其次是
捆绑安装
| 归档时间: |
|
| 查看次数: |
3664 次 |
| 最近记录: |