Class: Pike::DSL::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/pike/dsl/task.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load(task, &block) ⇒ Object

Executes a block with DSL commands



8
9
10
11
12
# File 'lib/pike/dsl/task.rb', line 8

def self.load(task, &block)
  dsl = new
  dsl.load task, &block
  dsl
end

Instance Method Details

#build_rbaObject

DSL command to build the rba file



51
52
53
# File 'lib/pike/dsl/task.rb', line 51

def build_rba
  "!BUILD_RBA"
end

#exec(task) ⇒ Object

DSL command to run another task



42
43
44
# File 'lib/pike/dsl/task.rb', line 42

def exec(task)
  @task.run_tasktask
end

#get(key) ⇒ Object

DSL command to get the value of a variable



69
70
71
# File 'lib/pike/dsl/task.rb', line 69

def get(key)
  @task.get_var key
end

#load(task = nil, &block) ⇒ Object



14
15
16
17
# File 'lib/pike/dsl/task.rb', line 14

def load(task = nil, &block)
  @task = task if task
  instance_eval &block
end

#local(cmd, vars = {}) ⇒ Object

DSL command to run a command on the local machine



33
34
35
# File 'lib/pike/dsl/task.rb', line 33

def local(cmd, vars = {})
  Tasks::Command.new(@task, :local, cmd, vars).run(@task.current_env)
end

#param(key, default = nil) ⇒ Object

DSL command to get the value of a variable



78
79
80
# File 'lib/pike/dsl/task.rb', line 78

def param(key, default = nil)
  @task.get_param key, default
end

#param_given?(key) ⇒ Boolean

DSL command to check if a param is set

Returns:

  • (Boolean)


87
88
89
# File 'lib/pike/dsl/task.rb', line 87

def param_given?(key)
  @task.param_given? key
end

#remote(cmd, vars = {}) ⇒ Object

DSL command to run a command on the remote machine



24
25
26
# File 'lib/pike/dsl/task.rb', line 24

def remote(cmd, vars = {})
  Tasks::Command.new(@task, :remote, cmd, vars).run(@task.current_env)
end

#upload(local, remote) ⇒ Object

DSL command to upload a file from local machine to remote machine



60
61
62
# File 'lib/pike/dsl/task.rb', line 60

def upload(local, remote)
  local "!SCP #{local} #{remote}"
end

#var_given?(key) ⇒ Boolean

DSL command to check if a variable is set

Returns:

  • (Boolean)


96
97
98
# File 'lib/pike/dsl/task.rb', line 96

def var_given?(key)
  @task.var_given? key
end