Class: Fum::Lang::Stage
- Inherits:
-
Object
- Object
- Fum::Lang::Stage
- Defined in:
- lib/fum/lang/stage.rb
Instance Attribute Summary collapse
-
#env_description ⇒ Object
Returns the value of attribute env_description.
-
#environment_name ⇒ Object
Returns the value of attribute environment_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#solution_stack_name ⇒ Object
Returns the value of attribute solution_stack_name.
-
#swap_cnames ⇒ Object
Returns the value of attribute swap_cnames.
-
#template_name ⇒ Object
Returns the value of attribute template_name.
-
#version_label ⇒ Object
Returns the value of attribute version_label.
-
#zones ⇒ Object
Returns the value of attribute zones.
Instance Method Summary collapse
- #cname_prefix(name, opts = {}) ⇒ Object
- #description(value) ⇒ Object
-
#initialize(id, &block) ⇒ Stage
constructor
A new instance of Stage.
- #matcher(arg) ⇒ Object
-
#matches?(env) ⇒ Boolean
Returns true if environment matches the matcher for this stage.
- #name(arg) ⇒ Object
- #solution_stack(name, &block) ⇒ Object
- #template(arg, &block) ⇒ Object
- #timestamp_name(prefix) ⇒ Object
- #timestamp_name_matcher(prefix) ⇒ Object
- #version(arg) ⇒ Object
- #zone(*args, &block) ⇒ Object
Constructor Details
#initialize(id, &block) ⇒ Stage
Returns a new instance of Stage.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fum/lang/stage.rb', line 10 def initialize(id, &block) @zones = [] @environment_name = id.to_s @id = id.to_s @swap_cnames = false if block_given? if block.arity == 1 yield self else instance_eval &block end end end |
Instance Attribute Details
#env_description ⇒ Object
Returns the value of attribute env_description.
8 9 10 |
# File 'lib/fum/lang/stage.rb', line 8 def env_description @env_description end |
#environment_name ⇒ Object
Returns the value of attribute environment_name.
7 8 9 |
# File 'lib/fum/lang/stage.rb', line 7 def environment_name @environment_name end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/fum/lang/stage.rb', line 7 def id @id end |
#solution_stack_name ⇒ Object
Returns the value of attribute solution_stack_name.
7 8 9 |
# File 'lib/fum/lang/stage.rb', line 7 def solution_stack_name @solution_stack_name end |
#swap_cnames ⇒ Object
Returns the value of attribute swap_cnames.
7 8 9 |
# File 'lib/fum/lang/stage.rb', line 7 def swap_cnames @swap_cnames end |
#template_name ⇒ Object
Returns the value of attribute template_name.
7 8 9 |
# File 'lib/fum/lang/stage.rb', line 7 def template_name @template_name end |
#version_label ⇒ Object
Returns the value of attribute version_label.
7 8 9 |
# File 'lib/fum/lang/stage.rb', line 7 def version_label @version_label end |
#zones ⇒ Object
Returns the value of attribute zones.
7 8 9 |
# File 'lib/fum/lang/stage.rb', line 7 def zones @zones end |
Instance Method Details
#cname_prefix(name, opts = {}) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/fum/lang/stage.rb', line 63 def cname_prefix(name, opts = {}) @cname_prefix = name if opts[:swap] @swap_cnames = true end end |
#description(value) ⇒ Object
55 56 57 |
# File 'lib/fum/lang/stage.rb', line 55 def description(value) @env_description = value end |
#matcher(arg) ⇒ Object
47 48 49 |
# File 'lib/fum/lang/stage.rb', line 47 def matcher(arg) @matcher = arg end |
#matches?(env) ⇒ Boolean
Returns true if environment matches the matcher for this stage
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/fum/lang/stage.rb', line 71 def matches?(env) if @matcher if @matcher.is_a?(Regexp) return env.name =~ @matcher else return env.name == @matcher end else return env.name == @environment_name end false end |
#name(arg) ⇒ Object
43 44 45 |
# File 'lib/fum/lang/stage.rb', line 43 def name(arg) @environment_name = arg end |
#solution_stack(name, &block) ⇒ Object
59 60 61 |
# File 'lib/fum/lang/stage.rb', line 59 def solution_stack(name, &block) @solution_stack_name = name end |
#template(arg, &block) ⇒ Object
39 40 41 |
# File 'lib/fum/lang/stage.rb', line 39 def template(arg, &block) @template_name = arg end |
#timestamp_name(prefix) ⇒ Object
25 26 27 28 |
# File 'lib/fum/lang/stage.rb', line 25 def (prefix) raise ArgumentError, "Prefix must be less than 15" unless prefix.length < 15 && prefix.length > 1 return "#{prefix}-#{Time.now.to_i.to_s(16)}" end |
#timestamp_name_matcher(prefix) ⇒ Object
30 31 32 33 |
# File 'lib/fum/lang/stage.rb', line 30 def (prefix) raise ArgumentError, "Prefix must be less than 15" unless prefix.length < 15 && prefix.length > 1 /#{prefix}-[a-z0-9]{8}/ end |
#version(arg) ⇒ Object
51 52 53 |
# File 'lib/fum/lang/stage.rb', line 51 def version(arg) @version_label = arg end |