Class: RubyPitaya::ApplicationFilesImporter
- Inherits:
-
Object
- Object
- RubyPitaya::ApplicationFilesImporter
- Defined in:
- lib/rubypitaya/core/application_files_importer.rb
Instance Method Summary collapse
Instance Method Details
#auto_reload ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rubypitaya/core/application_files_importer.rb', line 17 def auto_reload require 'listen' app_folder_paths = [Path::Core::APP_FOLDER_PATH, Path::APP_FOLDER_PATH] app_files_listener = Listen.to(*app_folder_paths, only: /\.rb$/, force_polling: true, latency: 0.25, wait_for_delay: 0.1) do |modified, added, removed| import_added_files(added) reload_modified_files(modified) end app_files_listener.start end |
#import ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/rubypitaya/core/application_files_importer.rb', line 7 def import app_folder_paths = Path::Plugins::APP_FOLDER_PATHS + [Path::Core::APP_FOLDER_PATH, Path::APP_FOLDER_PATH] app_folder_paths.each do |app_folder_path| app_files_path = "#{app_folder_path}/**/*.rb" Gem.find_files(app_files_path).each { |path| require path } end end |