Invalid gemspec because of the date format in specification
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've got this error message:
Invalid gemspec in [/Users/zagzag/.rvm/gems/ruby-1.9.2-p180@foobar/specifications/myplugin-1.0.0.gemspec]: invalid date format in specification: "2011-04-21 00:00:00.000000000Z"
I'm on the last Mac OS X (10.6.4), with:
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.4.0]
and:
$ gem -v
Invalid gemspec in [/Users/zagzag/.rvm/gems/ruby-1.9.2-p180@foobar/specifications/myplugin-1.0.0.gemspec]: invalid date format in specification: "2011-04-21 00:00:00.000000000Z"
1.7.2
I really don't see how to solve this issue. Thanks for any ideas.
Solution 1:
Here is the way I fix the "invalid date format in specification" error:
1.) Go to the specifications folder located at:
/usr/local/lib/ruby/gems/1.8/specifications/
2.) Find the spec that is causing the problem.
3.) Change s.date = %q{2011-05-21 00:00:00.000000000Z}
to s.date = %q{2011-05-21}
That's a WIN for me! Good Luck
Solution 2:
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.
Solution 3:
Please notice the comment from Damian Nowak. These commands do possibly mess up your rubygems!
On Ubuntu 11.10 the following solved this error:
sudo gem install rubygems-update
sudo update_rubygems
The following may work on some systems but not on Debian based:
sudo gem update --system
Solution 4:
You may upgraded your gem
. To fix this you can edit the gemspec
file directly -
from
2011-04-21 00:00:00.000000000Z
to
YYYY-MM-DD
Or upgrade your rails also
sudo gem update rails
It will fix the issue.
Solution 5:
Don't specify the time... just the date. 2011-04-21
should work fine.