Skip to content

Loading…

please accept this request , what is fixed kamui.pl #1

Merged
merged 1 commit into from

2 participants

@masartz
  • script/kamui.pl

MyAPP/Web/Hander.pm ではなくMyAPP/Web.pm を作成してしまう
MyAPP::Web::Hander が Kamui::View::TT をviewにするようになっているので、tmplをtt形式に
kamui.pl自体のパース部分を変更

  • Makefile.PL
    必要なモジュール追加

  • lib/Kamui/Manual/JA/Tutorial.pod

tmpl のファイル構成を変えたため追従

  • t/30xxx.t typo修正

以上、よろしくお願いいたします

@nekokak nekokak merged commit c31db8c into nekokak:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 26, 2012
  1. @masartz

    fixed set-up script & typo

    masartz committed
View
2 Makefile.PL
@@ -18,6 +18,8 @@ requires 'Template';
requires 'Template::Stash::EscapeHTML';
requires 'Scalar::Util';
requires 'FormValidator::Lite';
+requires 'JSON::XS';
+requires 'Text::MicroTemplate::Extended';
test_requires 'Test::More';
test_requires 'Test::Exception';
View
4 lib/Kamui/Manual/JA/Tutorial.pod
@@ -31,7 +31,9 @@ Kamui::Manual::JA::Tutorial - Kamui 日本語チュートリアル
| |-- script
| | `-- Hello.psgi
| `-- tmpl
- | |-- base.html
+ | `-- common
+ | `-- header.html
+ | `-- footer.html
| `-- root
| `-- index.html
|-- config.pl
View
60 script/kamui.pl
@@ -14,28 +14,28 @@
my $confsrc = <<'...';
-- lib/$path.pm
-package [%= $module %];
+package <%= $module %>;
1;
--- lib/$path/Web.pm
-package [%= $module %]::Web;
+-- lib/$path/Web/Handler.pm
+package <%= $module %>::Web::Handler;
use Kamui;
-use base 'Kamui::Web';
+use base 'Kamui::Web::Handler';
-use [%= $module %]::Web::Context;
-sub context {'[%= $module %]::Web::Context'}
+use <%= $module %>::Web::Context;
+sub context {'<%= $module %>::Web::Context'}
-use [%= $module %]::Web::Dispatcher;
-sub dispatcher {'[%= $module %]::Web::Dispatcher'}
+use <%= $module %>::Web::Dispatcher;
+sub dispatcher {'<%= $module %>::Web::Dispatcher'}
sub view {'Kamui::View::TT'}
sub plugins {['Encode']}
-use [%= $module %]::Container -no_export;
-sub container { [%= $module %]::Container->instance }
+use <%= $module %>::Container -no_export;
+sub container { <%= $module %>::Container->instance }
1;
-- lib/$path/Web/Dispatcher.pm
-package [%= $module %]::Web::Dispatcher;
+package <%= $module %>::Web::Dispatcher;
use Kamui::Web::Dispatcher;
on '/' => run {
@@ -44,12 +44,12 @@ package [%= $module %]::Web::Dispatcher;
1;
-- lib/$path/Web/Context.pm
-package [%= $module %]::Web::Context;
+package <%= $module %>::Web::Context;
use Kamui;
use base 'Kamui::Web::Context';
1;
-- lib/$path/Web/Controller/Root.pm
-package [%= $module %]::Web::Controller::Root;
+package <%= $module %>::Web::Controller::Root;
use Kamui::Web::Controller -base;
__PACKAGE__->add_trigger(
@@ -60,11 +60,13 @@ package [%= $module %]::Web::Controller::Root;
sub do_index {
my ($class, $c, $args) = @_;
+ $c->stash->{title} = 'kamui page';
+ $c->stash->{content} = 'hello, Kamui world!';
}
1;
-- lib/$path/Container.pm
-package [%= $module %]::Container;
+package <%= $module %>::Container;
use Kamui::Container -base;
register foo => sub {
@@ -72,39 +74,38 @@ package [%= $module %]::Container;
};
1;
--- assets/tmpl/root/index.html
-? extends 'base.html';
-? block title => 'kamui page';
-? block content => sub { 'hello, Kamui world!' };
--- assets/tmpl/base.html
+-- assets/tmpl/common/header.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title><? block title => 'Kamui' ?></title>
+ <title>[% title | html %]</title>
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
</head>
+-- assets/tmpl/root/index.html
+[% INCLUDE common/header.html %]
<body>
<div id="Container">
<div id="Header">
<a href="/">Kamui Startup Page</a>
</div>
<div id="Content">
- <? block content => 'body here' ?>
+ [% content | html %]
</div>
<div id="Footer">
Powered by Kamui
</div>
</div>
</body>
+[% INCLUDE common/footer.html %]
+-- assets/tmpl/common/footer.html
</html>
-- assets/script/$dist.psgi
-use [%= $module %]::Web::Handler;
-use [%= $module %]::Container;
+use <%= $module %>::Web::Handler;
+use <%= $module %>::Container;
use Plack::Builder;
-my $app = [%= $module %]::Web::Handler->new;
-$app->setup;
+my $app = <%= $module %>::Web::Handler->new;
my $home = container('home');
builder {
@@ -116,14 +117,14 @@ package [%= $module %]::Container;
};
-- config.pl
use Kamui;
-use [%= $module %]::Container;
+use <%= $module %>::Container;
use Path::Class;
my $home = container('home');
return +{
view => {
- mt => +{
+ tt => +{
path => $home->file('assets/tmpl')->stringify,
},
},
@@ -167,6 +168,7 @@ sub main {
_mkpath "assets/htdocs/css/";
_mkpath "assets/htdocs/img/";
_mkpath "assets/tmpl/root/";
+ _mkpath "assets/tmpl/common/";
_mkpath "assets/script/";
_mkpath "t/";
@@ -174,8 +176,8 @@ sub main {
while (my ($file, $tmpl) = each %$conf) {
$file =~ s/(\$\w+)/$1/gee;
my $code = Text::MicroTemplate->new(
- tag_start => '[%',
- tag_end => '%]',
+ tag_start => '<%',
+ tag_end => '%>',
line_start => '%',
template => $tmpl,
)->code;
View
2 t/030_plugin/mobile/agent.t
@@ -5,7 +5,7 @@ use Mock::Web::Handler;
BEGIN {
eval "use HTTP::MobileAgent";
- plan skip_all => 'needs HTP::MobileAgent for testing' if $@;
+ plan skip_all => 'needs HTTP::MobileAgent for testing' if $@;
};
my $plugins = [qw/Mobile::Agent/];
View
2 t/030_plugin/mobile/css_filter.t
@@ -6,7 +6,7 @@ use Mock::Container;
BEGIN {
eval "use HTTP::MobileAgent";
- plan skip_all => 'needs HTP::MobileAgent for testing' if $@;
+ plan skip_all => 'needs HTTP::MobileAgent for testing' if $@;
eval "use HTML::MobileJpCSS";
plan skip_all => 'needs HTML::MobileJpCSS for testing' if $@;
};
View
2 t/030_plugin/mobile/docomo_guid_filter.t
@@ -5,7 +5,7 @@ use Mock::Web::Handler;
BEGIN {
eval "use HTTP::MobileAgent";
- plan skip_all => 'needs HTP::MobileAgent for testing' if $@;
+ plan skip_all => 'needs HTTP::MobileAgent for testing' if $@;
eval "use HTML::StickyQuery::DoCoMoGUID";
plan skip_all => 'needs HTML::StickyQuery::DoCoMoGUID for testing' if $@;
};
View
2 t/030_plugin/mobile/emoji_filter.t
@@ -5,7 +5,7 @@ use Mock::Web::Handler;
BEGIN {
eval "use HTTP::MobileAgent";
- plan skip_all => 'needs HTP::MobileAgent for testing' if $@;
+ plan skip_all => 'needs HTTP::MobileAgent for testing' if $@;
};
my $plugins = [qw/Encode Mobile::EmojiFilter/];
Something went wrong with that request. Please try again.