I have a RubyMotion project that should load certain directories and files before others.
I want to load the /lib directory files before the /app directory files.
Studies have shown many ways to customize boot order, but there was no final IMHO response.
Here is what I have found so far.
To set the download order of application files, use the Rakefile application installation block:
Motion::Project::App.setup do |app|
To select directories:
app.files = Dir.glob('./lib/**/*.rb') | Dir.glob('./app/**/*.rb')
To use dependencies:
app.files_dependencies \ 'app/child.rb' => 'lib/parent.rb'
To add files to the top of the download order, in front of the stones:
app.files.unshift \ Dir.glob('./lib/**/*.rb')
To use BubbleWrap gem:
BW.require './lib/**/*.rb'
To use the movement dependency gain:
app.files = Dir.glob('./lib/**/*.rb') | Dir.glob('./app/**/*.rb') app.files_dependencies Motion::Dependencies.find_dependencies(app.files)
Downloading the provider package files first, then library files, and then everything else - this seems like the best solution for me so far.
app.files = ( app.files.select{|f| f =~ %r(/vendor/bundle/) } + app.files.select{|f| f =~ %r(/lib/) } + app.files ).uniq
Is there a better way that is better?