Class: Foreman::Export::Bluepill

Inherits:
Base
  • Object
show all
Defined in:
lib/foreman/export/bluepill.rb

Instance Attribute Summary

Attributes inherited from Base

#app, #concurrency, #engine, #location, #log, #port, #template, #user

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Foreman::Export::Base

Instance Method Details

#exportObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/foreman/export/bluepill.rb', line 6

def export
  error("Must specify a location") unless location

  FileUtils.mkdir_p location

  app = self.app || File.basename(engine.directory)
  user = self.user || app
  log_root = self.log || "/var/log/#{app}"
  template_root = self.template

  Dir["#{location}/#{app}.pill"].each do |file|
    say "cleaning up: #{file}"
    FileUtils.rm(file)
  end

  master_template = export_template("bluepill", "master.pill.erb", template_root)
  master_config   = ERB.new(master_template).result(binding)
  write_file "#{location}/#{app}.pill", master_config
end