From 905853387807a499f6e1175cbdfb16496d7039ea Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 27 Sep 2013 18:42:56 +0200 Subject: Get version from git, add version field to json --- cgi/index.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cgi/index.pl b/cgi/index.pl index 875ed8a..8c3b307 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -13,7 +13,7 @@ use Travel::Status::DE::VRR; no warnings 'uninitialized'; no if $] >= 5.018, warnings => "experimental::smartmatch"; -our $VERSION = '0.06'; +our $VERSION = qx{git describe --dirty} || '0.06'; my %default = ( backend => 'vrr', @@ -153,7 +153,8 @@ sub get_departures { my @fmt_departures; my ( $results, $errstr ) - = get_results( $opt{backend}, $opt{city}, $opt{stop}, $opt{cache_expiry} ); + = get_results( $opt{backend}, $opt{city}, $opt{stop}, + $opt{cache_expiry} ); my $dt_now = DateTime->now( time_zone => 'Europe/Berlin' ); my $strp_simple = DateTime::Format::Strptime->new( @@ -319,6 +320,7 @@ sub render_json { error => $errstr, preformatted => \@preformatted, raw => \@raw_objects, + version => $VERSION, } ); -- cgit v1.2.3