Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #76 from HebaruSan/feature/webhook-overwrite-cache
Browse files Browse the repository at this point in the history
Override cache for web hook inflate
  • Loading branch information
techman83 committed Nov 30, 2018
2 parents 4a2b258 + a3d609b commit 3c735a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/App/KSP_CKAN/Tools/NetKAN.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ has 'file' => ( is => 'ro', required => 1 );
has 'ckan_meta' => ( is => 'ro', required => 1, isa => $Meta );
has 'status' => ( is => 'rw', required => 1, isa => $Status );
has 'rescan' => ( is => 'ro', default => sub { 1 } );
has 'overwrite' => ( is => 'ro', default => sub { 0 } );
has 'token' => ( is => 'ro', lazy => 1, builder => 1 );
has 'netkan' => ( is => 'ro', lazy => 1, builder => 1 );
has 'cache' => ( is => 'ro', lazy => 1, builder => 1 );
Expand Down Expand Up @@ -96,11 +97,13 @@ method _build__output {
}

method _build__cli {
if ($self->token) {
return $self->netkan." --outputdir=".$self->_output." --cachedir=".$self->_cache." --github-token=".$self->token." ".$self->file;
} else {
return $self->netkan." --outputdir=".$self->_output." --cachedir=".$self->_cache." ".$self->file;
}
my @opts = (
'--outputdir=' . $self->_output,
'--cachedir=' . $self->_cache,
);
push @opts, '--github-token=' . $self->token if $self->token;
push @opts, '--overwrite-cache' if $self->overwrite;
return join(' ', $self->netkan, @opts, $self->file);
}

method _build_cache {
Expand Down Expand Up @@ -172,13 +175,13 @@ method _commit($file) {
}

if ($self->is_debug()) {
$self->debug("$changed would have been commited");
$self->debug("$changed would have been committed");
$self->ckan_meta->reset(file => $file);
return 0;
}

if ( ! $self->_netkan_metadata->staging ) {
$self->info("Commiting $changed");
$self->info("Committing $changed");
$self->ckan_meta->commit(
file => $file,
message => "NetKAN generated mods - $changed",
Expand Down
1 change: 1 addition & 0 deletions lib/App/KSP_CKAN/WebHooks/InflateNetKAN.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ method inflate($identifiers) {
ckan_meta => $self->_CKAN_meta,
status => $self->_status,
rescan => 1,
overwrite => 1,
);
$netkan->inflate;
}
Expand Down

0 comments on commit 3c735a6

Please sign in to comment.