class Stubby::Extensions::Reload
Public Instance Methods
restore!()
click to toggle source
# File lib/stubby/extensions/reload.rb, line 22 def restore! end
run!(session, options)
click to toggle source
# File lib/stubby/extensions/reload.rb, line 6 def run!(session, options) @options = options @session = session return if @options[:reload] == false listener.start sleep 1 while @listener puts 'run! done' end
stop!()
click to toggle source
# File lib/stubby/extensions/reload.rb, line 16 def stop! return if @options[:reload] == false @listener.stop and @listener = nil if @listener puts 'stop! done' end
Private Instance Methods
listener()
click to toggle source
# File lib/stubby/extensions/reload.rb, line 35 def listener return @listener if @listener puts "NEW LISTENER" @listener ||= Listen.to(root_path, debug: true) do |modified, added, removed| (modified + added).each do |mpath| puts "[INFO] Detected change, test identical #{mpath}" if File.identical?(session_config_path, mpath) puts "[INFO] Detected config change, reloading #{mpath}..." @session.system.reload end end end end
root_path()
click to toggle source
# File lib/stubby/extensions/reload.rb, line 27 def root_path @session.system.root_path end
session_config_path()
click to toggle source
# File lib/stubby/extensions/reload.rb, line 31 def session_config_path @session.system.session_config_path end