Module: RightConf::ProgressReporter

Included in:
BrewInstaller, Command, Configurator, EnvironmentUpdater, PackageInstaller
Defined in:
lib/rconf/progress_reporter.rb

Overview

Provide progress report methods used by configurators

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Create list of reporters upon inclusion Also setup forwarders

Parameters

base(Object)

Object including this module



22
23
24
25
26
27
28
# File 'lib/rconf/progress_reporter.rb', line 22

def self.included(base)
  @@reporters ||= []
  [ :report_section, :report, :report_check, :report_success,
    :report_failure, :report_error, :report_fatal, :report_result ].each do |meth|
    meta_def(meth) { |*args| @@reporters.each { |r| r.__send__(meth, *args) } }
  end
end

.report_to_file(path) ⇒ Object

Save progress reports to given file

Parameters

path(String)

Path to file where progress reports should be saved

Return

true

Always return true



49
50
51
52
53
# File 'lib/rconf/progress_reporter.rb', line 49

def self.report_to_file(path)
  @@reporters ||= []
  @@reporters << FileReporter.new(path)
  true
end

.report_to_stdoutObject

Print progress reports to stdout, default behavior

Return

true

Always return true



34
35
36
37
38
39
40
# File 'lib/rconf/progress_reporter.rb', line 34

def self.report_to_stdout
  reporter = StdoutReporter.new
  reporter.report("rconf v#{RightConf::VERSION} (c)2011-2013 RightScale")
  @@reporters ||= []
  @@reporters << reporter
  true
end