Last Updated: February 25, 2016
·
1.297K
· wilhelmbot

Load order of dependencies in RubyMotion

This post suggests a way to change the order of directories inside your RubyMotion project:

http://dylanmarkow.com/blog/2012/05/06/load-order-with-rubymotion/

In lieu of enumerating all the directories again (and miss one), you could just move your lib directory to the top of the app.files array.

Unshift is your friend.

app.files.unshift Dir.glob(File.join(app.project_dir, 'app/lib/**/*.rb'))

It's fun if your module is vendor-free.

2 Responses
Add your response

But wouldn't this place your files before all of the bundled gem files? The ideal order would be gems first, then your preloaded files, then the app directory.

over 1 year ago ·

Here's how I'm loading gem files first, then lib files, then app files. Advice appreciated -- http://stackoverflow.com/questions/25253178/rubymotion-app-files-load-order-how-to-load-lib-files-before-other-files

over 1 year ago ·