4 |
package Arh::Bootstrap; |
package Arh::Bootstrap; |
5 |
use base qw(Jifty::Bootstrap); |
use base qw(Jifty::Bootstrap); |
6 |
|
|
7 |
|
use Data::Dump qw/dump/; |
8 |
|
|
9 |
=head1 Bootstrap application data |
=head1 Bootstrap application data |
10 |
|
|
11 |
Create initial data |
Create initial data |
13 |
=cut |
=cut |
14 |
|
|
15 |
sub run { |
sub run { |
16 |
|
warn "## run",dump(@_); |
17 |
my $self = shift; |
my $self = shift; |
18 |
|
|
19 |
my $system_user = Arh::CurrentUser->superuser( _bootstrap => 1 ); |
my $system_user = Arh::CurrentUser->superuser( _bootstrap => 1 ); |
20 |
|
|
|
my $user = Arh::Model::User->new; |
|
21 |
|
|
22 |
$user->create( |
my $u = Arh::Model::User->new(current_user => $system_user); |
23 |
|
|
24 |
|
$u->create( |
25 |
name => 'Admin', |
name => 'Admin', |
26 |
lastname => 'User', |
lastname => 'User', |
27 |
email => 'admin@example.com', |
email => 'admin@example.com', |
28 |
email_confirmed => 1, |
email_confirmed => 1, |
29 |
password => 'siteadmin', |
password => 'password', |
30 |
administrator => 1, |
administrator => 1, |
31 |
organization => 'Site administrator', |
organization => 'Site administrator', |
32 |
); |
); |
33 |
|
|
34 |
|
$u->create( |
35 |
|
name => 'Anonymous', |
36 |
|
lastname => 'User', |
37 |
|
email => 'anonymous@example.com', |
38 |
|
email_confirmed => 1, |
39 |
|
password => 'password', |
40 |
|
administrator => 0, |
41 |
|
organization => 'Part of anonymous user crowd', |
42 |
|
); |
43 |
|
|
44 |
my $pt = Arh::Model::PictureType->new(current_user => $system_user); |
my $pt = Arh::Model::PictureType->new(current_user => $system_user); |
45 |
|
|
46 |
$pt->create( name => $_ ) foreach ( qw/ |
$pt->create( name => $_ ) foreach ( qw/ |
55 |
my $chronology = Arh::Model::Chronology->new(current_user => $system_user); |
my $chronology = Arh::Model::Chronology->new(current_user => $system_user); |
56 |
$chronology->create( |
$chronology->create( |
57 |
name => 'kraj 8. stoljeća', |
name => 'kraj 8. stoljeća', |
58 |
|
from_year => 760, |
59 |
|
to_year => 800, |
60 |
); |
); |
61 |
|
|
62 |
my $material = Arh::Model::Material->new; |
my $material = Arh::Model::Material->new; |