lib/daemon-ogre.rb in daemon-ogre-1.4.5 vs lib/daemon-ogre.rb in daemon-ogre-1.4.6

- old
+ new

@@ -20,18 +20,19 @@ if !arg[:excluded].nil? raise ArgumentError, "Exclude items must be in an "+\ "Array! Example:\n:exclude => ['abc']" if arg[:excluded].class != Array end - arg[:type]= "rb" if arg[:type].nil? + arg[:type]= "rb" if arg[:type].nil? + arg[:monkey_patch]= 0 if arg[:monkey_patch].nil? #============================================================================================================= ### GET Pre path + validation begin #get method callers path - pre_path = caller[1].split('.rb:').first+('.rb') + pre_path = caller[arg[:monkey_patch].to_i].split('.rb:').first+('.rb') separator_symbol= String.new pre_path.include?('/') ? separator_symbol = '/' : separator_symbol = '\\' pre_path= ((pre_path.split(separator_symbol))-([pre_path.split(separator_symbol).pop])).join(separator_symbol) end @@ -111,17 +112,20 @@ end return {:error => error_msg} end - def load_ymls(directory) + def load_ymls(directory,*args) + arg= Hash[*args] require 'yaml' #require "hashie" + arg[:monkey_patch]= 0 if arg[:monkey_patch].nil? + begin - pre_path = caller[1].split('.rb:').first+('.rb') + pre_path = caller[arg[:monkey_patch]].split('.rb:').first+('.rb') separator_symbol= String.new pre_path.include?('/') ? separator_symbol = '/' : separator_symbol = '\\' pre_path= ((pre_path.split(separator_symbol))-([pre_path.split(separator_symbol).pop])).join(separator_symbol) end @@ -513,13 +517,16 @@ begin def process_running?(input) DaemonOgre.process_running?(input) end def require_directory(directory,*args) - DaemonOgre.load_directory(directory,*args) + DaemonOgre.load_directory(directory,{:monkey_patch => 1},*args) end def require_ymls(directory) - DaemonOgre.load_ymls(directory) + DaemonOgre.load_ymls( + directory, + {:monkey_patch => 1} + ) end def get_port(port,max_port=65535 ,host="0.0.0.0") DaemonOgre.get_port(port,max_port,host) end def exlogger(error_msg,*args) \ No newline at end of file