lib/rcoli/utils.rb in rcoli-0.6.7 vs lib/rcoli/utils.rb in rcoli-0.6.8
- old
+ new
@@ -7,14 +7,14 @@
class ApplicationContext
include Singleton
attr_accessor :debug
- attr_accessor :modedev
+ attr_accessor :devmode
def initialize
- @modedev = false
+ @devmode = false
end
end
class Log
@@ -75,11 +75,11 @@
# cmnd = cmnd.sub(m[0], context) if context.is_a? String
# end
log.debug("EXEC: #{cmnd}")
- system(cmnd) unless ApplicationContext.instance.modedev
+ system(cmnd) unless ApplicationContext.instance.devmode
else
raise ApplicationError, "The command #{command} isn't configured. Check the file #{@source}"
end
end
@@ -89,18 +89,22 @@
def log
RCoLi::Log.instance.logger
end
+def dev_mode?
+ RCoLi::ApplicationContext.instance.devmode
+end
+
def sysexec(command, *args)
halt_on_error = false
args.each do |arg|
if arg.is_a?(Hash)
halt_on_error = arg['halt_on_error'] if arg.has_key?('halt_on_error')
end
end
retval = RCoLi::SystemExecutor.instance.execute(command, args[0])
- if (!RCoLi::ApplicationContext.instance.modedev and halt_on_error and retval != true)
+ if (!RCoLi::ApplicationContext.instance.devmode and halt_on_error and retval != true)
Kernel::exit(1)
end
retval
end