When I include a gem that I made, thanks to Bundler (version 1.0.12), in a Gemfile and then I try to bundle or to rake just like that:
$ rake
I\
Had the same issue. It looks like a bug in rubygems. Here's the commit that fixed it: https://github.com/rubygems/rubygems/commit/21cccd55b823848c5e941093a615b0fdd6cd8bc7
You need to update rubygems and bundler to the latest versions. If you are still having issues after that, then you may need to remove and then reinstall any gems that are giving you problems.
Reinstalling your gems can be the solution in many of these slightly different machine states.
In my case:
cd /Library/Ruby/Gems/1.8/specifications &&
sudo rm -rf *
In my case, the other more creative solutions failed.
My issue was getting Invalid gemspec
when trying to use cocoapods. I ran gem install cocoapods
again and everything was rosy.
This is more of a comment to ben hall's answer, but i dont have that privilege yet it seems
gem updates didn't seem to work, im thinking it can't even load the gem because of the bad date format. manually changing the dates was too frustrating to go one by one, so a grep:
grep -i *.gemspec -e '.*s\.date.*=.*%q{\(....-..-..\) \(.*Z\)}
And for sed:
sed -i -e 's/\(.*\)s\.date.*=.*%q{\(....-..-..\) \(.*Z\)}/\1s.date = %q\{\2}/p' ./*.gemspec
And at your own risks!! I'm still a sed newbie, but it worked for me ;)
Even if you install the latest version of a gem with a valid date format, make sure to gem cleanup GEMNAME
afterwards, since gem
will still complain about the specifications for the older libraries.
The shotgun approach: Uninstall all gems and rerun bundler.
gem list --no-version | xargs gem uninstall -aIx
rm -i `rvm gemdir`/specifications/*.gemspec
gem update --system
gem install bundler
bundle install
Here is the command to fix this for all your gems:
perl -p -i -e 's/ 00:00:00.000000000Z//' ~/gems/specifications/*.gemspec
It converts s.date = %q{2011-05-21 00:00:00.000000000Z}
to s.date = %q{2011-05-21}
and should fix your issue.