Invalid date format specification in gemspec

后端 未结 18 2040
野性不改
野性不改 2020-12-04 09:47

I am getting the following error when I try to use gems in windows, and I also referred to this stackoverflow post and updated rubygems and rails. But nothing could solve t

18条回答
  •  独厮守ぢ
    2020-12-04 10:09

    This is not really an answer but if somebody feels like digging more I found this gemspec spec here: http://rubygems.rubyforge.org/rubygems-update/Gem/Specification.html (scroll down to date=date() and click to show source):

    @date = case date
    when String then
      if %r\A(\d{4})-(\d{2})-(\d{2})\Z/ =~ date then
        Time.utc($1.to_i, $2.to_i, $3.to_i)
      else
        raise(Gem::InvalidSpecificationException,
              "invalid date format in specification: #{date.inspect}")
      end
    when Time, Date then
      Time.utc(date.year, date.month, date.day)
    else
      TODAY
    end
    

    So I guess this is the code that parses that gemspec, and it just looks like the date format that are in the files that show errors don't conform to this.

    What I did was to just manually fix those offending gemspecs as suggested above (changing the dates to "yyyy-mm-dd", it works for me.

    All the rubygem specs I had that had this problem also has a line

    s.rubygems_version = %q{1.3.5}

    So I'm guessing these are just old gems? And what's with those %q{...} anyway?

提交回复
热议问题