Class: Pione::Log::DomainLog
- Inherits:
-
Object
- Object
- Pione::Log::DomainLog
- Includes:
- Sys
- Defined in:
- lib/pione/log/domain-log.rb
Overview
DomainLog is a domain log that records domain inputs and parameters.
Constant Summary collapse
- FILENAME =
".domain.log"
Instance Attribute Summary collapse
-
#domain_location ⇒ Location::BasicLocation
readonly
Domain's location.
-
#record ⇒ Hash{String => String}
readonly
Record table.
Instance Method Summary collapse
-
#initialize(handler) ⇒ DomainLog
constructor
A new instance of DomainLog.
-
#save ⇒ void
Save domain information file.
Constructor Details
#initialize(handler) ⇒ DomainLog
Returns a new instance of DomainLog.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pione/log/domain-log.rb', line 21 def initialize(handler) @domain_location = handler.domain_location @record = { :system_name => Uname.sysname, :system_nodename => Uname.nodename, :system_machine => Uname.machine, :system_version => Uname.version, :system_release => Uname.release, :params => handler.param_set.textize, :inputs => inputs_string(handler.inputs), :domain => handler.domain_id, :domain_location => @domain_location.uri.to_s, :dry_run => handler.dry_run.to_s } if handler.respond_to?(:working_directory) @record[:working_directory] = handler.working_directory.location.uri.to_s end end |
Instance Attribute Details
#domain_location ⇒ Location::BasicLocation (readonly)
Returns domain's location.
13 14 15 |
# File 'lib/pione/log/domain-log.rb', line 13 def domain_location @domain_location end |
#record ⇒ Hash{String => String} (readonly)
Returns record table.
17 18 19 |
# File 'lib/pione/log/domain-log.rb', line 17 def record @record end |
Instance Method Details
#save ⇒ void
This method returns an undefined value.
Save domain information file.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pione/log/domain-log.rb', line 43 def save domain_info_location = @domain_location + FILENAME text = "== %s\n\n" % Time.now text << @record.map{|key, val| "- %s: %s" % [key,val]}.join("\n") text << "\n\n" if domain_info_location.exist? domain_info_location.append(text) else domain_info_location.create(text) end end |