Closed dunghopper closed 10 years ago
Awesome issue explanation. Seems like you've found the fix already. Would you like to submit a pull request and get the commit credit?
Yeah, I can make a pull request if you think this is the right fix.
Though I'm still curious why app.detect_dependencies = true
doesn't seem to be working... any ideas?
It's not perfect by any means. It works best when you follow a very simple structure (e.g. limit nested module/classes, don't re-open classes, etc).
Some libraries actually turn detect_dependencies
off (for example, motion_support) and that screws with things too.
It's been a thorn in my side for a long time. I like the dependency detector but there are certainly limitations that we have to work around.
I am using ProMotion 2.0.1 and Promotion-menu 1.0.0.beta1, and RubyMotion 2.37
Despite setting
app.detect_dependencies = true
explicitly in my Rakefile (though I understand this is the default behavior, so that should be unnecessary), someProMotion-menu
files are still being loaded after my code inapp
, causinguninitialized constant
errors.Browsing through the source code, I noticed that
insert_point
is not actually used inProMotion-menu.rb
(extracted starting at line 9):Changing this code as follows, to match more closely that in the
ProMotion
gem, works (at least in my case) to load all the files in the right order:It seems like this careful insertion into files should be unnecessary if
detect_dependencies
were doing its job, but I'm not clear on just how (or when)detect_dependencies
does it's magic.It's worth noting that the
ProMotion
gem also sets a bunch offiles_dependencies
explicitly, with the comment:I don't know if something like that is also necessary here.