-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathapp.rb
More file actions
24 lines (21 loc) · 755 Bytes
/
app.rb
File metadata and controls
24 lines (21 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require 'sinatra'
require 'haml'
# Listen on all interfaces
set :bind, '0.0.0.0'
set :port, '3000'
before do
# Get information from local repository
@gitInfo = {
:name => `git rev-parse --abbrev-ref HEAD`.delete!("\n"),
:sHA => `git rev-parse HEAD`.delete!("\n"),
:shortSHA => `git rev-parse --short HEAD`.delete!("\n"),
:lastCommitTime => `git log --format="%ai" -n1 HEAD`.delete!("\n"),
:lastCommitMessage => `git log --format="%B" -n1 HEAD`.delete!("\n"),
:lastCommitAuthor => `git log --format="%aN" -n1 HEAD`.delete!("\n"),
:remoteOriginUrl => `git config --get-all remote.origin.url`.delete!("\n")
}
end
get '/' do
# Serve & Interpret index.haml with github information
haml :index, :locals => @gitInfo
end