Method: Posgra::CLI::Role#export

Defined in:
lib/posgra/cli/role.rb

#export(file = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/posgra/cli/role.rb', line 20

def export(file = nil)
  check_fileanem(file)
  dsl = client.export_roles

  if file.nil? or file == '-'
    puts dsl
  else
    log(:info, "Export Roles to `#{file}`")

    open(file, 'wb') do |f|
      f.puts Posgra::CLI::MAGIC_COMMENT
      f.puts dsl
    end
  end
end