Last Updated: February 25, 2016
· wilhelmbot

Load order of dependencies in RubyMotion

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

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 --

over 1 year ago ·