From 711943ccbda45fc15336118907f9d1c03f75fbc4 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Thu, 27 Jun 2019 10:41:39 -0500 Subject: [PATCH 1/2] Retire Perl/Python schema validation --- .travis.yml | 4 +- Changes | 0 README.md | 6 +-- dist.ini | 4 +- lib/App/KSP_CKAN/NetKAN.pm | 13 ----- lib/App/KSP_CKAN/Roles/Validate.pm | 49 ----------------- lib/App/KSP_CKAN/Tools/Config.pm | 12 ----- lib/App/KSP_CKAN/Tools/NetKAN.pm | 10 +--- t/App/KSP_CKAN/NetKAN.t | 7 +-- t/App/KSP_CKAN/Roles/Validate.t | 54 ------------------- t/App/KSP_CKAN/Tools/Config.t | 2 - t/App/KSP_CKAN/Tools/Http.t | 2 - t/App/KSP_CKAN/Tools/NetKAN.t | 16 ------ .../DogeCoinFlag-v1.02.ckan | 18 ------- .../DogeCoinFlag/DogeCoinFlag-v1.02.ckan | 18 ------- t/data/CKAN-meta-validate/README.md | 1 - .../NetKAN/NetKAN/DogeCoinFlag-broken.netkan | 19 ------- .../NetKAN/NetKAN/DogeCoinFlag-invalid.netkan | 21 -------- t/lib/App/KSP_CKAN/Test.pm | 15 +----- t/lib/App/KSP_CKAN/Test/Validate.pm | 33 ------------ 20 files changed, 10 insertions(+), 294 deletions(-) create mode 100644 Changes delete mode 100644 lib/App/KSP_CKAN/Roles/Validate.pm delete mode 100644 t/App/KSP_CKAN/Roles/Validate.t delete mode 100644 t/data/CKAN-meta-validate/DogeCoinFlag-invalid/DogeCoinFlag-v1.02.ckan delete mode 100644 t/data/CKAN-meta-validate/DogeCoinFlag/DogeCoinFlag-v1.02.ckan delete mode 100644 t/data/CKAN-meta-validate/README.md delete mode 100644 t/data/NetKAN/NetKAN/DogeCoinFlag-broken.netkan delete mode 100644 t/data/NetKAN/NetKAN/DogeCoinFlag-invalid.netkan delete mode 100644 t/lib/App/KSP_CKAN/Test/Validate.pm diff --git a/.travis.yml b/.travis.yml index 6bc75ac..b67d246 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,7 @@ before_install: # Prevent "Please tell me who you are" errors for certain DZIL configs - git config --global user.name "TravisCI" install: - # Deal with all of the DZIL dependancies, quickly and quietly - - pip install --user jsonschema - - export PYTHONPATH=~/.local/lib/python2.7/site-packages/ + # Deal with all of the DZIL dependencies, quickly and quietly - cpanm --quiet --notest --skip-satisfied Dist::Zilla - cpanm --quiet --notest --skip-satisfied Test::Perl::Critic - dzil authordeps | grep -vP '[^\w:]' | xargs -n 5 -P 10 cpanm --quiet --notest --skip-satisfied diff --git a/Changes b/Changes new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index f0e6652..932397b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ App::KSP-CKAN [![Build Status](https://travis-ci.org/KSP-CKAN/NetKAN-bot.svg? Non Perl Dependencies ===================== ```bash -apt-get install liblocal-lib-perl cpanminus build-essential mono-complete libcurl4-openssl-dev python-jsonschema libdist-zilla-perl +apt-get install liblocal-lib-perl cpanminus build-essential mono-complete libcurl4-openssl-dev libdist-zilla-perl ``` NetKAN will need certs for mono @@ -42,8 +42,6 @@ An ini file with the following contents will need to created at ~/.ksp-ckan CKAN_meta=git@github.com:KSP-CKAN/CKAN-meta.git NetKAN=git@github.com:KSP-CKAN/NetKAN-bot.git netkan_exe=https://ckan-travis.s3.amazonaws.com/netkan.exe -ckan_validate=https://raw.githubusercontent.com/KSP-CKAN/CKAN/master/bin/ckan-validate.py -ckan_schema=https://raw.githubusercontent.com/KSP-CKAN/CKAN/master/CKAN.schema working=/home/NetKAN/NetKAN ``` @@ -71,7 +69,7 @@ Enable it in cron with (crontab -e as the netkan user): 00 */3 * * * PERL5LIB=/home/netkan/perl5/lib/perl5/ netkan-indexer ``` -There is a 'lite' cli option is not implemented. It's a future concept to allow 'lite' +There is a 'lite' cli option is not implemented. It's a future concept to allow 'lite' skimming of metadata API endpoints without performing a full metadata inflation. License diff --git a/dist.ini b/dist.ini index bace2aa..0f67c18 100644 --- a/dist.ini +++ b/dist.ini @@ -2,7 +2,7 @@ name = App-KSP_CKAN author = Leon Wright license = MIT copyright_holder = Leon Wright -copyright_year = 2015 +copyright_year = 2019 [Git::NextVersion] fist_version = 0.01 @@ -27,7 +27,7 @@ match = init/* [Test::Perl::Critic] [Test::PodSpelling] stopwords = exe -stopwords = inflater +stopwords = inflater stopwords = CKAN stopwords = netkan stopwords = api diff --git a/lib/App/KSP_CKAN/NetKAN.pm b/lib/App/KSP_CKAN/NetKAN.pm index 897fa5c..8482468 100644 --- a/lib/App/KSP_CKAN/NetKAN.pm +++ b/lib/App/KSP_CKAN/NetKAN.pm @@ -83,19 +83,6 @@ method _mirror_files { exe => 1, ); - # ckan-validate.py - $self->_http->mirror( - url => $config->ckan_validate, - path => $config->working."/ckan-validate.py", - exe => 1, - ); - - # CKAN.schema - $self->_http->mirror( - url => $config->ckan_schema, - path => $config->working."/CKAN.schema", - ); - return; } diff --git a/lib/App/KSP_CKAN/Roles/Validate.pm b/lib/App/KSP_CKAN/Roles/Validate.pm deleted file mode 100644 index 7504efe..0000000 --- a/lib/App/KSP_CKAN/Roles/Validate.pm +++ /dev/null @@ -1,49 +0,0 @@ -package App::KSP_CKAN::Roles::Validate; - -use v5.010; -use strict; -use warnings; -use autodie; -use Method::Signatures 20140224; -use Capture::Tiny qw(capture); -use File::chdir; -use Moo::Role; - -# ABSTRACT: Small validation role for consuming - -# VERSION: Generated by DZP::OurPkg:Version - -=head1 SYNOPSIS - - with('App::KSP_CKAN::Roles::Validate'); - -=head1 DESCRIPTION - -Currently lightly wraps ckan_validate.py. Requires ckan_validate.py -and CKAN.schema be in '$config->working'. Also requires consuming -class to have the Logger role. - -=cut - -requires 'config', 'warn'; - -=method validate - - $self->validate( file => "/path/to/file.pl" ); - -Validates the CKAN file at the path. Returns the exit -code captured (anything not '0' is considered a failure). - -=cut - -method validate($file) { - my ($stderr, $stdout, $exit) = capture { - local $CWD = $self->config->working; - system("python", "ckan-validate.py", $file); - }; - - $self->warn($stdout) if $stdout; - return $exit; -} - -1; diff --git a/lib/App/KSP_CKAN/Tools/Config.pm b/lib/App/KSP_CKAN/Tools/Config.pm index 223a908..35b97bf 100644 --- a/lib/App/KSP_CKAN/Tools/Config.pm +++ b/lib/App/KSP_CKAN/Tools/Config.pm @@ -34,8 +34,6 @@ has '_config' => ( is => 'ro', lazy => 1, builder => 1 ); has 'CKAN_meta' => ( is => 'ro', lazy => 1, builder => 1 ); has 'NetKAN' => ( is => 'ro', lazy => 1, builder => 1 ); has 'netkan_exe' => ( is => 'ro', lazy => 1, builder => 1 ); -has 'ckan_validate' => ( is => 'ro', lazy => 1, builder => 1 ); -has 'ckan_schema' => ( is => 'ro', lazy => 1, builder => 1 ); has 'GH_token' => ( is => 'ro', lazy => 1, builder => 1 ); has 'GH_user' => ( is => 'ro', lazy => 1, builder => 1 ); has 'GH_repo' => ( is => 'ro', lazy => 1, builder => 1 ); @@ -68,16 +66,6 @@ method _build_netkan_exe { return $self->_config->{_}{'netkan_exe'}; } -method _build_ckan_validate { - croak( "Missing 'ckan_validate' from config" ) if ! $self->_config->{_}{'ckan_validate'}; - return $self->_config->{_}{'ckan_validate'}; -} - -method _build_ckan_schema { - croak( "Missing 'ckan_schema' from config" ) if ! $self->_config->{_}{'ckan_schema'}; - return $self->_config->{_}{'ckan_schema'}; -} - method _build_IA_access { croak( "Missing 'IA_access' from config" ) if ! $self->_config->{_}{'IA_access'}; return $self->_config->{_}{'IA_access'}; diff --git a/lib/App/KSP_CKAN/Tools/NetKAN.pm b/lib/App/KSP_CKAN/Tools/NetKAN.pm index 0ef7bae..6899d27 100644 --- a/lib/App/KSP_CKAN/Tools/NetKAN.pm +++ b/lib/App/KSP_CKAN/Tools/NetKAN.pm @@ -166,14 +166,6 @@ method _commit($file) { $self->ckan_meta->add($file); my $changed = basename($file, ".ckan"); - if ( $self->validate($file) ) { - $self->warn("Failed to Parse $changed"); - $self->ckan_meta->reset(file => $file); - $self->ckan_meta->clean_untracked; - $self->_status->failure("Schema validation failed"); - return 1; - } - if ($self->is_debug()) { $self->debug("$changed would have been committed"); $self->ckan_meta->reset(file => $file); @@ -256,6 +248,6 @@ method inflate { return 0; } -with('App::KSP_CKAN::Roles::Logger','App::KSP_CKAN::Roles::Validate'); +with('App::KSP_CKAN::Roles::Logger'); 1; diff --git a/t/App/KSP_CKAN/NetKAN.t b/t/App/KSP_CKAN/NetKAN.t index a8e0e6e..863611b 100644 --- a/t/App/KSP_CKAN/NetKAN.t +++ b/t/App/KSP_CKAN/NetKAN.t @@ -24,7 +24,7 @@ my $config = App::KSP_CKAN::Tools::Config->new( ); use_ok("App::KSP_CKAN::NetKAN"); -my $netkan = App::KSP_CKAN::NetKAN->new( +my $netkan = App::KSP_CKAN::NetKAN->new( config => $config, ); @@ -49,7 +49,7 @@ $netkan->full_index; local => $config->working, clean => 1, ); - + my $identifier = "DogeCoinFlagStaged"; is($git->current_branch, "master", "We started on the master branch"); ok(! -d "CKAN-meta/$identifier", "Staged netkan not commited to master"); @@ -66,9 +66,6 @@ $netkan->full_index; foreach my $file (@id_branch) { ok($file =~ /$identifier-v\d.\d\d.ckan/, "Commited to $identifier"); } - - ok(! -d "CKAN-meta/DogeCoinFlag-broken", "No broken metadata committed"); - ok(! -d "CKAN-meta/DogeCoinFlag-invalid", "No invalid metadata committed"); } ok( -d $config->cache, "NetKAN cache path set correctly" ); diff --git a/t/App/KSP_CKAN/Roles/Validate.t b/t/App/KSP_CKAN/Roles/Validate.t deleted file mode 100644 index f4a2d20..0000000 --- a/t/App/KSP_CKAN/Roles/Validate.t +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env perl -w - -use lib 't/lib/'; - -use strict; -use warnings; -use Test::Most; -use Test::Warnings; -use File::chdir; -use App::KSP_CKAN::Test; -use App::KSP_CKAN::Test::Validate; -use App::KSP_CKAN::Tools::Config; -use App::KSP_CKAN::Tools::Git; - -## Setup our environment -my $test = App::KSP_CKAN::Test->new(); -$test->create_repo("CKAN-meta-validate"); - -# Config -$test->create_config; -my $config = App::KSP_CKAN::Tools::Config->new( - file => $test->tmp."/.ksp-ckan", -); - -use_ok("App::KSP_CKAN::Test::Validate"); -my $validate = App::KSP_CKAN::Test::Validate->new( - config => $config, -); - -my $git = App::KSP_CKAN::Tools::Git->new( - remote => $test->_tmp."/data/CKAN-meta-validate", - local => $config->working, - clean => 1, -); - -$git->_git; -$validate->_mirror_files; -$validate->validate($config->working."/CKAN-meta-validate/DogeCoinFlag/DogeCoinFlag-v1.02.ckan"); - -is( - $validate->validate($config->working."/CKAN-meta-validate/DogeCoinFlag/DogeCoinFlag-v1.02.ckan"), - 0, - "DogeCoinFlag-v1.02.ckan Valid", -); -isnt( - $validate->validate($config->working."/CKAN-meta-validate/DogeCoinFlag-invalid/DogeCoinFlag-v1.02.ckan"), - 0, - "DogeCoinFlag-v1.02.ckan Invalid", -); - -$test->cleanup; - -done_testing(); -__END__ diff --git a/t/App/KSP_CKAN/Tools/Config.t b/t/App/KSP_CKAN/Tools/Config.t index d774023..e392b57 100644 --- a/t/App/KSP_CKAN/Tools/Config.t +++ b/t/App/KSP_CKAN/Tools/Config.t @@ -27,8 +27,6 @@ is(-d $config->working, 1, "working was automatically created"); is($config->cache, $test->_tmp."/cache", "cache loaded from config"); is(-d $config->cache, 1, "cache was automatically created"); is($config->netkan_exe, "https://ckan-travis.s3.amazonaws.com/netkan.exe", "netkan_exe loaded from config"); -is($config->ckan_validate, "https://raw.githubusercontent.com/KSP-CKAN/CKAN/master/bin/ckan-validate.py", "ckan_validate loaded from config"); -is($config->ckan_schema, "https://raw.githubusercontent.com/KSP-CKAN/CKAN/master/CKAN.schema", "ckan_schema loaded from config"); is($config->IA_access, "12345678", "IA_access loaded from config"); is($config->IA_secret, "87654321", "IA_secret loaded from config"); is($config->IA_collection, "collection", "IA_collection loaded from config"); diff --git a/t/App/KSP_CKAN/Tools/Http.t b/t/App/KSP_CKAN/Tools/Http.t index f410021..2af01e5 100644 --- a/t/App/KSP_CKAN/Tools/Http.t +++ b/t/App/KSP_CKAN/Tools/Http.t @@ -20,8 +20,6 @@ subtest 'mirror' => sub { $http->mirror( url => "https://ckan-travis.s3.amazonaws.com/netkan.exe", path => $test->tmp."/netkan.exe"); is(-e $test->tmp."/netkan.exe", 1, "Mirrored successfully"); isnt(-X $test->tmp."/netkan.exe", 1, "File not executable"); - $http->mirror( url => "https://raw.githubusercontent.com/KSP-CKAN/CKAN/master/bin/ckan-validate.py", path => $test->tmp."/ckan-validate.py", exe => 1); - is(-X $test->tmp."/ckan-validate.py", 1, "File executable"); }; $test->cleanup; diff --git a/t/App/KSP_CKAN/Tools/NetKAN.t b/t/App/KSP_CKAN/Tools/NetKAN.t index faba8a4..620433e 100644 --- a/t/App/KSP_CKAN/Tools/NetKAN.t +++ b/t/App/KSP_CKAN/Tools/NetKAN.t @@ -48,8 +48,6 @@ $netkan_git->pull; # netkan.exe my $http = App::KSP_CKAN::Tools::Http->new(); $http->mirror( url => $config->netkan_exe, path => $test->tmp."/netkan.exe", exe => 1 ); -$http->mirror( url => $config->ckan_validate, path => $config->working."/ckan-validate.py", exe => 1 ); -$http->mirror( url => $config->ckan_schema, path => $config->working."/CKAN.schema" ); use_ok("App::KSP_CKAN::Tools::NetKAN"); my $netkan = App::KSP_CKAN::Tools::NetKAN->new( @@ -87,20 +85,6 @@ TODO: { ok( -d $test->tmp."/cache", "NetKAN Cache path set correctly"); } -# Test file validation -subtest 'File Validation' => sub { - $test->create_ckan( file => $config->working."/CKAN-meta/test_file.ckan" ); - $netkan->_commit( $config->working."/CKAN-meta/test_file.ckan" ); - is($netkan->ckan_meta->changed(origin => 0), 0, "Commit validated file successful"); - $netkan->ckan_meta->push; - is($netkan->ckan_meta->changed, 0, "Changes pushed repository" ); - $test->create_ckan( file => $config->working."/CKAN-meta/test_file2.ckan", valid => 0 ); - $netkan->_commit( $config->working."/CKAN-meta/test_file2.ckan" ); - is( $netkan->ckan_meta->changed, 0, "broken metadata was not committed" ); - $netkan->ckan_meta->add; - is( $netkan->ckan_meta->changed, 0, "broken metadata gets removed" ); -}; - # Test staged commits subtest 'Staged Commits' => sub { # Setup diff --git a/t/data/CKAN-meta-validate/DogeCoinFlag-invalid/DogeCoinFlag-v1.02.ckan b/t/data/CKAN-meta-validate/DogeCoinFlag-invalid/DogeCoinFlag-v1.02.ckan deleted file mode 100644 index b2bf036..0000000 --- a/t/data/CKAN-meta-validate/DogeCoinFlag-invalid/DogeCoinFlag-v1.02.ckan +++ /dev/null @@ -1,18 +0,0 @@ -{ - "spec_version": 1, - "identifier": "DogeCoinFlag", - "name": "Dogecoin Flag", - "abstract": "Such flag. Very currency. Wow.", - "description": "Adorn your craft with your favourite cryptocurrency. To the mün!", - "ksp_version_max": "1.0.-1", - "license": "CC-BY", - "author": "daviddwk", - "resources": { - "homepage": "https://www.reddit.com/r/dogecoin/comments/1tdlgg/i_made_a_more_accurate_dogecoin_and_a_ksp_flag/", - "repository": "https://github.com/pjf/DogeCoinFlag" - }, - "version": "v1.02", - "download": "https://github.com/pjf/DogeCoinFlag/releases/download/v1.02/DogeCoinFlag-1.02.zip", - "x_generated_by": "netkan", - "download_size": 53359 -} diff --git a/t/data/CKAN-meta-validate/DogeCoinFlag/DogeCoinFlag-v1.02.ckan b/t/data/CKAN-meta-validate/DogeCoinFlag/DogeCoinFlag-v1.02.ckan deleted file mode 100644 index ca8c796..0000000 --- a/t/data/CKAN-meta-validate/DogeCoinFlag/DogeCoinFlag-v1.02.ckan +++ /dev/null @@ -1,18 +0,0 @@ -{ - "spec_version": 1, - "identifier": "DogeCoinFlag", - "name": "Dogecoin Flag", - "abstract": "Such flag. Very currency. Wow.", - "description": "Adorn your craft with your favourite cryptocurrency. To the mün!", - "ksp_version": "any", - "license": "CC-BY", - "author": "daviddwk", - "resources": { - "homepage": "https://www.reddit.com/r/dogecoin/comments/1tdlgg/i_made_a_more_accurate_dogecoin_and_a_ksp_flag/", - "repository": "https://github.com/pjf/DogeCoinFlag" - }, - "version": "v1.02", - "download": "https://github.com/pjf/DogeCoinFlag/releases/download/v1.02/DogeCoinFlag-1.02.zip", - "x_generated_by": "netkan", - "download_size": 53359 -} diff --git a/t/data/CKAN-meta-validate/README.md b/t/data/CKAN-meta-validate/README.md deleted file mode 100644 index 524acff..0000000 --- a/t/data/CKAN-meta-validate/README.md +++ /dev/null @@ -1 +0,0 @@ -Test file diff --git a/t/data/NetKAN/NetKAN/DogeCoinFlag-broken.netkan b/t/data/NetKAN/NetKAN/DogeCoinFlag-broken.netkan deleted file mode 100644 index 91647a5..0000000 --- a/t/data/NetKAN/NetKAN/DogeCoinFlag-broken.netkan +++ /dev/null @@ -1,19 +0,0 @@ -{ - "spec_version" : 1, - "identifier" : "DogeCoinFlag-broken", - "name" : "Dogecoin Flag Broken", - "abstract" : "Such flag. Very broken. Wow.", - "description" : "Adorn your craft with your favourite cryptocurrency. To the mün!", - "ksp_version" : "any", - "license" : "CC-BY", - "author" : "daviddwk", - "install" : [ - { - "find_regexp": "^DogeCoinFlag", - "install_to": "GameData" - }, - ], - "resources" : { - "homepage" : "https://www.reddit.com/r/dogecoin/comments/1tdlgg/i_made_a_more_accurate_dogecoin_and_a_ksp_flag/" - } -} diff --git a/t/data/NetKAN/NetKAN/DogeCoinFlag-invalid.netkan b/t/data/NetKAN/NetKAN/DogeCoinFlag-invalid.netkan deleted file mode 100644 index 1b5a369..0000000 --- a/t/data/NetKAN/NetKAN/DogeCoinFlag-invalid.netkan +++ /dev/null @@ -1,21 +0,0 @@ -{ - "spec_version" : 1, - "identifier" : "DogeCoinFlag-invalid", - "name" : "Dogecoin Flag Invalid", - "abstract" : "Such flag. Very invalid. Wow.", - "description" : "Adorn your craft with your favourite cryptocurrency. To the mün!", - "$kref" : "#/ckan/github/pjf/DogeCoinFlag", - "$vref" : "#/ckan/ksp-avc", - "ksp_version_max": "1.0.-1", - "license" : "CC-BY", - "author" : "daviddwk", - "install" : [ - { - "find_regexp": "^DogeCoinFlag", - "install_to": "GameData" - }, - ], - "resources" : { - "homepage" : "https://www.reddit.com/r/dogecoin/comments/1tdlgg/i_made_a_more_accurate_dogecoin_and_a_ksp_flag/" - } -} diff --git a/t/lib/App/KSP_CKAN/Test.pm b/t/lib/App/KSP_CKAN/Test.pm index 3ae1eef..1c93efe 100644 --- a/t/lib/App/KSP_CKAN/Test.pm +++ b/t/lib/App/KSP_CKAN/Test.pm @@ -96,10 +96,7 @@ method create_repo($repo) { Creates an example ckan that would pass validation at the specified path. -Takes an optional extra argument, that if set to false will create -a ckan that won't pass schema validation. - - $test->create_ckan( file => "/path/to/file", valid => 0); + $test->create_ckan( file => "/path/to/file" ); =over @@ -107,11 +104,6 @@ a ckan that won't pass schema validation. Path and file we are creating. -=item valid - -Defaults to true. False value will create a CKAN that will fail -validation against the schema. - =item kind Allows us to specify a different kind of package. 'metadata' is the @@ -127,7 +119,6 @@ Allows us to specify a different license. method create_ckan( :$file, - :$valid = 1, :$random = 1, :$identifier = "ExampleKAN", :$kind = "package", @@ -136,7 +127,7 @@ method create_ckan( :$sha256 = "1A2B3C4D5E1A2B3C4D5E", :$version = "1.0.0.1", ) { - my $attribute = $valid ? "identifier" : "invalid_schema"; + my $attribute = "identifier"; my $rand = $random ? $self->_random_string : "random"; # Allows us against a metapackage. TODO: make into valid metapackage @@ -227,8 +218,6 @@ method create_config(:$optional = 1, :$nogh = 0) { print $in "CKAN_meta=".$self->_tmp."/data/CKAN-meta\n"; print $in "NetKAN=".$self->_tmp."/data/NetKAN\n"; print $in "netkan_exe=https://ckan-travis.s3.amazonaws.com/netkan.exe\n"; - print $in "ckan_validate=https://raw.githubusercontent.com/KSP-CKAN/CKAN/master/bin/ckan-validate.py\n"; - print $in "ckan_schema=https://raw.githubusercontent.com/KSP-CKAN/CKAN/master/CKAN.schema\n"; print $in "IA_access=12345678\n"; print $in "IA_secret=87654321\n"; diff --git a/t/lib/App/KSP_CKAN/Test/Validate.pm b/t/lib/App/KSP_CKAN/Test/Validate.pm deleted file mode 100644 index 98d8419..0000000 --- a/t/lib/App/KSP_CKAN/Test/Validate.pm +++ /dev/null @@ -1,33 +0,0 @@ -package App::KSP_CKAN::Test::Validate; -use Method::Signatures 20140224; -use App::KSP_CKAN::Tools::Http; -use Moo; -use namespace::clean; - -has config => ( is => 'rw' ); -has '_http' => ( is => 'ro', lazy => 1, builder => 1 ); - -method _build__http { - return App::KSP_CKAN::Tools::Http->new(); -} - -method _mirror_files { - # ckan-validate.py - $self->_http->mirror( - url => $self->config->ckan_validate, - path => $self->config->working."/ckan-validate.py", - exe => 1, - ); - - # CKAN.schema - $self->_http->mirror( - url => $self->config->ckan_schema, - path => $self->config->working."/CKAN.schema", - exe => 1, - ); - return; -} - -with('App::KSP_CKAN::Roles::Logger','App::KSP_CKAN::Roles::Validate'); - -1; From ab645c50830ddb1126f23a54cb18290374286adc Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sat, 29 Jun 2019 00:45:58 +0000 Subject: [PATCH 2/2] Fix test data spec version --- t/App/KSP_CKAN/NetKAN.t | 8 ++++---- t/data/NetKAN/NetKAN/DogeCoinFlagStaged.netkan | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/t/App/KSP_CKAN/NetKAN.t b/t/App/KSP_CKAN/NetKAN.t index 863611b..18ae052 100644 --- a/t/App/KSP_CKAN/NetKAN.t +++ b/t/App/KSP_CKAN/NetKAN.t @@ -41,7 +41,7 @@ $netkan->full_index; my $why = "These tests pass locally, but not within Travis"; TODO: { local $TODO = $why if $ENV{TRAVIS}; - ok($#files != -1, "We commited files to master"); + ok($#files != -1, "We committed files to master"); } my $git = App::KSP_CKAN::Tools::Git->new( @@ -52,7 +52,7 @@ $netkan->full_index; my $identifier = "DogeCoinFlagStaged"; is($git->current_branch, "master", "We started on the master branch"); - ok(! -d "CKAN-meta/$identifier", "Staged netkan not commited to master"); + ok(! -d "CKAN-meta/$identifier", "Staged netkan not committed to master"); $git->checkout_branch($identifier); is($git->current_branch, $identifier, "We are on the $identifier branch"); @@ -60,11 +60,11 @@ $netkan->full_index; TODO: { local $TODO = $why if $ENV{TRAVIS}; - ok($#id_branch != -1, "We commited files to $identifier"); + ok($#id_branch != -1, "We committed files to $identifier"); } foreach my $file (@id_branch) { - ok($file =~ /$identifier-v\d.\d\d.ckan/, "Commited to $identifier"); + ok($file =~ /$identifier-v\d.\d\d.ckan/, "Committed to $identifier"); } } diff --git a/t/data/NetKAN/NetKAN/DogeCoinFlagStaged.netkan b/t/data/NetKAN/NetKAN/DogeCoinFlagStaged.netkan index add8d21..a0ef06d 100644 --- a/t/data/NetKAN/NetKAN/DogeCoinFlagStaged.netkan +++ b/t/data/NetKAN/NetKAN/DogeCoinFlagStaged.netkan @@ -1,5 +1,5 @@ { - "spec_version" : 1, + "spec_version" : "v1.10", "identifier" : "DogeCoinFlagStaged", "name" : "Dogecoin Flag Staged", "abstract" : "Such flag. Very Staged. Wow.",