clayallsopp / motion-require

Dependency management for RubyMotion, using a pseudo `require`
MIT License
34 stars 5 forks source link

Cannot use `motion_require` in my projects #12

Closed DougPuchalski closed 11 years ago

DougPuchalski commented 11 years ago

Whenever I add motion_require to a file, the compile bombs with:

undefined method `motion_require' for main:TopLevel (NoMethodError)

Does that look familiar?

clayallsopp commented 11 years ago

What's you compile order look like? Is detect_dependencies enabled?

DougPuchalski commented 11 years ago

I'm trying to run rake spec on https://github.com/aceofspades/MotionModel/tree/motion_require. Requiring motion-support pretty early, and detect_dependencies is false.

Results:

2013-05-06 11:24:18.215 MotionModel[45617:c07] undefined method `motion_require' for main:TopLevel (NoMethodError)
2013-05-06 11:24:18.217 MotionModel[45617:c07] *** Terminating app due to uncaught exception 'NoMethodError', reason: 'undefined method `motion_require' for main:TopLevel (NoMethodError)
'
*** First throw call stack:
(0x1ea6012 0x816e7e 0x3a2dc4 0xae95 0x9cdd)
libc++abi.dylib: terminate called throwing an exception
clayallsopp commented 11 years ago

Right, but exactly how early/is ext.rb in the compile order? Does it come before all of the files using motion_require?

clayallsopp commented 11 years ago

Yeah I checked the repo out and motion-require's ext.rb is getting required pretty late:

Compile /Users/clayallsopp/Projects/Motion/MotionModel/motion/adapters/sql/sqlite3_adapter.rr
/Users/clayallsopp/Projects/Motion/MotionModel/motion/adapters/sql/sql_db_adapter.rb
........
/Users/clayallsopp/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/motion-require-0.0.6/motion/ext.rb

this is probably because it's also using motion-support, and motion-require hasn't been tested when being used with multiple libraries. I'll work on it now.

DougPuchalski commented 11 years ago

I got some help from @tkadauke moments ago and pushed to this branch. It's now passing. He made some mods that I did not expect, I'm going to try that in my app now too. Maybe just have a look and :thumbsup: or :thumbsdown: what he's done?

Thanks for the help!

clayallsopp commented 11 years ago

Ohhhh I see, yeah that's all good.

DougPuchalski commented 11 years ago

Is some of that missing in your README?

clayallsopp commented 11 years ago

Good call, I added a small note about it: 455cb6f25b5c8ba3edb05fc79fdfc189e944efc9

As the commit notes, motion-require is sort of an all-or-nothing thing at this point, so using it in conjunction with the traditional app.files << workflow could mess things up.