... | ... |
@@ -335,6 +335,7 @@ sub original_project { |
335 | 335 |
croak "Original project don't eixsts." unless defined $original_project_row_id; |
336 | 336 |
|
337 | 337 |
# Original project |
338 |
+ $DB::single = 1 if $main::x; |
|
338 | 339 |
my $original_project = $dbi->model('project')->select( |
339 | 340 |
[ |
340 | 341 |
{__MY__ => '*'}, |
... | ... |
@@ -394,175 +395,6 @@ sub rename_project { |
394 | 395 |
croak $error if $error; |
395 | 396 |
} |
396 | 397 |
|
397 |
-sub is_database_v1 { |
|
398 |
- my $self = shift; |
|
399 |
- |
|
400 |
- # If project.user_id exists, that database is version 1 |
|
401 |
- my $user_id; |
|
402 |
- eval { $user_id = $self->app->dbi->model('project')->select('user_id', append => 'limit 0, 1') }; |
|
403 |
- |
|
404 |
- my $is_v1 = defined $user_id ? 1 : 0; |
|
405 |
- |
|
406 |
- return $is_v1; |
|
407 |
-} |
|
408 |
- |
|
409 |
-sub setup_database { |
|
410 |
- my $self = shift; |
|
411 |
- |
|
412 |
- my $dbi = $self->app->dbi; |
|
413 |
- |
|
414 |
- # Create user table |
|
415 |
- eval { |
|
416 |
- my $sql = <<"EOS"; |
|
417 |
-create table user ( |
|
418 |
- row_id integer primary key autoincrement, |
|
419 |
- id not null unique default '', |
|
420 |
- email not null unique default '' |
|
421 |
-); |
|
422 |
-EOS |
|
423 |
- $dbi->execute($sql); |
|
424 |
- }; |
|
425 |
- |
|
426 |
- # Create user columns |
|
427 |
- my $user_columns = [ |
|
428 |
- "admin integer not null default 0", |
|
429 |
- "password not null default ''", |
|
430 |
- "salt not null default ''", |
|
431 |
- "name not null default ''" |
|
432 |
- ]; |
|
433 |
- for my $column (@$user_columns) { |
|
434 |
- eval { $dbi->execute("alter table user add column $column") }; |
|
435 |
- } |
|
436 |
- |
|
437 |
- # Check user table |
|
438 |
- eval { $dbi->select([qw/row_id id admin password salt email name/], table => 'user') }; |
|
439 |
- if ($@) { |
|
440 |
- my $error = "Can't create user table properly: $@"; |
|
441 |
- $self->app->log->error($error); |
|
442 |
- croak $error; |
|
443 |
- } |
|
444 |
- |
|
445 |
- # Create project table |
|
446 |
- eval { |
|
447 |
- my $sql = <<"EOS"; |
|
448 |
-create table project ( |
|
449 |
- row_id integer primary key autoincrement, |
|
450 |
- user integer not null default 0, |
|
451 |
- id not null, |
|
452 |
- unique(user, id) |
|
453 |
-); |
|
454 |
-EOS |
|
455 |
- $dbi->execute($sql); |
|
456 |
- }; |
|
457 |
- |
|
458 |
- # Create Project columns |
|
459 |
- my $project_columns = [ |
|
460 |
- "default_branch not null default 'master'", |
|
461 |
- "original_project integer not null default 0", |
|
462 |
- "private integer not null default 0", |
|
463 |
- "ignore_space_change integer not null default 0", |
|
464 |
- "guess_encoding integer not null default ''" |
|
465 |
- ]; |
|
466 |
- for my $column (@$project_columns) { |
|
467 |
- eval { $dbi->execute("alter table project add column $column") }; |
|
468 |
- } |
|
469 |
- |
|
470 |
- # Check project table |
|
471 |
- eval { |
|
472 |
- $dbi->select( |
|
473 |
- [qw/row_id user id default_branch original_project private ignore_space_change guess_encoding/], |
|
474 |
- table => 'project' |
|
475 |
- ); |
|
476 |
- }; |
|
477 |
- if ($@) { |
|
478 |
- my $error = "Can't create project table properly: $@"; |
|
479 |
- $self->app->log->error($error); |
|
480 |
- croak $error; |
|
481 |
- } |
|
482 |
- |
|
483 |
- # Create ssh_public_key table |
|
484 |
- eval { |
|
485 |
- my $sql = <<"EOS"; |
|
486 |
-create table ssh_public_key ( |
|
487 |
- row_id integer primary key autoincrement, |
|
488 |
- key not null unique default '' |
|
489 |
-); |
|
490 |
-EOS |
|
491 |
- $dbi->execute($sql); |
|
492 |
- }; |
|
493 |
- |
|
494 |
- # Create ssh_public_key columns |
|
495 |
- my $ssh_public_key_columns = [ |
|
496 |
- "user integer not null default 0", |
|
497 |
- "title not null default ''" |
|
498 |
- ]; |
|
499 |
- for my $column (@$ssh_public_key_columns) { |
|
500 |
- eval { $dbi->execute("alter table ssh_public_key add column $column") }; |
|
501 |
- } |
|
502 |
- |
|
503 |
- # Check ssh_public_key table |
|
504 |
- eval { $dbi->select([qw/row_id user key title/], table => 'ssh_public_key') }; |
|
505 |
- if ($@) { |
|
506 |
- my $error = "Can't create ssh_public_key table properly: $@"; |
|
507 |
- $self->app->log->error($error); |
|
508 |
- croak $error; |
|
509 |
- } |
|
510 |
- |
|
511 |
- # Create collaboration table |
|
512 |
- eval { |
|
513 |
- my $sql = <<"EOS"; |
|
514 |
-create table collaboration ( |
|
515 |
- row_id integer primary key autoincrement, |
|
516 |
- project integer not null default 0, |
|
517 |
- collaborator integer not null default 0, |
|
518 |
- unique(project, collaborator) |
|
519 |
-); |
|
520 |
-EOS |
|
521 |
- $dbi->execute($sql); |
|
522 |
- }; |
|
523 |
- |
|
524 |
- # Check collaboration table |
|
525 |
- eval { $dbi->select([qw/row_id project collaborator/], table => 'collaboration') }; |
|
526 |
- if ($@) { |
|
527 |
- my $error = "Can't create collaboration table properly: $@"; |
|
528 |
- $self->app->log->error($error); |
|
529 |
- croak $error; |
|
530 |
- } |
|
531 |
- |
|
532 |
- # Create pull_request table |
|
533 |
- eval { |
|
534 |
- my $sql = <<"EOS"; |
|
535 |
-create table pull_request ( |
|
536 |
- row_id integer primary key autoincrement, |
|
537 |
- project integer not null default 0, |
|
538 |
- branch1 not null default '', |
|
539 |
- branch2 not null default '', |
|
540 |
- unique(project, branch1, branch2) |
|
541 |
-); |
|
542 |
-EOS |
|
543 |
- $dbi->execute($sql); |
|
544 |
- }; |
|
545 |
- |
|
546 |
- # Create pull_request columns |
|
547 |
- my @pull_request_columns = ( |
|
548 |
- "title not null default ''", |
|
549 |
- "open integer default 0", |
|
550 |
- "open_time integer default 0", |
|
551 |
- "open_user integer default 0" |
|
552 |
- ); |
|
553 |
- for my $column (@pull_request_columns) { |
|
554 |
- eval { $dbi->execute("alter table pull_request add column $column") }; |
|
555 |
- } |
|
556 |
- |
|
557 |
- # Check pull_request table |
|
558 |
- eval { $dbi->select([qw/row_id project branch1 branch2 title open open_time open_user/], table => 'pull_request') }; |
|
559 |
- if ($@) { |
|
560 |
- my $error = "Can't create pull_request table properly: $@"; |
|
561 |
- $self->app->log->error($error); |
|
562 |
- croak $error; |
|
563 |
- } |
|
564 |
-} |
|
565 |
- |
|
566 | 398 |
sub update_authorized_keys_file { |
567 | 399 |
my $self = shift; |
568 | 400 |
|
... | ... |
@@ -3,14 +3,189 @@ |
3 | 3 |
use FindBin; |
4 | 4 |
use lib "$FindBin::Bin/lib"; |
5 | 5 |
use lib "$FindBin::Bin/extlib/lib/perl5"; |
6 |
+use DBIx::Custom; |
|
6 | 7 |
|
7 |
-use Gitprep; |
|
8 |
+my $database_file = shift // "$FindBin::Bin/data/gitprep.db"; |
|
8 | 9 |
|
9 |
-my $app = Gitprep->new; |
|
10 |
+# DBI |
|
11 |
+my %dbi_args = ( |
|
12 |
+ dsn => "dbi:SQLite:database=$database_file", |
|
13 |
+ connector => 1, |
|
14 |
+ option => {sqlite_unicode => 1, sqlite_use_immediate_transaction => 1} |
|
15 |
+); |
|
16 |
+my $dbi = DBIx::Custom->connect(%dbi_args); |
|
10 | 17 |
|
11 |
-if ($app->manager->is_database_v1) { |
|
18 |
+# Database state |
|
19 |
+my $database_state; |
|
20 |
+if (!-f $database_file) { |
|
21 |
+ $database_state = 'empty'; |
|
22 |
+} |
|
23 |
+else { |
|
24 |
+ # If project.user_id exists, that database is version 1 |
|
25 |
+ eval { $dbi->select('user_id', table => 'project', append => 'limit 0, 1') }; |
|
26 |
+ |
|
27 |
+ if ($@) { |
|
28 |
+ $database_state = 'current'; |
|
29 |
+ } |
|
30 |
+ else { |
|
31 |
+ $database_state = 'v1'; |
|
32 |
+ } |
|
33 |
+} |
|
34 |
+ |
|
35 |
+# Need upgrade |
|
36 |
+if ($database_state eq 'v1') { |
|
12 | 37 |
die "Can't setup database. you maybe need upgrade database"; |
13 | 38 |
} |
39 |
+# Create database |
|
14 | 40 |
else { |
15 |
- $app->manager->setup_database; |
|
41 |
+ # Create user table |
|
42 |
+ eval { |
|
43 |
+ my $sql = <<"EOS"; |
|
44 |
+create table user ( |
|
45 |
+ row_id integer primary key autoincrement, |
|
46 |
+ id not null unique default '', |
|
47 |
+ email not null unique default '' |
|
48 |
+); |
|
49 |
+EOS |
|
50 |
+ $dbi->execute($sql); |
|
51 |
+ }; |
|
52 |
+ |
|
53 |
+ # Create user columns |
|
54 |
+ my $user_columns = [ |
|
55 |
+ "admin integer not null default 0", |
|
56 |
+ "password not null default ''", |
|
57 |
+ "salt not null default ''", |
|
58 |
+ "name not null default ''" |
|
59 |
+ ]; |
|
60 |
+ for my $column (@$user_columns) { |
|
61 |
+ eval { $dbi->execute("alter table user add column $column") }; |
|
62 |
+ } |
|
63 |
+ |
|
64 |
+ # Check user table |
|
65 |
+ eval { $dbi->select([qw/row_id id admin password salt email name/], table => 'user') }; |
|
66 |
+ if ($@) { |
|
67 |
+ my $error = "Can't create user table properly: $@"; |
|
68 |
+ $self->app->log->error($error); |
|
69 |
+ croak $error; |
|
70 |
+ } |
|
71 |
+ |
|
72 |
+ # Create project table |
|
73 |
+ eval { |
|
74 |
+ my $sql = <<"EOS"; |
|
75 |
+create table project ( |
|
76 |
+ row_id integer primary key autoincrement, |
|
77 |
+ user integer not null default 0, |
|
78 |
+ id not null, |
|
79 |
+ unique(user, id) |
|
80 |
+); |
|
81 |
+EOS |
|
82 |
+ $dbi->execute($sql); |
|
83 |
+ }; |
|
84 |
+ |
|
85 |
+ # Create Project columns |
|
86 |
+ my $project_columns = [ |
|
87 |
+ "default_branch not null default 'master'", |
|
88 |
+ "original_project integer not null default 0", |
|
89 |
+ "private integer not null default 0", |
|
90 |
+ "ignore_space_change integer not null default 0", |
|
91 |
+ "guess_encoding integer not null default ''" |
|
92 |
+ ]; |
|
93 |
+ for my $column (@$project_columns) { |
|
94 |
+ eval { $dbi->execute("alter table project add column $column") }; |
|
95 |
+ } |
|
96 |
+ |
|
97 |
+ # Check project table |
|
98 |
+ eval { |
|
99 |
+ $dbi->select( |
|
100 |
+ [qw/row_id user id default_branch original_project private ignore_space_change guess_encoding/], |
|
101 |
+ table => 'project' |
|
102 |
+ ); |
|
103 |
+ }; |
|
104 |
+ if ($@) { |
|
105 |
+ my $error = "Can't create project table properly: $@"; |
|
106 |
+ $self->app->log->error($error); |
|
107 |
+ croak $error; |
|
108 |
+ } |
|
109 |
+ |
|
110 |
+ # Create ssh_public_key table |
|
111 |
+ eval { |
|
112 |
+ my $sql = <<"EOS"; |
|
113 |
+create table ssh_public_key ( |
|
114 |
+ row_id integer primary key autoincrement, |
|
115 |
+ key not null unique default '' |
|
116 |
+); |
|
117 |
+EOS |
|
118 |
+ $dbi->execute($sql); |
|
119 |
+ }; |
|
120 |
+ |
|
121 |
+ # Create ssh_public_key columns |
|
122 |
+ my $ssh_public_key_columns = [ |
|
123 |
+ "user integer not null default 0", |
|
124 |
+ "title not null default ''" |
|
125 |
+ ]; |
|
126 |
+ for my $column (@$ssh_public_key_columns) { |
|
127 |
+ eval { $dbi->execute("alter table ssh_public_key add column $column") }; |
|
128 |
+ } |
|
129 |
+ |
|
130 |
+ # Check ssh_public_key table |
|
131 |
+ eval { $dbi->select([qw/row_id user key title/], table => 'ssh_public_key') }; |
|
132 |
+ if ($@) { |
|
133 |
+ my $error = "Can't create ssh_public_key table properly: $@"; |
|
134 |
+ $self->app->log->error($error); |
|
135 |
+ croak $error; |
|
136 |
+ } |
|
137 |
+ |
|
138 |
+ # Create collaboration table |
|
139 |
+ eval { |
|
140 |
+ my $sql = <<"EOS"; |
|
141 |
+create table collaboration ( |
|
142 |
+ row_id integer primary key autoincrement, |
|
143 |
+ project integer not null default 0, |
|
144 |
+ collaborator integer not null default 0, |
|
145 |
+ unique(project, collaborator) |
|
146 |
+); |
|
147 |
+EOS |
|
148 |
+ $dbi->execute($sql); |
|
149 |
+ }; |
|
150 |
+ |
|
151 |
+ # Check collaboration table |
|
152 |
+ eval { $dbi->select([qw/row_id project collaborator/], table => 'collaboration') }; |
|
153 |
+ if ($@) { |
|
154 |
+ my $error = "Can't create collaboration table properly: $@"; |
|
155 |
+ $self->app->log->error($error); |
|
156 |
+ croak $error; |
|
157 |
+ } |
|
158 |
+ |
|
159 |
+ # Create pull_request table |
|
160 |
+ eval { |
|
161 |
+ my $sql = <<"EOS"; |
|
162 |
+create table pull_request ( |
|
163 |
+ row_id integer primary key autoincrement, |
|
164 |
+ project integer not null default 0, |
|
165 |
+ branch1 not null default '', |
|
166 |
+ branch2 not null default '', |
|
167 |
+ unique(project, branch1, branch2) |
|
168 |
+); |
|
169 |
+EOS |
|
170 |
+ $dbi->execute($sql); |
|
171 |
+ }; |
|
172 |
+ |
|
173 |
+ # Create pull_request columns |
|
174 |
+ my @pull_request_columns = ( |
|
175 |
+ "title not null default ''", |
|
176 |
+ "open integer default 0", |
|
177 |
+ "open_time integer default 0", |
|
178 |
+ "open_user integer default 0" |
|
179 |
+ ); |
|
180 |
+ for my $column (@pull_request_columns) { |
|
181 |
+ eval { $dbi->execute("alter table pull_request add column $column") }; |
|
182 |
+ } |
|
183 |
+ |
|
184 |
+ # Check pull_request table |
|
185 |
+ eval { $dbi->select([qw/row_id project branch1 branch2 title open open_time open_user/], table => 'pull_request') }; |
|
186 |
+ if ($@) { |
|
187 |
+ my $error = "Can't create pull_request table properly: $@"; |
|
188 |
+ $self->app->log->error($error); |
|
189 |
+ croak $error; |
|
190 |
+ } |
|
16 | 191 |
} |
... | ... |
@@ -29,8 +29,9 @@ note 'import_rep'; |
29 | 29 |
unlink $db_file; |
30 | 30 |
rmtree $rep_home; |
31 | 31 |
|
32 |
- my $app = Gitprep->new; |
|
33 |
- $app->manager->setup_database; |
|
32 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
33 |
+ or die "Can't setup $db_file"; |
|
34 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
34 | 35 |
|
35 | 36 |
my $t = Test::Mojo->new($app); |
36 | 37 |
$t->ua->max_redirects(3); |
... | ... |
@@ -30,8 +30,9 @@ note 'Smart HTTP'; |
30 | 30 |
unlink $db_file; |
31 | 31 |
rmtree $rep_home; |
32 | 32 |
|
33 |
- my $app = Gitprep->new; |
|
34 |
- $app->manager->setup_database; |
|
33 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
34 |
+ or die "Can't setup $db_file"; |
|
35 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
35 | 36 |
|
36 | 37 |
my $t = Test::Mojo->new($app); |
37 | 38 |
$t->ua->max_redirects(3); |
... | ... |
@@ -140,8 +141,9 @@ note 'Private repository and collaborator'; |
140 | 141 |
unlink $db_file; |
141 | 142 |
rmtree $rep_home; |
142 | 143 |
|
143 |
- my $app = Gitprep->new; |
|
144 |
- $app->manager->setup_database; |
|
144 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
145 |
+ or die "Can't setup $db_file"; |
|
146 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
145 | 147 |
|
146 | 148 |
my $t = Test::Mojo->new($app); |
147 | 149 |
$t->ua->max_redirects(3); |
... | ... |
@@ -8,6 +8,7 @@ use lib "$FindBin::Bin/../lib"; |
8 | 8 |
use lib "$FindBin::Bin/../extlib/lib/perl5"; |
9 | 9 |
use File::Path 'rmtree'; |
10 | 10 |
use Encode qw/encode decode/; |
11 |
+use Mojo::Server; |
|
11 | 12 |
|
12 | 13 |
use Test::Mojo; |
13 | 14 |
|
... | ... |
@@ -27,9 +28,10 @@ use Gitprep; |
27 | 28 |
note 'Start page'; |
28 | 29 |
{ |
29 | 30 |
unlink $db_file; |
30 |
- |
|
31 |
- my $app = Gitprep->new; |
|
32 |
- $app->manager->setup_database; |
|
31 |
+ |
|
32 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
33 |
+ or die "Can't setup $db_file"; |
|
34 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
33 | 35 |
|
34 | 36 |
my $t = Test::Mojo->new($app); |
35 | 37 |
$t->ua->max_redirects(3); |
... | ... |
@@ -67,8 +69,9 @@ note 'Admin page'; |
67 | 69 |
{ |
68 | 70 |
unlink $db_file; |
69 | 71 |
|
70 |
- my $app = Gitprep->new; |
|
71 |
- $app->manager->setup_database; |
|
72 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
73 |
+ or die "Can't setup $db_file"; |
|
74 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
72 | 75 |
|
73 | 76 |
my $t = Test::Mojo->new($app); |
74 | 77 |
$t->ua->max_redirects(3); |
... | ... |
@@ -208,8 +211,9 @@ note 'Reset password'; |
208 | 211 |
{ |
209 | 212 |
unlink $db_file; |
210 | 213 |
|
211 |
- my $app = Gitprep->new; |
|
212 |
- $app->manager->setup_database; |
|
214 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
215 |
+ or die "Can't setup $db_file"; |
|
216 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
213 | 217 |
|
214 | 218 |
my $t = Test::Mojo->new($app); |
215 | 219 |
$t->ua->max_redirects(3); |
... | ... |
@@ -269,8 +273,9 @@ note 'Profile'; |
269 | 273 |
unlink $db_file; |
270 | 274 |
rmtree $rep_home; |
271 | 275 |
|
272 |
- my $app = Gitprep->new; |
|
273 |
- $app->manager->setup_database; |
|
276 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
277 |
+ or die "Can't setup $db_file"; |
|
278 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
274 | 279 |
|
275 | 280 |
my $t = Test::Mojo->new($app); |
276 | 281 |
$t->ua->max_redirects(3); |
... | ... |
@@ -312,6 +317,7 @@ note 'Profile'; |
312 | 317 |
$t->post_ok('/_login?op=login', form => {id => 'kimoto1', password => 'a'}); |
313 | 318 |
|
314 | 319 |
# Create repository |
320 |
+ $main::x = 1; |
|
315 | 321 |
$t->post_ok('/_new?op=create', form => {project => 't1', description => 'Hello'}); |
316 | 322 |
$t->content_like(qr/Create a new repository on the command line/); |
317 | 323 |
$t->content_like(qr/t1\.git/); |
... | ... |
@@ -411,8 +417,9 @@ note 'Profile'; |
411 | 417 |
|
412 | 418 |
note 'fork'; |
413 | 419 |
{ |
414 |
- my $app = Gitprep->new; |
|
415 |
- $app->manager->setup_database; |
|
420 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
421 |
+ or die "Can't setup $db_file"; |
|
422 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
416 | 423 |
|
417 | 424 |
my $t = Test::Mojo->new($app); |
418 | 425 |
$t->ua->max_redirects(3); |
... | ... |
@@ -438,8 +445,9 @@ note 'fork'; |
438 | 445 |
|
439 | 446 |
note 'Network'; |
440 | 447 |
{ |
441 |
- my $app = Gitprep->new; |
|
442 |
- $app->manager->setup_database; |
|
448 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
449 |
+ or die "Can't setup $db_file"; |
|
450 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
443 | 451 |
|
444 | 452 |
my $t = Test::Mojo->new($app); |
445 | 453 |
$t->ua->max_redirects(3); |
... | ... |
@@ -459,8 +467,9 @@ note 'Network'; |
459 | 467 |
|
460 | 468 |
note 'Delete branch'; |
461 | 469 |
{ |
462 |
- my $app = Gitprep->new; |
|
463 |
- $app->manager->setup_database; |
|
470 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
471 |
+ or die "Can't setup $db_file"; |
|
472 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
464 | 473 |
|
465 | 474 |
my $t = Test::Mojo->new($app); |
466 | 475 |
$t->ua->max_redirects(3); |
... | ... |
@@ -492,8 +501,9 @@ note 'Delete branch'; |
492 | 501 |
|
493 | 502 |
note 'import-branch'; |
494 | 503 |
{ |
495 |
- my $app = Gitprep->new; |
|
496 |
- $app->manager->setup_database; |
|
504 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
505 |
+ or die "Can't setup $db_file"; |
|
506 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
497 | 507 |
|
498 | 508 |
my $t = Test::Mojo->new($app); |
499 | 509 |
$t->ua->max_redirects(3); |
... | ... |
@@ -563,8 +573,9 @@ note 'Private repository and collaborator'; |
563 | 573 |
unlink $db_file; |
564 | 574 |
rmtree $rep_home; |
565 | 575 |
|
566 |
- my $app = Gitprep->new; |
|
567 |
- $app->manager->setup_database; |
|
576 |
+ system("$FindBin::Bin/../setup_database", $db_file) == 0 |
|
577 |
+ or die "Can't setup $db_file"; |
|
578 |
+ my $app = Mojo::Server->new->load_app("$FindBin::Bin/../script/gitprep"); |
|
568 | 579 |
|
569 | 580 |
my $t = Test::Mojo->new($app); |
570 | 581 |
$t->ua->max_redirects(3); |