Cleanup static files
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index 31cd35e..929e481 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -3,18 +3,24 @@
use Mojo::ByteStream 'b';
use Mojo::JSON 'decode_json';
-# Sync with package.json
-our $VERSION = '0.15.0';
+# Minor version - may be patched from package.json
+our $VERSION = '0.15';
# TODO: The FAQ-Page has a contact form for new questions
+# TODO: Embed query serialization
+# TODO: Embed collection statistics
+# TODO: Implement tab opener for matches and the tutorial
+# TODO: Make the tutorial ql sensitive
+# TODO: Implement a "projects" system
# Start the application and register all routes and plugins
sub startup {
my $self = shift;
# Set version based on package file
- # my $pkg = b($self->home . '/package.json')->slurp;
- # $Kalamar::VERSION = decode_json($pkg)->{version};
+ # This may introduce a SemVer patch number
+ my $pkg = b($self->home . '/package.json')->slurp;
+ $Kalamar::VERSION = decode_json($pkg)->{version};
# Add additional plugin path
push(@{$self->plugins->namespaces}, __PACKAGE__ . '::Plugin');
@@ -31,26 +37,21 @@
}) if $self->mode eq 'production';
- # Cache static assets
- # (not necessary, as long as shipped by nginx or Apache)
- $self->hook(
- after_static => sub {
- my $res = shift->res;
- if ($res->code) {
- $res->headers->cache_control('public, max-age=172800');
- };
- });
-
# Set secrets for signed cookies
if (-e (my $secret = $self->home . '/kalamar.secret')) {
# Load file and split lines for multiple secrets
$self->secrets([b($secret)->slurp->split("\n")]);
}
+
+ # File not found ...
+ # Kalamar needs secrets in a file to be easily deployable
+ # and publishable at the same time.
else {
$self->log->warn('Please create a kalamar.secret file');
};
+
# Load plugins
foreach (
'Config', # Configuration framework
@@ -58,7 +59,7 @@
'Notifications', # Client notifications
'Search', # Abstract Search framework
'CHI', # Global caching mechanism
- 'MailException', # Alert via Email on exception
+ 'MailException', # Alert via Email on exceptions
'TagHelpers::Pagination', # Pagination widget
'TagHelpers::MailToChiffre', # Obfuscate email addresses
'KalamarHelpers', # Specific Helpers for Kalamar
@@ -66,13 +67,16 @@
$self->plugin($_);
};
+
# Configure mail exception
$self->plugin('MailException' => $self->config('MailException'));
+
# Configure documentation navigation
my $navi = b($self->home . '/templates/doc/navigation.json')->slurp;
$self->config(navi => decode_json($navi)) if $navi;
+
# Establish routes
my $r = $self->routes;
@@ -121,13 +125,12 @@
=head2 Generate Static Asset Files
To generate the static asset files (scripts, styles, images ...),
-you need NodeJS E<gt> 0.8 and Grunt. To install Grunt, just run
+you need NodeJS E<gt> 0.8. This will probably need administration
+rights.
- $ sudo npm install -g grunt-cli
$ npm install
$ grunt
-
=head2 Start Server
Kalamar uses the L<Mojolicious|http://mojolicio.us/> framework,
@@ -135,13 +138,16 @@
The recommended environment is based on L<Perlbrew|http://perlbrew.pl/>
with L<App::cpanminus>.
-Some perl modules are not on CPAN yet,
-so you need to install them from GitHub.
-The easiest way to do this is running
+Some perl modules are not on CPAN yet, so you need to install them from GitHub.
+The easiest way to do this is using L<App:cpanminus>.
+This will probably need administration rights.
$ cpanm git://github.com/Akron/Mojolicious-Plugin-Search.git
- $ cpanm git://github.com/Akron/Mojolicious-Plugin-Localize.git
- $ cpanm --installdeps .
+ $ cpanm --force git://github.com/Akron/Mojolicious-Plugin-Localize.git
+
+Then install the dependencies as always and run the test suite.
+There is no need to install Kalamar on your system.
+
$ perl Makefile.PL
$ make test
@@ -149,7 +155,9 @@
L<Mojolicious apps|http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook#DEPLOYMENT>.
The easiest way is to start the built-in server:
- $ perl script/kalamar deamon
+ $ perl script/kalamar daemon
+
+Kalamar will then be available at C<localhost:3000> in your browser.
=head1 COPYRIGHT AND LICENSE