Permalink
Browse files

record git sha1 so we know which revision is running live

  • Loading branch information...
1 parent eaeb9b7 commit 7391dcf6d559fb3ccde0f2f914f59c34aeab4a87 @daxim daxim committed May 8, 2012
Showing with 14 additions and 0 deletions.
  1. +12 −0 crank.pl
  2. +1 −0 modules.pl
  3. +1 −0 tt/page.tt
View
@@ -16,6 +16,7 @@
use Text::Markdown ();
use Template ();
use Template::Constants qw( :debug :chomp );
+use URI qw();
my $sourcepath = 's';
my $buildpath = 'build';
@@ -111,6 +112,17 @@
$vars->{body} = $html;
$vars->{section} = ($section eq 'index') ? '.' : "$section.html";
$vars->{currlang} = ( $desc eq $home ) ? '' : $desc;
+ {
+ local $ENV{LANG} = 'C';
+ open my $git, '-|', qw(git log --pretty=format:commit-hash=%h;ref-names=%d;committer-date-relative=%cr);
+ if ($git) {
+ chomp(my $log = <$git>);
+ my $u = URI->new;
+ $u->scheme('tag');
+ $u->opaque("bobby-tables.com,2012:$log");
+ $vars->{git} = $u->as_string;
+ }
+ }
$tt->process( 'page.tt', $vars, "$section.html", { binmode => ':encoding(UTF-8)' } )
|| die sprintf("file: %s\nerror: %s\n", "$section.html", $tt->error);
}
View
@@ -14,6 +14,7 @@
Template
Test::HTML::Lint
Text::Markdown
+ URI
);
print "# Checking that we have all our necessary modules.\n";
View
@@ -9,6 +9,7 @@
[% END %]
</title>
<link rel="stylesheet" type="text/css" href="[% rel_static %]css/bobby.css" />
+ [% IF git %]<link rel="via" href="[% git %]" />[% END %]
</head>
<body>
<div id="wrap">

0 comments on commit 7391dcf

Please sign in to comment.