| 1 | use warnings; | ||
| 2 | use strict; | ||
| 3 | |||
| 4 | package Jifty::Bootstrap; | ||
| 5 | |||
| 6 | use base qw/Jifty::Object/; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | Jifty::Bootstrap - Insert initial data into your database | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | C<Jifty::Bootstrap> is an abstract base class for your application's | ||
| 15 | bootstrapping. Use it to set up initial data in your database when | ||
| 16 | your application is first installed. | ||
| 17 | |||
| 18 | =head1 EXAMPLE | ||
| 19 | |||
| 20 | package MyApp::Bootstrap; | ||
| 21 | use base 'Jifty::Bootstrap'; | ||
| 22 | |||
| 23 | sub run { | ||
| 24 | my $user = MyApp::CurrentUser->new( _bootstrap => 1); | ||
| 25 | my $modelclass = MyApp::Model::Thingy->new(current_user => $user); | ||
| 26 | $modelclass->create( name => 'Widget'); | ||
| 27 | }; | ||
| 28 | |||
| 29 | =head2 run | ||
| 30 | |||
| 31 | C<run> is the workhorse method for the Bootstrap class. This takes care of | ||
| 32 | setting up internal data structures and initializing things in an | ||
| 33 | application-dependent manner. | ||
| 34 | |||
| 35 | =cut | ||
| 36 | |||
| 37 | sub run { | ||
| 38 | 1; | ||
| 39 | } | ||
| 40 | |||
| 41 | =head1 SEE ALSO | ||
| 42 | |||
| 43 | L<Jifty::Upgrade>, L<Jifty::Script::Schema> | ||
| 44 | |||
| 45 | =head1 LICENSE | ||
| 46 | |||
| 47 | Jifty is Copyright 2005-2010 Best Practical Solutions, LLC. | ||
| 48 | Jifty is distributed under the same terms as Perl itself. | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | 1; |