Sha256: 0603f6396eedce1e4c45352938481cf86d0b3439bc247efa31dbdd3320935467
Contents?: true
Size: 992 Bytes
Versions: 13
Compression:
Stored size: 992 Bytes
Contents
require "foreman/export" require "foreman/utils" class Foreman::Export::Base attr_reader :engine def initialize(engine) @engine = engine end def export raise "export method must be overridden" end private ###################################################################### def error(message) raise Foreman::Export::Exception.new(message) end def say(message) puts "[foreman export] %s" % message end def export_template(exporter, file, template_root) if template_root && File.exist?(file_path = File.join(template_root, file)) File.read(file_path) elsif File.exist?(file_path = File.expand_path(File.join("~/.foreman/templates", file))) File.read(file_path) else File.read(File.expand_path("../../../../data/export/#{exporter}/#{file}", __FILE__)) end end def write_file(filename, contents) say "writing: #{filename}" File.open(filename, "w") do |file| file.puts contents end end end
Version data entries
13 entries across 13 versions & 1 rubygems