Sha256: b00b20ff7f6376f331e1140f53c6db346882bbdb958b3ae0de1d2575b7d84ef3

Contents?: true

Size: 771 Bytes

Versions: 12

Compression:

Stored size: 771 Bytes

Contents

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

  class_option :'include-role'
  class_option :'exclude-role'

  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

12 entries across 12 versions & 1 rubygems

Version Path
posgra-0.2.1 lib/posgra/cli/role.rb
posgra-0.2.0 lib/posgra/cli/role.rb
posgra-0.1.9 lib/posgra/cli/role.rb
posgra-0.1.8 lib/posgra/cli/role.rb
posgra-0.1.7 lib/posgra/cli/role.rb
posgra-0.1.6 lib/posgra/cli/role.rb
posgra-0.1.5 lib/posgra/cli/role.rb
posgra-0.1.4 lib/posgra/cli/role.rb
posgra-0.1.3 lib/posgra/cli/role.rb
posgra-0.1.2 lib/posgra/cli/role.rb
posgra-0.1.1 lib/posgra/cli/role.rb
posgra-0.1.0 lib/posgra/cli/role.rb