Sha256: 99d68388af6b00a34adff7138624216bd960f747014db7111feb958fa714dc06

Contents?: true

Size: 892 Bytes

Versions: 3

Compression:

Stored size: 892 Bytes

Contents

class TasksController < ApplicationController
  layout 'projects'
  before_filter :load_project
  
  
  def index
    if Task.valid_scopes.include?(params[:scope].try(:to_sym))
      scope = @project.tasks
      if params[:scope] && Task.valid_scopes.include?(params[:scope].to_sym)
        scope = scope.send(params[:scope].to_sym)
      end
    
      @tasks = scope.all(:order => 'ended_at DESC')
    else
      redirect_to :scope => 'prepared'
    end
  end
  
  def update
    @task = @project.tasks.find(params[:id])
    
    if params[:kill]
      Rails.logger.info("Sending SIG#{params[:kill]} to process #{@task.pid}")
      @task.kill(params[:kill])
    end
    redirect_to :back
  end
  
  def show
    @task = @project.tasks.find(params[:id])
    
    respond_to do |wants|
      wants.html
      wants.js 
      wants.text { render :text => @task.output}
    end
  end
  
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ginst-2009.12.8 app/controllers/tasks_controller.rb
ginst-2009.11.24 app/controllers/tasks_controller.rb
ginst-2009.11.23 app/controllers/tasks_controller.rb