1
0
Fork 0

Runs history

This commit is contained in:
Gregory Eremin 2013-06-07 00:04:41 +04:00
parent 441acca610
commit b97f0c1a12
7 changed files with 40 additions and 3 deletions

View File

@ -0,0 +1,7 @@
module BurdenWeb
class RunsController < ApplicationController
def index
@runs = Burden::Storage.run.where(name: params[:task_id]).order('created_at desc').limit(100)
end
end
end

View File

@ -16,7 +16,11 @@ module BurdenWeb
def run
Rails.application.load_tasks
Rake::Task[params[:id]].invoke
task = Rake::Task[params[:id]]
task.prerequisite_tasks.each{ |t| t.execute(nil) }
task.execute(nil)
rescue => e # Gotta catch 'em all!
ensure
redirect_to params[:back]
end

View File

@ -0,0 +1,21 @@
<%= link_to '&larr; Back'.html_safe, tasks_path, class: 'small radius secondary button' %>
<%= link_to 'Run', run_task_path(params[:task_id], back: task_runs_path(params[:task_id])), class: 'small radius button' %>
<br><br>
<table>
<thead>
<tr>
<th>Task</th>
<th>Timestamp</th>
<th>Took</th>
</tr>
</thead>
<tbody>
<% @runs.each do |run| %>
<tr>
<td><span class="<%= task_label(run) %> radius label"><%= run.name %></span></td>
<td><%= l run.created_at, format: :short %> (<%= time_ago_in_words(run.created_at) %> ago)</td>
<td><%= run.execution_time.round(6) %>s</td>
</tr>
<% end %>
</tbody>
</table>

View File

@ -12,8 +12,9 @@ Gem::Specification.new do |s|
s.homepage = "TODO"
s.summary = "TODO: Summary of BurdenWeb."
s.description = "TODO: Description of BurdenWeb."
s.license = 'MIT'
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"]
s.files = Dir["{app,config,db,lib}/**/*"] + ["LICENSE", "Rakefile", "README.md"]
s.add_dependency 'rails', '>= 3.2'
s.add_development_dependency 'burden'

View File

@ -1,6 +1,6 @@
namespace :good do
desc 'One more good task'
task :bar do
task :bar => [:foo] do
'Hey!'
end
end

View File

@ -0,0 +1,4 @@
desc 'One unpredictable task'
task :unpredictable do
raise 'oops' if rand(1..5) == 5
end