Sha256: ce53b1b98c33dc7387817bce240a0ed7a089a784825f7b97c430c9d509e1541d
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
require 'rubypitaya/core/path' module RubyPitaya class ApplicationFilesImporter def import @app_folder_paths = [Path::Core::APP_FOLDER_PATH, Path::APP_FOLDER_PATH] + Path::Plugins::APP_FOLDER_PATHS @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 def auto_reload require 'listen' @app_folder_paths.each do |app_folder_path| @app_files_listener = Listen.to(app_folder_path, only: /\.rb$/) do |modified, added, removed| import_added_files(added) reload_modified_files(modified) end @app_files_listener.start end end private def import_added_files(files_path) Gem.find_files(files_path).each do |path| require path puts "ADDED ruby file: #{path}" end rescue Exception => error puts "ERROR: #{error}" puts error.backtrace end def reload_modified_files(files_path) files_path.each do |path| load(path) puts "MODIFIED ruby file: #{path}" end rescue Exception => error puts "ERROR: #{error}" puts error.backtrace end end end
Version data entries
3 entries across 3 versions & 1 rubygems