Skip to content

Commit

Permalink
Merge pull request #25 from moznion/feature/github_webhooks_commit_co…
Browse files Browse the repository at this point in the history
…mpare

Accept and show compare url (for GitHub Webhooks)
  • Loading branch information
moznion committed Mar 11, 2014
2 parents 95d87c2 + 842fcf6 commit 8580364
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/Ukigumo/Server/API/Dispatcher.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = @_;

Expand Down
1 change: 1 addition & 0 deletions lib/Ukigumo/Server/Command/Report.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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(@_);

Expand Down
1 change: 1 addition & 0 deletions share/sql/mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion share/sql/sqlite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions share/tmpl/show_report.tx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<h1><a href="<: uri_for('/', {project => $report.project}) :>"><: $report.project :></a> [<a href="<: uri_for('/project/' ~ uri($report.project) ~ '/' ~ uri($report.branch)) :>"><: $report.branch :></a>](<: $report.revision :>)
<span style="font-weight:bold; font-size: 130%; color: <: $report.status | status_color :>"><: $report.status | status_str | l :></span>
</h1>
: if $report.compare_url {
<p>
Compare: <a href="<: $report.compare_url :>"><: $report.compare_url :></a>
</p>
: }
: if $report.vc_log {
<ul>
: for $report.vc_log.split("\n") -> $log {
Expand Down
1 change: 1 addition & 0 deletions t/05-api-post.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ subtest 'no body' => sub {
branch => 'master', # branch name
revision => 3,
repo => 'git://...',
compare_url => 'http://.../deadbeaf...badcaffe',
]
);
ok($res->is_success) or die $res->status_line;
Expand Down

0 comments on commit 8580364

Please sign in to comment.