Sha256: af332d7077b238d9b50ac50a2315c5fdf416a2a2a192edda01bb8c51d395a3d4
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
class Heidi; module Web; module Routes module Projects get '/projects' do output = "" $heidi.projects.each do |project| output += "<a href='/projects/#{project.name}'>#{project.name}</a><br />" end output end get '/projects/:name' do project = $heidi[params[:name]] if project.nil? return "no project by that name: #{params[:name]}" end output = "<h1>#{project.name}</h1>" output += "Build status: #{project.build_status}" output += "<br /><br /><h2>Build history</h2>" project.builds.each do |build| output += %Q{<a href="/projects/#{project.name}/build/#{build.commit}">#{build.commit}</a> - #{build.status}<br />} end output end get '/projects/:name/build/:commit' do project = $heidi[params[:name]] if project.nil? return "no project by that name: #{params[:name]}" end # load build of project build = Heidi::Build.new(project, params[:commit]) output = "<h1>#{project.name}</h1>" output += "<h2>Build: #{build.commit} - #{build.status}<h2>" %w(heidi.info heidi.errors build.log test.log).each do |log_file| log = build.logs(log_file) if (!log.nil? and !log.empty?) output += "<h3>#{log_file}</h3>" output += "<pre>#{log}</pre>" end end output end put '/projects/:name/build' do project = $heidi[params[:name]] if project.nil? return "no project by that name: #{params[:name]}" end project.integrate end end end; end; end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
heidi-0.0.1 | lib/heidi/web/routes/projects.rb |