Add a new class for run control file evaluation
This commit is contained in:
@@ -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
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