Class: Kaya::Execution

Inherits:
Object
  • Object
show all
Defined in:
lib/kaya/execution.rb

Class Method Summary collapse

Class Method Details

.run!(execution_request_data) ⇒ Object

Run/Execute the commmand

Parameters:

  • execution_data (Hash)

    { :suite_id, :label }



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/kaya/execution.rb', line 7

def self.run! execution_request_data

  if Kaya::Support::Configuration.use_git?
    Kaya::Support::Git.reset_hard and Kaya::Support::Git.pull
    $K_LOG.debug "Git pulled" if $K_LOG
  end


    result = Kaya::Results::Result.new(execution_request_data)
    $K_LOG.debug "Result created with id => #{result.id}" if $K_LOG

    result_id = result.id
    result.save!

  if execution_request_data["type"] == "cucumber"
    $K_LOG.debug "Execution type: Cucumber" if $K_LOG
    Kaya::Cucumber::Task.run(result)

    $K_LOG.debug "Task started" if $K_LOG

    result_id

  else # ANOTHER TYPE OF EXECUTION
    $K_LOG.debug "Execution type: #{execution_request_data[:type]}" if $K_LOG
    puts "TODO: Another type of execution (no cucumber execution)"

    Time.now.to_i # must return an id number

  end
end