Class: CapUtil::ServerRolesYaml

Inherits:
Object
  • Object
show all
Includes:
CapUtil
Defined in:
lib/cap-util/server_roles_yaml.rb

Overview

the class should be use as a superclass for fetching server roles yaml.

Constant Summary

Constants included from CapUtil

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CapUtil

color, halt, #hostname, included, run_locally, run_locally_with_stdin, say, say_bulleted, say_error, say_raw, say_warning, time

Constructor Details

#initialize(cap, opts = nil) ⇒ ServerRolesYaml

Returns a new instance of ServerRolesYaml.



11
12
13
14
15
16
17
# File 'lib/cap-util/server_roles_yaml.rb', line 11

def initialize(cap, opts = nil)
  opts ||= {}

  @cap    = cap
  @desc   = opts[:desc]   ? "#{opts[:desc]} server roles" : "server roles"
  @source = opts[:source] ? " from #{opts[:source]}" : ""
end

Instance Attribute Details

#descObject (readonly)

Returns the value of attribute desc.



9
10
11
# File 'lib/cap-util/server_roles_yaml.rb', line 9

def desc
  @desc
end

#sourceObject (readonly)

Returns the value of attribute source.



9
10
11
# File 'lib/cap-util/server_roles_yaml.rb', line 9

def source
  @source
end

Instance Method Details

#getObject



19
20
21
22
23
24
# File 'lib/cap-util/server_roles_yaml.rb', line 19

def get
  say "Applying #{color @desc, :bold, :cyan}#{@source}."

  validate
  valid? ? read : halt
end

#readObject

Raises:

  • (NotImplementedError)


28
# File 'lib/cap-util/server_roles_yaml.rb', line 28

def read;     raise NotImplementedError; end

#valid?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


27
# File 'lib/cap-util/server_roles_yaml.rb', line 27

def valid?;   raise NotImplementedError; end

#validateObject

Raises:

  • (NotImplementedError)


26
# File 'lib/cap-util/server_roles_yaml.rb', line 26

def validate; raise NotImplementedError; end