Class: Pike::DSL::Environment
- Inherits:
-
Object
- Object
- Pike::DSL::Environment
- Defined in:
- lib/pike/dsl/environment.rb
Class Method Summary collapse
-
.load(env, &block) ⇒ Object
Executes a block with DSL commands.
Instance Method Summary collapse
-
#get(key) ⇒ Object
DSL command to get the value of a variable.
-
#lifecycle(&block) ⇒ Object
DSL command to define the lifecycle.
- #load(env = nil, &block) ⇒ Object
-
#run(name, params = {}) ⇒ Object
DSL command to add a task to the lifecycle.
-
#var(vars = {}) ⇒ Object
DSL command to set variables.
Class Method Details
.load(env, &block) ⇒ Object
Executes a block with DSL commands
8 9 10 11 12 |
# File 'lib/pike/dsl/environment.rb', line 8 def self.load(env, &block) dsl = new dsl.load env, &block dsl end |
Instance Method Details
#get(key) ⇒ Object
DSL command to get the value of a variable
51 52 53 |
# File 'lib/pike/dsl/environment.rb', line 51 def get(key) @env.get_var vars end |
#lifecycle(&block) ⇒ Object
DSL command to define the lifecycle
24 25 26 |
# File 'lib/pike/dsl/environment.rb', line 24 def lifecycle(&block) load &block end |
#load(env = nil, &block) ⇒ Object
14 15 16 17 |
# File 'lib/pike/dsl/environment.rb', line 14 def load(env = nil, &block) @env = env if env instance_eval &block end |
#run(name, params = {}) ⇒ Object
DSL command to add a task to the lifecycle
33 34 35 |
# File 'lib/pike/dsl/environment.rb', line 33 def run(name, params = {}) @env.add_task name, params end |
#var(vars = {}) ⇒ Object
DSL command to set variables
42 43 44 |
# File 'lib/pike/dsl/environment.rb', line 42 def var(vars = {}) @env.set_var vars end |