Class: Posgra::CLI::Role
- Inherits:
-
Thor
- Object
- Thor
- Posgra::CLI::Role
- Includes:
- Helper, Logger::Helper
- Defined in:
- lib/posgra/cli/role.rb
Constant Summary
Constants included from Helper
Instance Method Summary collapse
Methods included from Logger::Helper
Methods included from Helper
Instance Method Details
#apply(file) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/posgra/cli/role.rb', line 10 def apply(file) check_fileanem(file) updated = client.apply_roles(file) unless updated Posgra::Logger.instance.info('No change'.intense_blue) end end |
#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 |