Sha256: bac1fb78ba532f3c902ab3feb6e6a2a27fcdf066ceca0fcb61f4f8411f864a2e

Contents?: true

Size: 805 Bytes

Versions: 2

Compression:

Stored size: 805 Bytes

Contents

class Posgra::CLI::Role < Thor
  include Posgra::CLI::Helper
  include Posgra::Logger::Helper

  class_option :'include-role'
  class_option :'exclude-role'
  class_option :'password-length'

  desc 'apply FILE', 'Apply roles'
  option :'dry-run', :type => :boolean, :default => false
  def apply(file)
    check_fileanem(file)
    updated = client.apply_roles(file)

    unless updated
      Posgra::Logger.instance.info('No change'.intense_blue)
    end
  end

  desc 'export [FILE]', 'Export roles'
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
posgra-0.2.3.beta lib/posgra/cli/role.rb
posgra-0.2.2 lib/posgra/cli/role.rb