Class: Hastie::ReportUpdater

Inherits:
ServerReader show all
Defined in:
lib/hastie/report_updater.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ServerReader

#get_server_config, #read_config_file, source_root

Class Method Details



8
9
10
# File 'lib/hastie/report_updater.rb', line 8

def self.banner
  "hastie update <REPORT_DIR> <OPTIONS>"
end

Instance Method Details

#fetch_static_filesObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/hastie/report_updater.rb', line 29

def fetch_static_files
  options[:server]["static"] ||= []
  options[:server]["static"].each do |static_file|
    static_path = File.join(options[:server_root], static_file)
    if File.exists? static_path
      say_status "copy", "#{static_path} to #{File.basename(destination_root)}"
      FileUtils.cp_r static_path, self.destination_root
    end
  end
end

#read_report_fileObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/hastie/report_updater.rb', line 15

def read_report_file
  self.destination_root = name
  report_config_file = File.join(self.destination_root, Hastie.report_config_name)
  if !File.exists? report_config_file
    say "Cannot locate #{Hastie.report_config_name}."
    say "Report directory does not contain report"
    say "#{File.expand_path(self.destination_root)}"
    exit(1)
  end
  # we get the report filename from this config file
  local_config = ConfigFile.load(report_config_file, :local)
  self.options = local_config.merge(self.options)
end