Class: Vx::Builder::ScriptBuilderV2
- Inherits:
-
Object
- Object
- Vx::Builder::ScriptBuilderV2
- Includes:
- Common::Helper::Middlewares
- Defined in:
- lib/vx/builder/script_builder_v2.rb,
lib/vx/builder/script_builder_v2/go.rb,
lib/vx/builder/script_builder_v2/env.rb,
lib/vx/builder/script_builder_v2/base.rb,
lib/vx/builder/script_builder_v2/java.rb,
lib/vx/builder/script_builder_v2/ruby.rb,
lib/vx/builder/script_builder_v2/rust.rb,
lib/vx/builder/script_builder_v2/cache.rb,
lib/vx/builder/script_builder_v2/clone.rb,
lib/vx/builder/script_builder_v2/scala.rb,
lib/vx/builder/script_builder_v2/deploy.rb,
lib/vx/builder/script_builder_v2/nodejs.rb,
lib/vx/builder/script_builder_v2/python.rb,
lib/vx/builder/script_builder_v2/clojure.rb,
lib/vx/builder/script_builder_v2/defaults.rb,
lib/vx/builder/script_builder_v2/services.rb
Defined Under Namespace
Classes: Base, Cache, Clojure, Clone, Defaults, Deploy, Env, Go, Java, Nodejs, Python, Ruby, Rust, Scala, Services, Stage
Constant Summary collapse
- TEMPLATE_SOURCE =
File.("../templates/script_builder_v2/to_script.erb", __FILE__)
- TEMPLATE =
::ERB.new(File.read(TEMPLATE_SOURCE))
Instance Attribute Summary collapse
-
#cache_key ⇒ Object
readonly
Returns the value of attribute cache_key.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#stages ⇒ Object
readonly
Returns the value of attribute stages.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
Instance Method Summary collapse
- #find_stage(name) ⇒ Object
-
#initialize(task, source) ⇒ ScriptBuilderV2
constructor
A new instance of ScriptBuilderV2.
- #stage(name) ⇒ Object
- #to_hash ⇒ Object
- #to_script ⇒ Object
- #to_yaml ⇒ Object
- #vexor ⇒ Object
Constructor Details
#initialize(task, source) ⇒ ScriptBuilderV2
Returns a new instance of ScriptBuilderV2.
97 98 99 100 101 102 |
# File 'lib/vx/builder/script_builder_v2.rb', line 97 def initialize(task, source) @source = source @task = task @stages = [] @cache_key = [] end |
Instance Attribute Details
#cache_key ⇒ Object (readonly)
Returns the value of attribute cache_key.
95 96 97 |
# File 'lib/vx/builder/script_builder_v2.rb', line 95 def cache_key @cache_key end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
95 96 97 |
# File 'lib/vx/builder/script_builder_v2.rb', line 95 def source @source end |
#stages ⇒ Object (readonly)
Returns the value of attribute stages.
95 96 97 |
# File 'lib/vx/builder/script_builder_v2.rb', line 95 def stages @stages end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
95 96 97 |
# File 'lib/vx/builder/script_builder_v2.rb', line 95 def task @task end |
Instance Method Details
#find_stage(name) ⇒ Object
113 114 115 |
# File 'lib/vx/builder/script_builder_v2.rb', line 113 def find_stage(name) @stages.find{|i| i.name == name } end |
#stage(name) ⇒ Object
104 105 106 107 108 109 110 111 |
# File 'lib/vx/builder/script_builder_v2.rb', line 104 def stage(name) found = find_stage(name) unless found found = Stage.new(name: name) @stages.push found end found end |
#to_hash ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/vx/builder/script_builder_v2.rb', line 124 def to_hash @hash ||= begin call_env ordered = %w{ clone init before_install install database before_script script after_success teardown }.inject([]) do |a, name| if found = find_stage(name) a << found end a end ordered.map(&:to_hash) end end |
#to_script ⇒ Object
117 118 119 120 121 122 |
# File 'lib/vx/builder/script_builder_v2.rb', line 117 def to_script @script ||= begin TEMPLATE.result(binding) end end |
#to_yaml ⇒ Object
142 143 144 |
# File 'lib/vx/builder/script_builder_v2.rb', line 142 def to_yaml to_hash.to_yaml end |
#vexor ⇒ Object
146 147 148 |
# File 'lib/vx/builder/script_builder_v2.rb', line 146 def vexor source.vexor end |