elanthia-online / norn.rb

a modern replacement for lich.rb
MIT License
2 stars 3 forks source link

Fresh checkout cannot resolve GameObj #1

Closed jasedit closed 7 years ago

jasedit commented 7 years ago

I just made a fresh checkout, then ran:

  1. bin/setup
  2. rake spec

and receive a bunch of errors in the following fashion:

An error occurred while loading ./spec/game/game_spec.rb.
Failure/Error:
  class Hand < GameObj
    Empty   = Hand.new(:empty, :empty, :empty)
    @@store = MemoryStore.new

    def self.fetch(*args)
      @@store.fetch *args
    end

    def self.put(*args)
      @@store.put *args

NameError:
  uninitialized constant GameObj
# ./lib/norn/world/hand.rb:4:in `<top (required)>'
# ./lib/norn/parser/parser.rb:4:in `require'
# ./lib/norn/parser/parser.rb:4:in `block in <top (required)>'
# ./lib/norn/parser/parser.rb:4:in `each'
# ./lib/norn/parser/parser.rb:4:in `<top (required)>'
# ./lib/norn/world/gameobj.rb:1:in `require'
# ./lib/norn/world/gameobj.rb:1:in `<top (required)>'
# ./lib/norn/script/script.rb:3:in `require'
# ./lib/norn/script/script.rb:3:in `block in <top (required)>'
# ./lib/norn/script/script.rb:3:in `each'
# ./lib/norn/script/script.rb:3:in `<top (required)>'
# ./lib/norn/script/exec.rb:2:in `require'
# ./lib/norn/script/exec.rb:2:in `<top (required)>'
# ./lib/norn/game/game.rb:4:in `require'
# ./lib/norn/game/game.rb:4:in `<top (required)>'
# ./lib/norn.rb:5:in `require'
# ./lib/norn.rb:5:in `block in <top (required)>'
# ./lib/norn.rb:5:in `each'
# ./lib/norn.rb:5:in `<top (required)>'
# ./spec/spec_helper.rb:4:in `require'
# ./spec/spec_helper.rb:4:in `<top (required)>'
# ./spec/game/game_spec.rb:3:in `<top (required)>'

from what I can tell, it looks like there's a circular sequence of dependencies, in that GameObj requires the parser, and the parser requires GameObj, but I'm not 100% certain that's the actual issue. I can report that nothing can be loaded safely - even attempting to execute require "norn/world/gameobj" produces errors aboutGameObj` being uninitialized.

ondreian commented 7 years ago

thanks. this should be fixed now. though there are likely still failing tests currently. the Parser is still a bit of a WIP with all the edge cases.

jasedit commented 7 years ago

I'm still getting this error with the latest version, even after re-running bin/setup - is there something else I need to do to resolve this? I've also tried running bin/console to test things working without the tests

ondreian commented 7 years ago

hmm, travis & appveyor still seem to have issues with it. Cannot reproduce locally however.

jasedit commented 7 years ago

Could there be some earlier version tucked away elsewhere providing these classes? Or some alteration to the ruby path that needs to be done?

ondreian commented 7 years ago

try with the newest commit?

The circular deps issue seems to be fixed on CI (and so I think it is likely to be fixed on your machine to)

Odd that my version of Ruby didn't bat an eye at it.

jasedit commented 7 years ago

Works for me now