Sha256: c603ebd16e0d21bf92999518aeed3c7519659e106c6cee9df23da4a83ca1a70b

Contents?: true

Size: 625 Bytes

Versions: 5

Compression:

Stored size: 625 Bytes

Contents

class Command < ActiveRecord::Base
  acts_as_list :scope => :task
  belongs_to :task

  validates_presence_of :command
  
  delegate :project, :to => :task
  
  class TaskCommandAlreadyRunning < Exception ; end
  
  def execute
    raise TaskCommandAlreadyRunning if reload[:started_at]
    
    update_attributes(:started_at => Time.current)
    
    run(command)
    return reload["exit_status"]
  rescue => e
    reload
    output = "#{output}\n#{e.to_s}\n #{e.backtrace.join("\n")}"
    return 100
  ensure
    ActiveRecord::Base.connection.reconnect!
    update_attribute(:ended_at, Time.current)
  end
  
  

  
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ginst-2009.12.8 app/models/command.rb
ginst-2009.11.24 app/models/command.rb
ginst-2009.11.23 app/models/command.rb
ginst-2.0.1 app/models/command.rb
ginst-2.0.0 app/models/command.rb