Showing 1 changed files with 45 additions and 1 deletions
+45 -1
lib/Gitprep.pm
... ...
@@ -23,9 +23,48 @@ has 'git';
23 23
 has 'manager';
24 24
 has 'vc';
25 25
 
26
-
27 26
 use constant BUFFER_SIZE => 8192;
28 27
 
28
+sub data_dir {
29
+  my $self = shift;
30
+  
31
+  my $data_dir = $self->config('data_dir');
32
+  
33
+  return $data_dir;
34
+}
35
+
36
+sub rep_home {
37
+  my $self = shift;
38
+  
39
+  my $rep_home = $self->data_dir . "/rep";
40
+  
41
+  return $rep_home;
42
+}
43
+
44
+sub rep_path {
45
+  my ($self, $user, $project) = @_;
46
+  
47
+  my $rep_path = $self->rep_home . "/$user/$project.git";
48
+  
49
+  return $rep_path
50
+}
51
+
52
+sub rep_work_home {
53
+  my $self = shift;
54
+  
55
+  my $work_home = $self->work_home . "/work";
56
+  
57
+  return $work_home;
58
+}
59
+
60
+sub rep_work_path {
61
+  my ($self, $user, $project) = @_;
62
+  
63
+  my $rep_path = $self->rep_work_home . "/$user/$project";
64
+  
65
+  return $rep_path
66
+}
67
+
29 68
 sub startup {
30 69
   my $self = shift;
31 70
   
... ...
@@ -44,6 +83,11 @@ sub startup {
44 83
   $listen = [split /,/, $listen] unless ref $listen eq 'ARRAY';
45 84
   $conf->{hypnotoad}{listen} = $listen;
46 85
   
86
+  # Data directory
87
+  unless ($self->config('data_dir')) {
88
+    $self->config('data_dir' => $self->home->rel_file('data'));
89
+  }
90
+  
47 91
   # Git
48 92
   my $git = Gitprep::Git->new;
49 93
   $git->app($self);