Class: CM::Plugin::Sequence
- Inherits:
-
Object
- Object
- CM::Plugin::Sequence
- Defined in:
- lib/core/plugin/sequence.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#forward(operation) ⇒ Object
—————————————————————————– Operations.
-
#id ⇒ Object
—.
-
#init_resources ⇒ Object
—.
-
#initialized?(options = {}) ⇒ Boolean
—————————————————————————– Checks.
-
#normalize(reload) ⇒ Object
—————————————————————————– Plugin interface.
-
#plan ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#quit ⇒ Object
—.
- #quit=(quit) ⇒ Object
-
#resources ⇒ Object
—.
- #resources=(resources) ⇒ Object
-
#reverse(operation) ⇒ Object
—.
-
#settings ⇒ Object
—.
Class Method Details
.register_ids ⇒ Object
6 7 8 |
# File 'lib/core/plugin/sequence.rb', line 6 def self.register_ids [ :id ] end |
Instance Method Details
#forward(operation) ⇒ Object
Operations
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/core/plugin/sequence.rb', line 90 def forward(operation) if initialized? myself.status = code.success success = true success = yield(success) if block_given? else success = false end myself.status = code.sequence_failed unless success success end |
#id ⇒ Object
73 74 75 |
# File 'lib/core/plugin/sequence.rb', line 73 def id get(:id).to_sym end |
#init_resources ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/core/plugin/sequence.rb', line 26 def init_resources @resources = [] get_array(:resources).each do |resource_config| resource_config = Nucleon::Config.ensure(resource_config) if resource_config.has_key?(:aggregate) # Array @resources << plan.create_batch(resource_config[:aggregate]) else # Atomic @resources << plan.create_resource(resource_config) end end @resources end |
#initialized?(options = {}) ⇒ Boolean
Checks
43 44 45 |
# File 'lib/core/plugin/sequence.rb', line 43 def initialized?( = {}) !@resources.empty? end |
#normalize(reload) ⇒ Object
Plugin interface
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/core/plugin/sequence.rb', line 13 def normalize(reload) super codes :sequence_failed @plan = delete(:plan, nil) unless reload init_resources yield if block_given? end |
#plan ⇒ Object
Property accessors / modifiers
50 51 52 |
# File 'lib/core/plugin/sequence.rb', line 50 def plan @plan end |
#quit ⇒ Object
79 80 81 |
# File 'lib/core/plugin/sequence.rb', line 79 def quit @quit end |
#quit=(quit) ⇒ Object
83 84 85 |
# File 'lib/core/plugin/sequence.rb', line 83 def quit=quit @quit = quit end |
#resources ⇒ Object
62 63 64 |
# File 'lib/core/plugin/sequence.rb', line 62 def resources @resources end |
#resources=(resources) ⇒ Object
66 67 68 69 |
# File 'lib/core/plugin/sequence.rb', line 66 def resources=resources set(:resources, Nucleon::Util::Data.array(resources)) init_resources end |
#reverse(operation) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/core/plugin/sequence.rb', line 105 def reverse(operation) if initialized? myself.status = code.success success = true success = yield(success) if block_given? else success = false end myself.status = code.sequence_failed unless success success end |
#settings ⇒ Object
56 57 58 |
# File 'lib/core/plugin/sequence.rb', line 56 def settings plan.manifest_config end |