Add a new class for run control file evaluation

This commit is contained in:
Thibault Jouan
2015-04-14 05:12:42 +00:00
parent 66c1b78740
commit b1aa430ef3
5 changed files with 79 additions and 19 deletions
+1
View File
@@ -7,6 +7,7 @@ require 'uh/wm/cli'
require 'uh/wm/dispatcher'
require 'uh/wm/env'
require 'uh/wm/manager'
require 'uh/wm/run_control'
require 'uh/wm/runner'
module Uh
+21
View 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
+1 -2
View File
@@ -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