Sha256: 4549030299a49f2eb72fb6138f60ae127bf8c1d504574d2e8d8473fde67e9c97
Contents?: true
Size: 1.02 KB
Versions: 16
Compression:
Stored size: 1.02 KB
Contents
require 'rubypitaya/core/path' module RubyPitaya class ApplicationFilesImporter def import app_files_path = "#{Path::APP_FOLDER_PATH}/**/*.rb" Gem.find_files(app_files_path).each { |path| require path } end def auto_reload require 'listen' @app_files_listener = Listen.to(Path::APP_FOLDER_PATH, only: /\.rb$/) do |modified, added, removed| import_added_files(added) reload_modified_files(modified) end @app_files_listener.start 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
16 entries across 16 versions & 1 rubygems