Class: CapUtil::ServerRolesYaml
- Inherits:
-
Object
- Object
- CapUtil::ServerRolesYaml
- 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
Instance Attribute Summary collapse
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(cap, opts = nil) ⇒ ServerRolesYaml
constructor
A new instance of ServerRolesYaml.
- #read ⇒ Object
- #valid? ⇒ Boolean
- #validate ⇒ Object
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
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
9 10 11 |
# File 'lib/cap-util/server_roles_yaml.rb', line 9 def desc @desc end |
#source ⇒ Object (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
#get ⇒ Object
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 |
#read ⇒ Object
28 |
# File 'lib/cap-util/server_roles_yaml.rb', line 28 def read; raise NotImplementedError; end |
#valid? ⇒ Boolean
27 |
# File 'lib/cap-util/server_roles_yaml.rb', line 27 def valid?; raise NotImplementedError; end |
#validate ⇒ Object
26 |
# File 'lib/cap-util/server_roles_yaml.rb', line 26 def validate; raise NotImplementedError; end |