class Orchparty::Plugin::DockerComposeV1

Public Class Methods

define_flags(c) click to toggle source
# File lib/orchparty/plugins/docker_compose_v1.rb, line 9
def self.define_flags(c)
  c.flag [:output,:o], :desc => 'Set the output file'
end
desc() click to toggle source
# File lib/orchparty/plugins/docker_compose_v1.rb, line 5
def self.desc
  "generate docker-compose v1 file"
end
generate(ast, options) click to toggle source
# File lib/orchparty/plugins/docker_compose_v1.rb, line 13
def self.generate(ast, options)
  output = output(ast)
  if options[:output]
    File.write(options[:output], output)
  else
    puts output
  end
end
output(ast) click to toggle source
# File lib/orchparty/plugins/docker_compose_v1.rb, line 22
def self.output(ast)
  ast.services.map do |name, service|
    service = service.to_h
    service.delete(:mix)
    [service.delete(:name), HashUtils.deep_stringify_keys(service.to_h)]
  end.to_h.to_yaml(line_width: -1)
end