"Invalid gemspec messages" during "install package" girl factory (rails 3.1 and ruby 1.9.2p290)
Note:
I asked this question when I got unexpected messages while executing bundle install
with a gem factory_girl
using Ubuntu 11.10. As a nob, I had ... and still ... don't know what's going on. The update below attempts to describe what I did to get rid of the messages eventually. I leave the question with a slightly more appropriate title line in case it might be useful to someone else.
I look at Factory Girl 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
andruby 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, I open Getting Started.md 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.
Good perfect. I am removing gem 'factory_girl'
from my Gemfile and adding instead
gem "factory_girl_rails", "~> 2.0"
.
Then I will try bundle update
again. No joy this time.
$ 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 the following instructions in the README clearly didn't work and (2) what should I do with my Gemfile to get the Factory Girl smiling and productive?
Update
When getting error messages that I don't understand, it's frustrating to get rid of them, but really not sure what I did, I'm wrong, "fixing" things is also less special. Oh good.
To be honest, although I used the package, I had no idea what the difference was between gem
, rvm
and bundle
, and I really don't understand what each command is supposed to do. I think this blog post I found via google helped somewhat:
RVM and Bundler in five seconds
Thinking that rvm and bundle should automate the management of a group of gems, but gem
just manage the gems, I looked at the gems teams.
I tried gem check
which IIRC did nothing. Then I tried gem cleanup
, which came back with a long list of gems it wanted to remove. Trusting that I would (possibly) get back to where I needed help bundle install
, I allowed him to do remote links. (Although I had to use sudo gem cleanup
it because I lacked written permission for some of the related directories).
After that gem check
, gem cleanup
they returned 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
and then (why not?) bundle update
. This installed the gems listed above without issue. In particular, this time I did not get Invalid gemspec
any or any other error messages. (Hooray!)
Of course bundle update
not doing anything, to be honest, I expected him to do it.
So while I'm not sure yet what happened, the original reason for my question was curious, it has been resolved.
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 think I'll just "answer" this question to close it.
Thanks to everyone who helped push me towards cleaner gem sets.
source to share
It makes no sense for me to see this question open any longer. While I never really understood why I was getting Invalid gemspec
, the steps listed in my update to my question "solved" this "problem".
It would be nice if there was a way to just close the question: "The answer is no longer a priority for me" or even just "I moved." But no. This "answer" will at least take the question away from the list of things that remain to be seen.
source to share