/[transports]/trunk/lib/Transports/Bootstrap.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/Transports/Bootstrap.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 27 - (show annotations)
Fri May 26 21:21:25 2006 UTC (17 years, 11 months ago) by dpavlin
File size: 1273 byte(s)
added admin column to users, better bootstrap data
1 use warnings;
2 use strict;
3
4 package Transports::Bootstrap;
5 use base qw(Jifty::Bootstrap);
6
7 =head1 Bootstrap application data
8
9 Create initial data
10
11 =cut
12
13 sub run {
14 my $self = shift;
15
16 my $system_user = Transports::CurrentUser->superuser( _bootstrap => 1 );
17
18 my $u1 = Transports::Model::User->new(current_user => $system_user);
19 $u1->create(
20 name => 'System administrator',
21 email => 'admin@example.com',
22 password => 'admin',
23 admin => 1,
24 );
25
26 my $u2 = Transports::Model::User->new(current_user => $system_user);
27 $u2->create(
28 name => 'Normal User',
29 email => 'user@example.com',
30 password => 'user',
31 );
32
33 my $s;
34
35 foreach my $i ( 0 ... 5 ) {
36 $s->{$i} = Transports::Model::Source->new(current_user => $system_user);
37 $s->{$i}->create(
38 name => 'SRC/' . ($i + 1),
39 );
40 }
41
42 my $d;
43
44 foreach my $i ( 0 ... 2 ) {
45 $d->{$i} = Transports::Model::Destination->new(current_user => $system_user);
46 $d->{$i}->create(
47 name => 'DEST/' . ($i + 1),
48 );
49 }
50
51 foreach my $i ( 1 ... 7 ) {
52 my $t = Transports::Model::Transport->new(current_user => $system_user);
53 $t->create(
54 source => $s->{ $i % 5 },
55 destination => $d->{ $i % 2 },
56 request_nr => $i,
57 client_dependent => $i % 3 == 0 ? 0 : 1,
58 created_by => $i % 2 == 0 ? $u1 : $u2,
59 );
60 }
61
62 }
63
64
65 1;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26