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
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rubypitaya/core/application_files_importer.rb', line 22 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(is_cheats_enabled) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rubypitaya/core/application_files_importer.rb', line 7 def import(is_cheats_enabled) 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_files = Gem.find_files(app_files_path) gem_files = gem_files.select { |a| !a[/.+_cheats.rb/] && !a[/.+_cheat.rb/] } unless is_cheats_enabled Gem.find_files(app_files_path).each do |path| require path unless path.include?('app/migrations') end end end |