Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

live history

  • Loading branch information...
commit 6fe2544f0c8de1d901b1a5e313ae883cfaeaf55d 1 parent 72c8bac
@sarcilav sarcilav authored
View
22 lib/heroku/bartender/server.rb
@@ -6,21 +6,23 @@ class Server < Sinatra::Base
@@heroku_remote
@@user
@@pass
+ @@deployed_versions = {}
@@status = nil
dir = File.dirname(File.expand_path(__FILE__))
set :views, "#{dir}/views"
get "/" do
erb(:template, {}, :commits => Log.generate_commits,
:current_version => Command.current_version(@@heroku_remote),
- :status => @@status)
+ :deployed_versions => @@deployed_versions)
end
post "/" do
if params[:sha]
@@status = Command.move_to params[:sha], @@heroku_remote
+ @@deployed_versions[params[:sha]] = [Time.now, @@status]
end
erb(:template, {}, :commits => Log.generate_commits,
:current_version => Command.current_version(@@heroku_remote),
- :status => @@status)
+ :deployed_versions => @@deployed_versions)
end
def self.start(host, port, heroku_remote, user, pass)
@@heroku_remote = heroku_remote
@@ -42,16 +44,14 @@ def current_class(current_version_sha, sha)
sha == current_version_sha ? 'current' : ''
end
- def color_status(status, current_version, version_sha)
- if current_version == version_sha
- if status == true
- return 'green'
- elsif status == false
- return 'red'
- end
- return 'yellow'
+ def color_status(version_sha)
+ status = @@deployed_versions[version_sha][1]
+ if status == true
+ return 'green'
+ elsif status == false
+ return 'red'
end
- return ""
+ return 'yellow'
end
def state(status)
View
9 lib/heroku/bartender/views/template.erb
@@ -31,15 +31,22 @@
<div id="home">
<ul class="posts">
<% commits.each do |commit| %>
- <li class="<%= current_class(current_version, commit.sha) %> <%= color_status(status,current_version, commit.sha) %>">
+ <li class="<%= current_class(current_version, commit.sha) %> <%= color_status(commit.sha) %>">
<a name="<%= commit.sha %>"> <%= commit.sha %> </a>
<h3> <%= commit.author %> | <%= commit.email %></h3>
<p>
<%= commit.message %>
</p>
<p>
+ <strong> Committed date </strong>
<%= commit.date %>
</p>
+ <% if deployed_versions[commit.sha] %>
+ <p>
+ <strong> Deployed date </strong>
+ <%= deployed_versions[commit.sha][0] %>
+ </p>
+ <% end %>
<form method="POST">
<input type="hidden" value="<%= commit.sha %>" name="sha"/>
<input type="submit" value="Build"/>
Please sign in to comment.
Something went wrong with that request. Please try again.