show_sha 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,8 @@
1
+
2
+ version 0.0.2
3
+ - /sha returns a hash instead of a string {:sha => '0987654321'}
4
+ - /sha.json and /sha.xml return the hashed value in the proper format
5
+
6
+ version 0.0.1
7
+ - /sha returns the sha as a string
8
+ - also work on app deployed at heroku.com
@@ -1,6 +1,19 @@
1
1
  class ShaController < ApplicationController
2
- layout false
2
+
3
+ respond_to :html, :xml, :json
4
+
3
5
  def index
4
- @sha = ENV["COMMIT_HASH"] || `git rev-parse HEAD`
6
+ sha = heroku_SHA || local_SHA
7
+ @info = {:sha => sha[0,10]}
8
+ respond_with @info
5
9
  end
6
- end
10
+
11
+ private
12
+ def heroku_SHA
13
+ ENV["COMMIT_HASH"]
14
+ end
15
+
16
+ def local_SHA
17
+ `git rev-parse HEAD`
18
+ end
19
+ end
@@ -1,16 +1,6 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>sha = <%= @sha %></title>
5
- <style type="text/css">
6
- body { background-color: #add8e6; text-align: center; font-family: courier}
7
- h1 { font-size: 250%; color: #f00; line-height: 1.5em; margin-top: 5em}
8
- h2 { font-size: 200%; color: #666; line-height: 1.5em; }
9
- </style>
10
- </head>
1
+ <style type="text/css">
2
+ body { background-color: #add8e6; text-align: center; font-family: courier}
3
+ h1 { font-size: 250%; color: #f00; line-height: 1.5em; margin-top: 5em}
11
4
 
12
- <body>
13
- <h1>SHA =</h1>
14
- <h2><%= @sha %></h2>
15
- </body>
16
- </html>
5
+ </style>
6
+ <h1><%= @info %></h1>
data/show_sha.gemspec CHANGED
@@ -5,7 +5,7 @@ $:.push File.expand_path("../lib", __FILE__)
5
5
  Gem::Specification.new do |s|
6
6
 
7
7
  s.name = 'show_sha'
8
- s.version = '0.0.1'
8
+ s.version = '0.0.2'
9
9
  s.date = Time.now.utc.strftime("%Y-%m-%d")
10
10
  s.homepage = "https://github.com/alainravet/show_sha"
11
11
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: show_sha
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alain Ravet
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-28 00:00:00 +02:00
13
+ date: 2011-05-29 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -57,6 +57,7 @@ extra_rdoc_files: []
57
57
 
58
58
  files:
59
59
  - .gitignore
60
+ - CHANGELOG
60
61
  - Gemfile
61
62
  - MIT-LICENSE
62
63
  - README.markdown