More documentation, clean up tests
diff --git a/Makefile.PL b/Makefile.PL
index 6063e24..0282b0e 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -12,7 +12,7 @@
BUILD_REQUIRES => {
'Test::More' => 0
},
- LICENSE => 'artistic_2',
+ LICENSE => 'bsd_2',
PREREQ_PM => {
'Mojolicious' => '5.00',
'Mojolicious::Plugin::TagHelpers::Pagination' => 0.05,
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 58558ff..0117824 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -3,7 +3,8 @@
use Mojo::ByteStream 'b';
use Mojo::JSON 'decode_json';
-our $VERSION;
+# Sync with package.json
+our $VERSION = '0.15.0';
# TODO: The FAQ-Page has a contact form for new questions
@@ -12,8 +13,8 @@
my $self = shift;
# Set version based on package file
- my $pkg = b($self->home . '/package.json')->slurp;
- $Kalamar::VERSION = decode_json($pkg)->{version};
+ # my $pkg = b($self->home . '/package.json')->slurp;
+ # $Kalamar::VERSION = decode_json($pkg)->{version};
# Add additional plugin path
push(@{$self->plugins->namespaces}, __PACKAGE__ . '::Plugin');
@@ -29,6 +30,7 @@
};
}) if $self->mode eq 'production';
+
# Cache static assets
# (not necessary, as long as shipped by nginx or Apache)
$self->hook(
@@ -56,7 +58,7 @@
'Notifications', # Client notifications
'Search', # Abstract Search framework
'CHI', # Global caching mechanism
- 'MailException' # Alert via Email on exception
+ 'MailException', # Alert via Email on exception
'TagHelpers::Pagination', # Pagination widget
'TagHelpers::MailToChiffre', # Obfuscate email addresses
'KalamarHelpers', # Specific Helpers for Kalamar
@@ -115,6 +117,39 @@
cpanm git://github.com/Akron/Mojolicious-Plugin-Localize.git
-=head2 LICENSE
+ perl Makefile.PL
+ make test
-Highlight.js is released under the BSD License.
+ morbo script/kalamar
+
+
+=head1 COPYRIGHT AND LICENSE
+
+=head2 Bundled Software
+
+C<ALERTIFY.js> is released under the terms of the MIT License.
+C<Almond> is released under the terms of the BSD License.
+C<dagre> is released under the terms of the MIT License.
+C<Highlight.js> is released under the terms of the BSD License.
+C<Jasmine> is released under the terms of the MIT License.
+C<RequireJS> is released under the terms of the BSD License.
+
+
+=head2 Original Software
+
+Copyright (C) 2015, L<IDS Mannheim|http://www.ids-mannheim.de/>
+Author: L<Nils Diewald|http://nils-diewald.de/>
+
+Kalamar is developed as part of the L<KorAP|http://korap.ids-mannheim.de/>
+Corpus Analysis Platform at the
+L<Institute for the German Language (IDS)|http://ids-mannheim.de/>,
+member of the
+L<Leibniz-Gemeinschaft|http://www.leibniz-gemeinschaft.de/en/about-us/leibniz-competition/projekte-2011/2011-funding-line-2/>
+and supported by the L<KobRA|http://www.kobra.tu-dortmund.de> project,
+funded by the
+L<Federal Ministry of Education and Research (BMBF)|http://www.bmbf.de/en/>.
+
+Kalamar is free software published under the
+L<BSD-2 License|https://raw.githubusercontent.com/KorAP/Kalamar/master/LICENSE).
+
+=cut
diff --git a/package.json b/package.json
index b9bc140..1f20922 100755
--- a/package.json
+++ b/package.json
@@ -1,14 +1,14 @@
{
"name": "Kalamar",
+ "description": "Mojolicious based Frontend for KorAP",
"version": "0.15.0",
- "description": "User Frontend for KorAP",
"devDependencies": {
- "grunt": "~0.4.5",
- "grunt-contrib-copy": "^0.8.0",
- "grunt-contrib-imagemin": "^0.9.4",
- "grunt-contrib-jasmine": "^0.8.2",
- "grunt-contrib-sass": "^0.9.2",
- "grunt-contrib-watch": "^0.6.1",
+ "grunt": "~0.4.5",
+ "grunt-contrib-copy": "^0.8.0",
+ "grunt-contrib-imagemin": "^0.9.4",
+ "grunt-contrib-jasmine": "^0.8.2",
+ "grunt-contrib-sass": "^0.9.2",
+ "grunt-contrib-watch": "^0.6.1",
"grunt-contrib-requirejs": "^0.4.4"
}
}
diff --git a/t/api-v0.1.t b/t/api-v0.1.t
index 6295421..4d8a560 100644
--- a/t/api-v0.1.t
+++ b/t/api-v0.1.t
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More;
+use Test::More skip_all => 'No remote tests';
use Test::Mojo;
use Mojo::JSON;
use Mojo::ByteStream 'b';
@@ -29,7 +29,8 @@
->status_is(200)
->json_is('/0/managed', Mojo::JSON->true)
->json_is('/0/name', 'Wikipedia')
- ->json_is('/0/description', 'Die freie Enzyklopädie');
+# ->json_is('/0/description', 'Die freie Enzyklopädie')
+ ;
# Get resources - query
$t->get_ok($url->clone->path('query'))
@@ -85,7 +86,6 @@
my $tx = $t->ua->build_tx('TRACE', $url->clone->path('search')->query({ q => 'contains(<s>, [orth=Test])', ql => 'poliqarp'}));
$tx = $t->ua->start($tx);
-#{"@context":"http://ids-mannheim.de/ns/korap/json-ld/v0.1/context.jsonld","query":{"@type":"korap:group","operation":"operation:position","frame":"frame:contains","operands":[{"@type":"korap:span","key":"s"},{"@type":"korap:token","wrap":{"@type":"korap:term","layer":"orth","key":"Test","match":"match:eq"}}]},"collections":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"WPD"}}],"meta":{}}
$t->tx($tx)
->json_is('/@context', 'http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld')
->json_is('/query/@type', 'korap:group')
@@ -94,10 +94,4 @@
->json_is('/query/operands/0/key', 's')
->status_is(200);
-#$t->get_ok()
-# ->content_is('')
-# ->status_is(200);
-
-
-
done_testing;
diff --git a/t/basic.t b/t/basic.t
index 7511236..7810313 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -6,7 +6,7 @@
my $t = Test::Mojo->new('Kalamar');
$t->get_ok('/')
->status_is(200)
- ->text_is('title', 'KorAP')
- ->text_like('h1 span', qr/Korpusanalyseplattform/i);
+ ->text_is('title', 'KorAP - Corpus Analysis Platform')
+ ->text_is('h1 span', 'KorAP - Corpus Analysis Platform');
done_testing();
diff --git a/t/doc.t b/t/doc.t
index 476d4bf..1b06146 100644
--- a/t/doc.t
+++ b/t/doc.t
@@ -14,14 +14,18 @@
->element_exists('main.tutorial')
->element_exists('header')
->element_exists('aside nav')
- ->content_is('');
+ ->text_is('h1 span', 'KorAP: Poliqarp+')
+ ->element_exists('li.folded.active')
+ ->text_is('li.folded.active a', 'Poliqarp+');
$t->get_ok('/doc/ql/poliqarp-plus?embedded=true')
->status_is(200)
->text_like('title', qr/poliqarp/i)
->element_exists('aside.active')
->element_exists('main.tutorial')
- ->element_exists_not('header');
+ ->element_exists_not('header')
+ ->element_exists('li.folded.active')
+ ->text_is('li.folded.active a', 'Poliqarp+');
done_testing();
diff --git a/t/non-blocking-api.t b/t/non-blocking-api.t
index d4dcc72..d2055e1 100644
--- a/t/non-blocking-api.t
+++ b/t/non-blocking-api.t
@@ -1,7 +1,6 @@
-
use Mojo::Base -strict;
use lib '../lib', 'lib';
-use Test::More;
+use Test::More skip_all => 'No remote tests';
use Test::Mojo;
use Mojo::URL;
use Benchmark qw/:hireswallclock/;
@@ -82,7 +81,7 @@
my $matchtemplate = <<'MATCHTEMPLATE';
<p id="api"><%= search->api %></p>
<p id="api_request"><%= search->api_request %></p>
-<p id="search-result"><%= search->results->first->{docID} %></p>
+<p id="search-result"><%= search->results->first->{docID} . '.' . search->results->first->{textID} %></p>
MATCHTEMPLATE
@@ -92,6 +91,7 @@
$c->search->match(
corpus_id => $c->param('corpus_id'),
doc_id => $c->param('doc_id'),
+ text_id => $c->param('text_id'),
match_id => $c->param('match_id'),
foundry => '*',
sub {
@@ -163,11 +163,11 @@
->status_is(200)
->text_is('#search-resource', 'Wikipedia');
-
# http://10.0.10.14:6666/corpus/WPD/WWW.04738/p265-266
$t->get_ok(Mojo::URL->new('/matchinfo')->query({
corpus_id => 'WPD',
- doc_id => 'WWW.04738',
+ doc_id => 'WWW',
+ text_id => '04738',
match_id => 'p265-266'
}))
->status_is(200)
diff --git a/t/remote.t b/t/remote.t
index e08bba2..30156ea 100644
--- a/t/remote.t
+++ b/t/remote.t
@@ -1,32 +1,29 @@
use Mojo::Base -strict;
use lib '../lib', 'lib';
-use Test::More;
+use Test::More skip_all => 'No remote tests';
use Test::Mojo;
my $t = Test::Mojo->new('Kalamar');
$t->get_ok('/')
->status_is(200)
- ->text_is('title', 'KorAP')
- ->text_like('h1 span', qr/Korpusanalyseplattform/i)
+ ->text_is('title', 'KorAP - Corpus Analysis Platform')
+ ->text_like('h1 span', qr/KorAP - Corpus Analysis Platform/i)
;
# Check paging
$t->get_ok('/?q=test')
- ->text_is('pre.query.serial span', 'JSON-LD Serialization for "test"')
- ->text_like('#total-results', qr/\d+ matches$/)
- ->element_exists('[title=Alignment]')
+ ->text_like('h1 span', qr/KorAP: Find "test"/i)
+ # ->text_is('pre.query.serial span', 'JSON-LD Serialization for "test"')
+ ->text_like('#total-results', qr/\d+$/)
->text_is('#pagination a[rel=self] span', 1)
;
# Check paging
$t->get_ok('/?q=test&p=2')
- ->text_is('pre.query.serial span', 'JSON-LD Serialization for "test"')
- ->text_like('#total-results', qr/\d+ matches$/)
+ # ->text_is('pre.query.serial span', 'JSON-LD Serialization for "test"')
+ ->text_like('#total-results', qr/\d+$/)
->text_is('#pagination a[rel=self] span', 2)
;
-# $t->get_ok('/tutorial?testing=1')
-# ->text_like('div.test p.pass', qr/Pass: [1-9]/)
-# ;
-
-done_testing();
+done_testing;
+__END__