How to safely fix “invalid date format in specification” for webrobots-0.0.10.gemspec

て烟熏妆下的殇ゞ 提交于 2019-12-09 07:12:43

问题


For every gem execution I am receiving the following error:

Invalid gemspec in [...rvm/gems/ruby-1.9.2-p136/specifications/webrobots-0.0.10.gemspec]: invalid date format in specification: "2011-07-01 00:00:00.000000000Z"

I am not the webrobots maintainer and I can't uninstall that gem.

There is any safe action to fix this problem on a production server?


回答1:


These days with Github and Bundler you don't have to be a maintainer in order to fix issues in the gems you're using. Just fork the project on Github, fix whatever issue is there, and them simply point Bundler at your fork. If it is a handy extension to the gem rather than just a hack for yourself you might also consider making a pull request to the original maintainer to roll your changes into the official gem.

Having said all of that, the issue that might cause this problem doesn't seem to be present in the gemspec of the 0.0.10 version of webrobots. This issue can occur when the date in the gemspec is in the format that you have in your error e.g.:

"2011-07-01 00:00:00.000000000Z"

Looking at a snippet of gemspec though we have:

s.authors = [%q{Akinori MUSHA}]
s.date = %q{2011-07-01}
s.description = %q{This library helps write robots.txt compliant web robots in Ruby.

So that seems to be correct. Another issue that has been known to cause this problem is a YAML parser issue, to fix you need to force the use of a particular YAML parser (psych). You need to define the following somewhere:

require 'yaml'
YAML::ENGINE.yamler = 'syck'

Lastly you might want to clean your local installation and then do a redeploy which may sort you out. Once again if you're using Bundler something like this:

gem update --system
rvm gemset empty mygemset
gem install bundler
gem install



回答2:


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




回答3:


You may be using old version of gem. See you current version gem -v. Upgrade you gem to latest

gem update --system

And install you gem file again with new gem. gem install <gem-name> or bundle install



来源:https://stackoverflow.com/questions/6989707/how-to-safely-fix-invalid-date-format-in-specification-for-webrobots-0-0-10-ge

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!