module Initd::Export

Public Instance Methods

cleanup() click to toggle source
# File lib/initd/export.rb, line 13
def cleanup
  Dir.glob export_path.join("#{app}-*") do |filename|
    filename = Pathname.new(filename)
    contents = File.new(filename, 'r').read
    next unless contents.match(/# Autogenerated by foreman/)
    next if @exported.include? filename
    say 'removing ' + filename.to_s
    remove filename
  end
end
concurrency(name) click to toggle source
# File lib/initd/export.rb, line 34
def concurrency(name)
  engine.formation[name]
end
export_file(path, contents) click to toggle source
# File lib/initd/export.rb, line 28
def export_file (path, contents)
  write_file(path, contents)
  File.chmod(0755, path)
  @exported.push path
end
export_path() click to toggle source
# File lib/initd/export.rb, line 3
def export_path
  Pathname.new(location).expand_path
end
path(name) click to toggle source
# File lib/initd/export.rb, line 38
def path(name)
  export_path.join("#{app}-#{name}")
end
remove(path) click to toggle source
# File lib/initd/export.rb, line 24
def remove path
  File.unlink path
end
setup() click to toggle source
# File lib/initd/export.rb, line 7
def setup
  @exported = []
  say "creating: #{export_path}"
  FileUtils.mkdir_p(export_path)
end