Commit b4bd0d648ad3c36b19e15c66c74ed303c25a4574
1 parent
9c3bc05f
Exists in
master
and in
1 other branch
Added 'short_revision' method to Deploy. 7 character SHAs are enough
Showing
4 changed files
with
11 additions
and
2 deletions
Show diff stats
app/models/deploy.rb
... | ... | @@ -25,6 +25,10 @@ class Deploy |
25 | 25 | app.errs.unresolved.in_env(environment).each {|err| err.resolve!} |
26 | 26 | end |
27 | 27 | |
28 | + def short_revision | |
29 | + revision.to_s[0,7] | |
30 | + end | |
31 | + | |
28 | 32 | protected |
29 | 33 | |
30 | 34 | def should_notify? |
... | ... | @@ -36,3 +40,4 @@ class Deploy |
36 | 40 | end |
37 | 41 | |
38 | 42 | end |
43 | + | ... | ... |
app/views/apps/index.html.haml
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | - @apps.each do |app| |
13 | 13 | %tr |
14 | 14 | %td.name= link_to app.name, app_path(app) |
15 | - %td.deploy= app.last_deploy_at ? link_to( app.last_deploy_at.to_s(:micro) << " (#{app.deploys.last.revision.to_s[0,7]})", app_deploys_path(app)) : 'n/a' | |
15 | + %td.deploy= app.last_deploy_at ? link_to( app.last_deploy_at.to_s(:micro) << " (#{app.deploys.last.short_revision})", app_deploys_path(app)) : 'n/a' | |
16 | 16 | %td.count |
17 | 17 | - if app.errs.count > 0 |
18 | 18 | = link_to app.errs.unresolved.count, app_path(app) | ... | ... |
app/views/apps/show.html.haml
... | ... | @@ -77,7 +77,7 @@ |
77 | 77 | %td.who #{deploy.username} |
78 | 78 | %td.message #{deploy.message} |
79 | 79 | %td.repository #{deploy.repository} |
80 | - %td.revision #{deploy.revision} | |
80 | + %td.revision #{deploy.short_revision} | |
81 | 81 | = link_to "All Deploys (#{@app.deploys.count})", app_deploys_path(@app), :class => 'button' |
82 | 82 | - else |
83 | 83 | %h3 No deploys | ... | ... |
spec/models/deploy_spec.rb