From 842fcf640ed87ea6cd2033396fddfa57d0e61aa8 Mon Sep 17 00:00:00 2001 From: moznion Date: Mon, 10 Mar 2014 17:22:25 +0900 Subject: [PATCH] Add compare url (for GitHub webhooks) --- lib/Ukigumo/Server/API/Dispatcher.pm | 1 + lib/Ukigumo/Server/Command/Report.pm | 1 + share/sql/mysql.sql | 1 + share/sql/sqlite.sql | 3 ++- share/tmpl/show_report.tx | 5 +++++ t/05-api-post.t | 1 + 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Ukigumo/Server/API/Dispatcher.pm b/lib/Ukigumo/Server/API/Dispatcher.pm index 6ca9642..f22eabd 100644 --- a/lib/Ukigumo/Server/API/Dispatcher.pm +++ b/lib/Ukigumo/Server/API/Dispatcher.pm @@ -81,6 +81,7 @@ post '/api/v1/report/add' => [ body => { isa => 'Str', optional => 1 }, revision => { isa => 'Str' }, repo => { isa => 'Str' }, + compare_url => { isa => 'Str', optional => 1 } ] => sub { my ($c, $args) = @_; diff --git a/lib/Ukigumo/Server/Command/Report.pm b/lib/Ukigumo/Server/Command/Report.pm index 84a3ad3..93598dd 100644 --- a/lib/Ukigumo/Server/Command/Report.pm +++ b/lib/Ukigumo/Server/Command/Report.pm @@ -169,6 +169,7 @@ sub insert { revision => { isa => 'Str', optional => 1 }, body => { isa => 'Str', optional => 1 }, vc_log => { isa => 'Str', optional => 1 }, + compare_url => { isa => 'Str', optional => 1 }, ); my $args = $rule->validate(@_); diff --git a/share/sql/mysql.sql b/share/sql/mysql.sql index 166cea7..5fccee9 100644 --- a/share/sql/mysql.sql +++ b/share/sql/mysql.sql @@ -20,6 +20,7 @@ CREATE TABLE IF NOT EXISTS `report` ( `vc_log` text NULL, `body` text NULL, `ctime` INTEGER NOT NULL, + `compare_url` VARCHAR(255) NULL, INDEX `report_branch_idx` (`branch_id`), PRIMARY KEY (`report_id`) ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8; diff --git a/share/sql/sqlite.sql b/share/sql/sqlite.sql index 4ee0f8f..6807cc5 100644 --- a/share/sql/sqlite.sql +++ b/share/sql/sqlite.sql @@ -20,7 +20,8 @@ CREATE TABLE IF NOT EXISTS report ( revision VARCHAR(255), vc_log TEXT, body TEXT, - ctime INTEGER NOT NULL + ctime INTEGER NOT NULL, + compare_url VARCHAR(255) ); CREATE INDEX IF NOT EXISTS report_branch_idx ON report (branch_id); diff --git a/share/tmpl/show_report.tx b/share/tmpl/show_report.tx index 66a189c..ffae9d2 100644 --- a/share/tmpl/show_report.tx +++ b/share/tmpl/show_report.tx @@ -9,6 +9,11 @@

<: $report.project :> [<: $report.branch :>](<: $report.revision :>) <: $report.status | status_str | l :>

+ : if $report.compare_url { +

+ Compare: <: $report.compare_url :> +

+ : } : if $report.vc_log {