Add a new class for run control file evaluation
This commit is contained in:
21
lib/uh/wm/run_control.rb
Normal file
21
lib/uh/wm/run_control.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
module Uh
|
||||
module WM
|
||||
class RunControl
|
||||
class << self
|
||||
def evaluate env
|
||||
rc_path = File.expand_path(env.rc_path)
|
||||
rc = new env
|
||||
rc.evaluate File.read(rc_path) if File.exist?(rc_path)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize env
|
||||
@env = env
|
||||
end
|
||||
|
||||
def evaluate code
|
||||
instance_eval code
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@@ -32,8 +32,7 @@ module Uh
|
||||
end
|
||||
|
||||
def evaluate_run_control
|
||||
rc_path = File.expand_path(@env.rc_path)
|
||||
eval File.read(rc_path) if File.exist?(rc_path)
|
||||
RunControl.evaluate(env)
|
||||
end
|
||||
|
||||
def register_event_hooks
|
||||
|
Reference in New Issue
Block a user