summaryrefslogtreecommitdiffstats
path: root/lib/Narwhal.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-01-26 14:56:23 -0600
committerJesse Luehrs <doy@tozt.net>2011-01-26 14:56:23 -0600
commit0d2b29fd9d932f909f46209d17963752379ea545 (patch)
treee27792b5aa077339b22d8d6c6bd9597d296f519a /lib/Narwhal.pm
parentaf5867fd48b84c7ea1cba67574294334bb2cc19e (diff)
downloadnarwhal-0d2b29fd9d932f909f46209d17963752379ea545.tar.gz
narwhal-0d2b29fd9d932f909f46209d17963752379ea545.zip
initial sketch
Diffstat (limited to 'lib/Narwhal.pm')
-rw-r--r--lib/Narwhal.pm43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/Narwhal.pm b/lib/Narwhal.pm
index e69de29..240b504 100644
--- a/lib/Narwhal.pm
+++ b/lib/Narwhal.pm
@@ -0,0 +1,43 @@
+package Narwhal;
+use OX;
+
+config kioku_dsn => 'dbi:SQLite:narwhal.db';
+config kioku_extra_args => sub { { create => 1 } };
+config template_root => sub {
+ shift->param('app_root')->subdir('root', 'templates')
+}, (app_root => depends_on('/app_root'));
+
+component Redirect => 'Narwhal::Component::Redirect';
+
+component Wiki => 'Narwhal::Component::Wiki', (
+ kioku => depends_on('/Component/Kioku'),
+ tt => depends_on('/Component/TT'),
+);
+
+# turn these two into specialized classes later
+component TT => 'Template', (
+ INCLUDE_PATH => depends_on('/Config/template_root'),
+);
+
+component Kioku => 'KiokuX::Model', (
+ dsn => depends_on('/Config/kioku_dsn'),
+ extra_args => depends_on('/Config/kioku_extra_args'),
+);
+
+router as {
+ route '/' => 'redirect.permanent', (
+ to => '/page/main',
+ );
+ route '/page/:page_name' => 'wiki.page', (
+ page_name => { isa => 'Str' },
+ );
+ route '/edit/:page_name' => 'wiki.edit', (
+ page_name => { isa => 'Str' },
+ );
+}, (
+ redirect => depends_on('/Component/Redirect'),
+ wiki => depends_on('/Component/Wiki'),
+);
+
+no OX;
+1;