Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

"Invalid .gemspec format in" and "already initialized constant" warnings with Ruby 1.9.2dev

#3865
% ruby -v
ruby 1.9.2dev (2010-02-03 trunk 26544) [x86_64-darwin10.2.0]

% rails -v
Rails 3.0.0.beta

seeing a lot of warnings along the lines -

WARNING:  #<NoMethodError: undefined method '>' for nil:NilClass>
WARNING:  Invalid .gemspec format in '/usr/local/lib/ruby/gems/1.9.1/specifications/warden-0.9.0.gemspec'
WARNING:  #<NoMethodError: undefined method '>' for nil:NilClass>
WARNING:  Invalid .gemspec format in '/usr/local/lib/ruby/gems/1.9.1/specifications/xml-simple-1.0.12.gemspec'

and

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:14: warning: already initialized constant VERSION
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:14: warning: already initialized constant RubyGemsVersion
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:194: warning: already initialized constant MUTEX
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:196: warning: already initialized constant RubyGemsPackageVersion
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:202: warning: already initialized constant WIN_PATTERNS

whenever starting rails with rails server or rails console

Reported by trevor · February 5th, 2010 @ 08:21 PM

State: invalid
Milestone: 3.0.2
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: Low

Activity

  1. Jeremy Kemper
    Jeremy Kemper
    • Milestone cleared.
    • State changed from new to invalid

    This is a RubyGems issue. Ruby 1.9 ships with an outdated RubyGems and you can't upgrade it.

    http://redmine.ruby-lang.org/issues/show/2355

    Fortunately, you can ignore the warnings.

    February 5th, 2010 @ 08:38 PM

  2. matt (at toastyapps)
    matt (at toastyapps)
    • Assigned user set to Jeremy Kemper

    ruby -v
    ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.2.0]

    gem -v
    1.3.5

    I am having a similar issue where running "rails -v" (inside of a rails project only) or running script/rails results in a lot of "WARNING: Invalid .gemspec format" for example:

    WARNING: #<NoMethodError: undefined method >' for nil:NilClass><br/>

    -- encoding: utf-8 --

    Gem::Specification.new do |s|
    s.name = %q{abstract} s.version = "1.0.0"

    s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version= s.authors = ["makoto kuwata"] s.cert_chain = nil s.date = %q{2006-03-12} s.description = %q{'abstract.rb' is a library which enable you to define abstract method in Ruby.} s.files = ["lib/abstract.rb", "test/test.rb", "README.txt", "ChangeLog", "setup.rb", "abstract.gemspec"] s.homepage = %q{http://rubyforge.org/projects/abstract} s.require_paths = ["lib"] s.required_ruby_version = Gem::Requirement.new("> 0.0.0") s.rubygems_version = %q{1.3.5} s.summary = %q{a library which enable you to define abstract method in Ruby} s.test_files = ["test/test.rb"]

    if s.respond_to? :specification_version then

    current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
    s.specification_version = 1
    
    if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
    else
    end
    

    else end end
    WARNING: Invalid .gemspec format in '/usr/local/Cellar/ruby/1.9.1-p378/lib/ruby/gems/1.9.1/specifications/abstract-1.0.0.gemspec'

    This is followed by a couple thousand lines of output and whereas I can ignore them, it's still very annoying.

    February 8th, 2010 @ 01:25 AM

  3. RomD
  4. Balazs Nagy
    Balazs Nagy

    Please also have a look on https://rails.lighthouseapp.com/projects/8994/tickets/3863-rails-30...

    This is a ruby 1.9 issue with an easy fix, but we wanted to treat it in other places.

    February 8th, 2010 @ 04:31 PM

  5. trevor
    trevor

    as pointed out by Balazs Nagy the "warning: already initialized constant" comes from Ruby cruft. removing the old library directory and starting with a fresh install removes those warnings.

    note, this does not fix the verbose "Invalid .gemspec format in" warnings.

    here's approximately what I did on OS X (snow leopard).

    gem list --no-version > gem_list.txt
    sudo mv /usr/local/lib/ruby /usr/local/lib/ruby-old
    wget ftp://ftp.ruby-lang.org/pub/ruby/snapshot.tar.bz2
    # install
    sudo su
    gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
    gem install rails --pre
    gem install sqlite3-ruby
    env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
    # install remaining gems
    

    February 8th, 2010 @ 10:37 PM

  6. Christian Lupp
    Christian Lupp

    The new bundler version 0.9.4 solves the first "Invalid .gemspec format" problem.

    The second RubyGems problem can be solved by a simple

    sudo gem uninstall rubygems-update
    

    February 11th, 2010 @ 10:14 PM

  7. trevor
    trevor

    i'll confirm what Christian said in regards to the "Invalid .gemspec format" problem being solved for rails server and rails console

    % git show-ref refs/heads/master
    4d8a76f3013e3347e55ddb319d76f9602f4bbccb refs/heads/master
    % sudo gem uninstall bundler
    [...]
    Successfully uninstalled bundler-0.9.5
    % sudo rake install
    [...]
    WARNING:  Invalid .gemspec format in '/usr/local/lib/ruby/gems/1.9.1/specifications/tzinfo-0.3.16.gemspec'
    WARNING:  #' for nil:NilClass>
    [... blah blah gemspec warnings ...]
    Successfully installed bundler-0.9.5
    % cd /tmp
    % ruby -v
    ruby 1.9.2dev (2010-02-03 trunk 26544) [x86_64-darwin10.2.0]
    % rails -v
    Rails 3.0.0.beta
    % rails myapp
    % cd myapp
    % rc
    Loading development environment (Rails 3.0.0.beta)
    irb(main):001:0> exit
    % rs
    => Booting WEBrick
    => Rails 3.0.0.beta application starting in development on http://0.0.0.0:3000
    

    February 11th, 2010 @ 10:23 PM

  8. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM