summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2013-09-27 18:42:56 +0200
committerDaniel Friesel <derf@finalrewind.org>2013-09-27 18:42:56 +0200
commit905853387807a499f6e1175cbdfb16496d7039ea (patch)
tree64d803d3ecea8484a72a022d7db2848b6dbca8ab
parent9d7e48602a3d3f66ac174a55f0ed56a7100fd14e (diff)
Get version from git, add version field to json
-rw-r--r--cgi/index.pl6
1 files 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,
}
);