Class: Cfruby::Cfp_Stat
- Inherits:
-
Object
- Object
- Cfruby::Cfp_Stat
- Includes:
- Cfp_ClassAccessor
- Defined in:
- lib/libcfenjin/cfp_stat.rb
Overview
Cfp_Stat
holds the state of the Cfruby engine at runtime. With Cfruby
engine classes it needs to be passed during class initialisation. Scripts can access state through the local @cfp variable.
Instance Attribute Summary collapse
-
#cfp_liblogger ⇒ Object
readonly
Returns the value of attribute cfp_liblogger.
-
#cfp_logger ⇒ Object
readonly
Returns the value of attribute cfp_logger.
-
#classlist ⇒ Object
readonly
Returns the value of attribute classlist.
-
#dry_run ⇒ Object
Returns the value of attribute dry_run.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
-
#packagelist ⇒ Object
readonly
Returns the value of attribute packagelist.
-
#site ⇒ Object
Returns the value of attribute site.
-
#sitepath ⇒ Object
Returns the value of attribute sitepath.
-
#strict ⇒ Object
Returns the value of attribute strict.
-
#usermanager ⇒ Object
readonly
Returns the value of attribute usermanager.
Instance Method Summary collapse
- #distribution ⇒ Object
- #hostname ⇒ Object
-
#initialize(verbose = 0, trace = 0, dry_run = true, quiet_mode = false, strict = false, defines = [], undefines = []) ⇒ Cfp_Stat
constructor
A new instance of Cfp_Stat.
- #osname ⇒ Object
- #showtrace ⇒ Object
Methods included from Cfp_ClassAccessor
#assign, #cfgroup, #dump_classlist, #init_classlist, #isa, #isa?
Constructor Details
#initialize(verbose = 0, trace = 0, dry_run = true, quiet_mode = false, strict = false, defines = [], undefines = []) ⇒ Cfp_Stat
Returns a new instance of Cfp_Stat.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/libcfenjin/cfp_stat.rb', line 26 def initialize verbose=0, trace=0, dry_run=true, quiet_mode=false, strict=false, defines=[], undefines=[] @dry_run = dry_run @strict = strict @site = Hash.new # Set up the main logger @cfp_logger = Cfp_Logger.new self,verbose,trace,dry_run,quiet_mode # Set up the library logger (if not unit testing) @cfp_liblogger = Cfp_LibLogger.new @cfp_logger # ---- Set up flow monitor @logger = @cfp_logger # Only initialize flow monitor when not unit testing begin Test::Unit.class rescue NameError @cfp_controller = Cfp_FlowMonitor.new(@cfp_logger) @cfp_logger.trace TRACE_ALL,'Initialized engine state (Cfp_Stat)' end # ---- Get OS info @os = OS::OSFactory.new.get_os # ---- Get package list if packagemanager = @os.get_package_manager() @packagelist = packagemanager.packages() end # ---- Get user list if usermanager = @os.get_user_manager() @usermanager = usermanager end @classlist = Cfp_ClassList.new defines,undefines end |
Instance Attribute Details
#cfp_liblogger ⇒ Object (readonly)
Returns the value of attribute cfp_liblogger.
20 21 22 |
# File 'lib/libcfenjin/cfp_stat.rb', line 20 def cfp_liblogger @cfp_liblogger end |
#cfp_logger ⇒ Object (readonly)
Returns the value of attribute cfp_logger.
20 21 22 |
# File 'lib/libcfenjin/cfp_stat.rb', line 20 def cfp_logger @cfp_logger end |
#classlist ⇒ Object (readonly)
Returns the value of attribute classlist.
21 22 23 |
# File 'lib/libcfenjin/cfp_stat.rb', line 21 def classlist @classlist end |
#dry_run ⇒ Object
Returns the value of attribute dry_run.
22 23 24 |
# File 'lib/libcfenjin/cfp_stat.rb', line 22 def dry_run @dry_run end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
20 21 22 |
# File 'lib/libcfenjin/cfp_stat.rb', line 20 def os @os end |
#packagelist ⇒ Object (readonly)
Returns the value of attribute packagelist.
20 21 22 |
# File 'lib/libcfenjin/cfp_stat.rb', line 20 def packagelist @packagelist end |
#site ⇒ Object
Returns the value of attribute site.
22 23 24 |
# File 'lib/libcfenjin/cfp_stat.rb', line 22 def site @site end |
#sitepath ⇒ Object
Returns the value of attribute sitepath.
22 23 24 |
# File 'lib/libcfenjin/cfp_stat.rb', line 22 def sitepath @sitepath end |
#strict ⇒ Object
Returns the value of attribute strict.
22 23 24 |
# File 'lib/libcfenjin/cfp_stat.rb', line 22 def strict @strict end |
#usermanager ⇒ Object (readonly)
Returns the value of attribute usermanager.
21 22 23 |
# File 'lib/libcfenjin/cfp_stat.rb', line 21 def usermanager @usermanager end |
Instance Method Details
#distribution ⇒ Object
64 65 66 |
# File 'lib/libcfenjin/cfp_stat.rb', line 64 def distribution @os['distribution'] end |
#hostname ⇒ Object
56 57 58 |
# File 'lib/libcfenjin/cfp_stat.rb', line 56 def hostname @os.hostname end |
#osname ⇒ Object
60 61 62 |
# File 'lib/libcfenjin/cfp_stat.rb', line 60 def osname @os['name'] end |
#showtrace ⇒ Object
68 69 70 71 72 |
# File 'lib/libcfenjin/cfp_stat.rb', line 68 def showtrace @logger.trace TRACE_ON,"Trace=#{@logger.tracelevel}" @logger.trace TRACE_ENGINE,"Verbose=#{@logger.verbose}" @logger.trace TRACE_ENGINE,'Hostname='+hostname end |