Showing 7 changed files with 28 additions and 4 deletions
+1
CHANGES
... ...
@@ -8,6 +8,7 @@
8 8
   - remove [basic]encoding_suspects option
9 9
     and move this feature to project settings page.
10 10
   - setup.sh is renamed to setup_module
11
+  - separete database creating logic to setup_database script
11 12
   
12 13
 1.12 (7 Feb 2016)
13 14
   - Catch up latest Github design.
+5 -1
README.md
... ...
@@ -37,7 +37,11 @@ Download tar.gz archive, expand it and change directory:
37 37
 
38 38
 Setup. Needed module is installed.
39 39
 
40
-    ./setup.sh
40
+    ./setup_module
41
+
42
+Setup database.
43
+
44
+    ./setup_database
41 45
 
42 46
 If you install git in your local directry,
43 47
 you must add the correct git command path to the **gitprep.conf** config file.
-3
lib/Gitprep.pm
... ...
@@ -123,9 +123,6 @@ sub startup {
123 123
     chown -1, $gid, $db_file;
124 124
   }
125 125
   
126
-  # Setup database
127
-  $self->manager->setup_database;
128
-  
129 126
   # Model
130 127
   my $models = [
131 128
     {table => 'user', primary_key => 'id'},
+10
setup_database
... ...
@@ -0,0 +1,10 @@
1
+#!/usr/bin/env perl
2
+
3
+use FindBin;
4
+use lib "$FindBin::Bin/lib";
5
+use lib "$FindBin::Bin/extlib/lib/perl5";
6
+
7
+use Gitprep;
8
+
9
+my $app = Gitprep->new;
10
+$app->manager->setup_database;
+1
xt/import_rep.t
... ...
@@ -27,6 +27,7 @@ note 'import_rep';
27 27
   rmtree $rep_home;
28 28
 
29 29
   my $app = Gitprep->new;
30
+  $app->manager->setup_database;
30 31
   my $t = Test::Mojo->new($app);
31 32
   $t->ua->max_redirects(3);
32 33
   
+2
xt/smart_http.t
... ...
@@ -28,6 +28,7 @@ note 'Smart HTTP';
28 28
   rmtree $rep_home;
29 29
 
30 30
   my $app = Gitprep->new;
31
+  $app->manager->setup_database;
31 32
   my $t = Test::Mojo->new($app);
32 33
   $t->ua->max_redirects(3);
33 34
 
... ...
@@ -136,6 +137,7 @@ note 'Private repository and collaborator';
136 137
   rmtree $rep_home;
137 138
 
138 139
   my $app = Gitprep->new;
140
+  $app->manager->setup_database;
139 141
   my $t = Test::Mojo->new($app);
140 142
   $t->ua->max_redirects(3);
141 143
 
+9
xt/user.t
... ...
@@ -26,6 +26,7 @@ note 'Start page';
26 26
   unlink $db_file;
27 27
 
28 28
   my $app = Gitprep->new;
29
+  $app->manager->setup_database;
29 30
   my $t = Test::Mojo->new($app);
30 31
   $t->ua->max_redirects(3);
31 32
   
... ...
@@ -63,6 +64,7 @@ note 'Admin pages';
63 64
   unlink $db_file;
64 65
 
65 66
   my $app = Gitprep->new;
67
+  $app->manager->setup_database;
66 68
   my $t = Test::Mojo->new($app);
67 69
   $t->ua->max_redirects(3);
68 70
 
... ...
@@ -188,6 +190,7 @@ note 'Reset password';
188 190
   unlink $db_file;
189 191
 
190 192
   my $app = Gitprep->new;
193
+  $app->manager->setup_database;
191 194
   my $t = Test::Mojo->new($app);
192 195
   $t->ua->max_redirects(3);
193 196
 
... ...
@@ -247,6 +250,7 @@ note 'Profile';
247 250
   rmtree $rep_home;
248 251
 
249 252
   my $app = Gitprep->new;
253
+  $app->manager->setup_database;
250 254
   my $t = Test::Mojo->new($app);
251 255
   $t->ua->max_redirects(3);
252 256
 
... ...
@@ -387,6 +391,7 @@ note 'Profile';
387 391
 note 'fork';
388 392
 {
389 393
   my $app = Gitprep->new;
394
+  $app->manager->setup_database;
390 395
   my $t = Test::Mojo->new($app);
391 396
   $t->ua->max_redirects(3);
392 397
   
... ...
@@ -412,6 +417,7 @@ note 'fork';
412 417
 note 'Network';
413 418
 {
414 419
   my $app = Gitprep->new;
420
+  $app->manager->setup_database;
415 421
   my $t = Test::Mojo->new($app);
416 422
   $t->ua->max_redirects(3);
417 423
 
... ...
@@ -431,6 +437,7 @@ note 'Network';
431 437
 note 'Delete branch';
432 438
 {
433 439
   my $app = Gitprep->new;
440
+  $app->manager->setup_database;
434 441
   my $t = Test::Mojo->new($app);
435 442
   $t->ua->max_redirects(3);
436 443
   
... ...
@@ -462,6 +469,7 @@ note 'Delete branch';
462 469
 note 'import-branch';
463 470
 {
464 471
   my $app = Gitprep->new;
472
+  $app->manager->setup_database;
465 473
   my $t = Test::Mojo->new($app);
466 474
   $t->ua->max_redirects(3);
467 475
 
... ...
@@ -531,6 +539,7 @@ note 'Private repository and collaborator';
531 539
   rmtree $rep_home;
532 540
 
533 541
   my $app = Gitprep->new;
542
+  $app->manager->setup_database;
534 543
   my $t = Test::Mojo->new($app);
535 544
   $t->ua->max_redirects(3);
536 545