Projects

Ticket #406 (closed defect: fixed)

Opened 2 years ago

Last modified 14 months ago

Can't load gem grit.

Reported by: hungerandthirst@… Owned by: lsansonetti@…
Priority: blocker Milestone: MacRuby 0.7
Component: MacRuby Keywords: rubygems, grit, gems
Cc: kayla.rosebud@…

Description

Sorry to be so specific about not being able to load a specific gem. I do this:

require 'rubygems'
require 'grit'
include Grit

and get

in `require:': undefined method `[]' for nil:NilClass (NoMethodError).

It seems to be coming from the

require 'rubygems'

inside of grit.rb. If I disable this line, it includes it with the following warnings:

unknown: warning: already initialized constant VERSION
unknown: warning: already initialized constant MEDIA_TYPE_RE
unknown: warning: already initialized constant UNREG_RE
unknown: warning: already initialized constant ENCODING_RE
unknown: warning: already initialized constant PLATFORM_RE
unknown: warning: already initialized constant SIGNATURES
unknown: warning: already initialized constant IANA_URL
unknown: warning: already initialized constant RFC_URL
unknown: warning: already initialized constant DRAFT_URL
unknown: warning: already initialized constant LTSW_URL
unknown: warning: already initialized constant CONTACT_URL
unknown: warning: can't register `extensions' as an KVO setter on class `MIME::Type' (method `setExtensions:')
unknown: warning: can't register `encoding' as an KVO setter on class `MIME::Type' (method `setEncoding:')
unknown: warning: can't register `system' as an KVO setter on class `MIME::Type' (method `setSystem:')
unknown: warning: can't register `obsolete' as an KVO setter on class `MIME::Type' (method `setObsolete:')
unknown: warning: can't register `docs' as an KVO setter on class `MIME::Type' (method `setDocs:')
unknown: warning: can't register `url' as an KVO setter on class `MIME::Type' (method `setUrl:')
unknown: warning: can't register `registered' as an KVO setter on class `MIME::Type' (method `setRegistered:')
unknown: warning: already initialized constant VERSION

Change History

follow-up: ↓ 2   Changed 22 months ago by kayla.rosebud@…

  • cc kayla.rosebud@… added

Cc Me!

in reply to: ↑ 1 ; follow-up: ↓ 3   Changed 22 months ago by kayla.rosebud@…

Replying to kayla.rosebud@…:

Cc Me!

I recently upgraded to MacRuby 0.6 hoping it would fix this issue.

When I attempt to load the grit gem in macirb:

$ require "rubygems"
$ require "grit"

Results in:

"no such file to load -- grit"

but if I

$ require "grit"

again, I get:

unknown: warning: already initialized constant VERSION
unknown: warning: already initialized constant MEDIA_TYPE_RE
unknown: warning: already initialized constant UNREG_RE
unknown: warning: already initialized constant ENCODING_RE
unknown: warning: already initialized constant PLATFORM_RE
unknown: warning: already initialized constant SIGNATURES
unknown: warning: already initialized constant IANA_URL
unknown: warning: already initialized constant RFC_URL
unknown: warning: already initialized constant DRAFT_URL
unknown: warning: already initialized constant LTSW_URL
unknown: warning: already initialized constant CONTACT_URL
unknown: warning: already initialized constant VERSION
/usr/local/lib/ruby/gems/1.9.1/gems/grit-2.0.0/lib/grit/git-ruby/internal/loose.rb:45: regexp `\0 'compilation error: U_REGEX_BAD_ESCAPE_SEQUENCE
SyntaxError: compile error
	from /Developer/Examples/Ruby/MacRuby/(irb):3:in `<main>'

And if I try to require grit in a MacRuby project I get the same:

undefined method `[]' for nil:NilClass (NoMethodError)

Possibly related?:  http://www.mail-archive.com/macruby-devel@lists.macosforge.org/msg01855.html

$macgem env
  - RUBYGEMS VERSION: 1.3.6
  - RUBY VERSION: 1.9.0 (2008-06-03 patchlevel 0) [universal-darwin10.0]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1:/opt/local/lib/ruby/gems/1.9.1
  - RUBYGEMS PREFIX: /Developer/Examples/Ruby/MacRuby
  - RUBY EXECUTABLE: /Library/Frameworks/MacRuby.framework/Versions/0.6/usr/bin/macruby
  - EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/1.9.1:/opt/local/lib/ruby/gems/1.9.1/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-10
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/1.9.1:/opt/local/lib/ruby/gems/1.9.1
     - /usr/local/lib/ruby/gems/1.9.1
     - /opt/local/lib/ruby/gems/1.9.1
     - /Users/RoseDev/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org/", "http://gems.github.com/", "http://gems.github.com/"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gems.github.com/
     - http://gems.github.com/

Any tips on how I might go about debugging this? It's driving me crazy.

in reply to: ↑ 2   Changed 21 months ago by kayla.rosebud@…

Replying to kayla.rosebud@…:

Replying to kayla.rosebud@…:

Cc Me!

Basically the work around I found for this on MacRuby 0.6 on SL:

require "rubygems"
require "grit" rescue p "Errors occurred while trying to load Grit"
require "grit" rescue p "Errors occurred the 2nd time too!!!"

The second require shows "unknown: warning: already initialized constant *" warnings, but the Grit gem is loaded, and should be available after the second require statement.

  Changed 20 months ago by martinlagardette@…

  • milestone changed from MacRuby 0.5 to MacRuby 0.7

Could you try with trunk? Here's what I get:

$> macruby -r rubygems -r grit -e 'include Grit'
$>

Seems to work without warnings ;-)

  Changed 14 months ago by vincent.isambart@…

  • status changed from new to closed
  • resolution set to fixed

There has been so response for 6 months and is still seems to work fine so closing.

Note: See TracTickets for help on using tickets.