[Jifty-commit] r752 - in BlogDemo/trunk: . bin doc lib lib/BlogDemo
lib/BlogDemo/Action lib/BlogDemo/Model log t var web
web/static web/templates
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Mon Mar 27 21:59:56 EST 2006
Author: jesse
Date: Mon Mar 27 21:59:53 2006
New Revision: 752
Added:
BlogDemo/trunk/Makefile.PL
BlogDemo/trunk/bin/
BlogDemo/trunk/bin/jifty (contents, props changed)
BlogDemo/trunk/blogdemo (contents, props changed)
BlogDemo/trunk/doc/
BlogDemo/trunk/etc/
BlogDemo/trunk/etc/config.yml
BlogDemo/trunk/lib/
BlogDemo/trunk/lib/BlogDemo/
BlogDemo/trunk/lib/BlogDemo/Action/
BlogDemo/trunk/lib/BlogDemo/Dispatcher.pm
BlogDemo/trunk/lib/BlogDemo/Model/
BlogDemo/trunk/lib/BlogDemo/Model/Entry.pm
BlogDemo/trunk/log/
BlogDemo/trunk/t/
BlogDemo/trunk/t/00-model-Entry.t
BlogDemo/trunk/var/
BlogDemo/trunk/web/
BlogDemo/trunk/web/static/
BlogDemo/trunk/web/templates/
BlogDemo/trunk/web/templates/index.html
BlogDemo/trunk/web/templates/new_entry.html
Log:
* initial checkin
Added: BlogDemo/trunk/Makefile.PL
==============================================================================
--- (empty file)
+++ BlogDemo/trunk/Makefile.PL Mon Mar 27 21:59:53 2006
@@ -0,0 +1,6 @@
+use inc::Module::Install;
+name('BlogDemo');
+version('0.01');
+requires('Jifty' => '0.60321');
+
+WriteAll;
Added: BlogDemo/trunk/bin/jifty
==============================================================================
--- (empty file)
+++ BlogDemo/trunk/bin/jifty Mon Mar 27 21:59:53 2006
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
+ if 0; # not running under some shell
+use warnings;
+use strict;
+use File::Basename qw(dirname);
+use UNIVERSAL::require;
+
+BEGIN {
+ Jifty::Util->require or die $UNIVERSAL::require::ERROR;
+ my $root = Jifty::Util->app_root;
+ unshift @INC, "$root/lib" if ($root);
+}
+
+use Jifty::Script;
+Jifty::Script->dispatch();
Added: BlogDemo/trunk/blogdemo
==============================================================================
Binary file. No diff available.
Added: BlogDemo/trunk/etc/config.yml
==============================================================================
--- (empty file)
+++ BlogDemo/trunk/etc/config.yml Mon Mar 27 21:59:53 2006
@@ -0,0 +1,37 @@
+---
+framework:
+ ActionBasePath: BlogDemo::Action
+ AdminMode: 1
+ ApplicationClass: BlogDemo
+ ApplicationName: BlogDemo
+ CurrentUserClass: BlogDemo::CurrentUser
+ LogLevel: DEBUG
+ Database:
+ Database: blogdemo
+ Driver: SQLite
+ Host: localhost
+ Password: ''
+ RecordBaseClass: Jifty::DBI::Record::Cachable
+ User: ''
+ Version: 0.0.1
+ DevelMode: 1
+ Mailer: Sendmail
+ MailerArgs: []
+
+ Web:
+ BaseURL: http://localhost
+ DataDir: var/mason
+ DefaultStaticRoot: /usr/local/share/perl/5.8.7/auto/Jifty/web/static
+ DefaultTemplateRoot: /usr/local/share/perl/5.8.7/auto/Jifty/web/templates
+ Globals: []
+
+ MasonConfig:
+ autoflush: 0
+ default_escape_flags: h
+ error_format: text
+ error_mode: fatal
+ Port: 8888
+ ServeStaticFiles: 1
+ SessionDir: var/session
+ StaticRoot: web/static
+ TemplateRoot: web/templates
Added: BlogDemo/trunk/lib/BlogDemo/Dispatcher.pm
==============================================================================
--- (empty file)
+++ BlogDemo/trunk/lib/BlogDemo/Dispatcher.pm Mon Mar 27 21:59:53 2006
@@ -0,0 +1,23 @@
+use warnings;
+use strict;
+
+package BlogDemo::Dispatcher;
+use Jifty::Dispatcher -base;
+
+
+on '/' => run {
+ my $entries = BlogDemo::Model::EntryCollection->new();
+ $entries->unlimit();
+
+ set entries => $entries;
+};
+
+on '/new_entry.html' => run {
+ my $create = Jifty->web->new_action(
+ class => 'CreateEntry',
+ moniker => 'create');
+
+ set create => $create;
+};
+
+1;
Added: BlogDemo/trunk/lib/BlogDemo/Model/Entry.pm
==============================================================================
--- (empty file)
+++ BlogDemo/trunk/lib/BlogDemo/Model/Entry.pm Mon Mar 27 21:59:53 2006
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+
+package BlogDemo::Model::Entry::Schema;
+use Jifty::DBI::Schema;
+
+# Your column definitions go here. See L<Jifty::DBI::Schema> for
+# documentation about how to write column definitions.
+
+column title =>
+ type is 'text',
+ default is 'Untitled';
+
+
+column body =>
+ type is 'text',
+ render_as 'Textarea';
+
+
+
+package BlogDemo::Model::Entry;
+use base qw/BlogDemo::Record/;
+
+# Your model-specific methods go here.
+
+1;
+
Added: BlogDemo/trunk/t/00-model-Entry.t
==============================================================================
--- (empty file)
+++ BlogDemo/trunk/t/00-model-Entry.t Mon Mar 27 21:59:53 2006
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+
+=head1 DESCRIPTION
+
+A basic test harness for the Entry model.
+
+=cut
+
+use Jifty::Test tests => 11;
+
+# Make sure we can load the model
+use_ok('BlogDemo::Model::Entry');
+
+# Grab a system use
+my $system_user = BlogDemo::CurrentUser->superuser;
+ok($system_user, "Found a system user");
+
+# Try testing a create
+my $o = BlogDemo::Model::Entry->new(current_user => $system_user);
+my ($id) = $o->create();
+ok($id, "Entry create returned success");
+ok($o->id, "New Entry has valid id set");
+is($o->id, $id, "Create returned the right id");
+
+# And another
+$o->create();
+ok($o->id, "Entry create returned another value");
+isnt($o->id, $id, "And it is different from the previous one");
+
+# Searches in general
+my $collection = BlogDemo::Model::EntryCollection->new(current_user => $system_user);
+$collection->unlimit;
+is($collection->count, 2, "Finds two records");
+
+# Searches in specific
+$collection->limit(column => 'id', value => $o->id);
+is($collection->count, 1, "Finds one record with specific id");
+
+# Delete one of them
+$o->delete;
+$collection->redo_search;
+is($collection->count, 0, "Deleted row is gone");
+
+# And the other one is still there
+$collection->unlimit;
+is($collection->count, 1, "Still one left");
+
Added: BlogDemo/trunk/web/templates/index.html
==============================================================================
--- (empty file)
+++ BlogDemo/trunk/web/templates/index.html Mon Mar 27 21:59:53 2006
@@ -0,0 +1,11 @@
+<%args>
+$entries
+</%args>
+<&|/_elements/wrapper&>
+% while (my $entry = $entries->next) {
+ <h2><%$entry->title%></h2>
+ <div class="body">
+ <%$entry->body%>
+ </div>
+% }
+</&>
Added: BlogDemo/trunk/web/templates/new_entry.html
==============================================================================
--- (empty file)
+++ BlogDemo/trunk/web/templates/new_entry.html Mon Mar 27 21:59:53 2006
@@ -0,0 +1,12 @@
+<%args>
+$create
+</%args>
+<&|/_elements/wrapper, title=> 'Create an article' &>
+<%Jifty->web->form->start%>
+% foreach my $arg ($create->argument_names) {
+<%$create->form_field($arg)%>
+% }
+<%Jifty->web->form->submit( label => 'Save')%>
+<%Jifty->web->form->end%>
+</&>
+
More information about the Jifty-commit
mailing list