RubyMotion application file upload order: how to load lib files before other files?

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| # ... put your code here end 

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?

+5
source share
1 answer

An old question, but I think your final decision looks prettier. I also like DBT , but I usually use it only on gems.

+1
source

Source: https://habr.com/ru/post/1200062/


All Articles