Skip to content

Commit

Permalink
wcreate wiki directory
Browse files Browse the repository at this point in the history
  • Loading branch information
yuki-kimoto committed Apr 18, 2017
1 parent a79e51a commit e1a4f3a
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 31 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ data/*
data/rep/*
!data/work/
data/work/*
!data/wiki/
data/wiki/*
!data/wiki/rep/
data/wiki/rep/*
!data/wiki/work/
data/wiki/work/*
setup/latest-build
setup/work/*
setup/build.log
Expand Down
Empty file removed data/wiki/.gitkeep
Empty file.
Empty file removed data/wiki/rep/.gitkeep
Empty file.
Empty file removed data/wiki/work/.gitkeep
Empty file.
22 changes: 3 additions & 19 deletions lib/Gitprep.pm
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,13 @@ sub work_rep_info {
return $info;
}

sub wiki_rep_home {
my $self = shift;

my $wiki_rep_home = $self->data_dir . "/wiki/rep";

return $wiki_rep_home;
}

sub wiki_work_rep_home {
my $self = shift;

my $wiki_work_home = $self->data_dir . "/wiki/work";

return $wiki_work_home;
}

sub wiki_rep_info {
my ($self, $user_id, $project_id) = @_;

my $info = {};
$info->{user} = $user_id;
$info->{project} = $project_id;
$info->{git_dir} = $self->wiki_rep_home . "/$user_id/$project_id.git";
$info->{git_dir} = $self->rep_home . "/$user_id/$project_id.wiki.git";

return $info;
}
Expand All @@ -106,8 +90,8 @@ sub wiki_work_rep_info {
my $info = {};
$info->{user} = $user_id;
$info->{project} = $project_id;
$info->{git_dir} = $self->wiki_work_rep_home . "/$user_id/$project_id/.git";
$info->{work_tree} = $self->wiki_work_rep_home . "/$user_id/$project_id";
$info->{git_dir} = $self->work_rep_home . "/$user_id/$project_id.wiki/.git";
$info->{work_tree} = $self->work_rep_home . "/$user_id/$project_id.wiki";

return $info;
}
Expand Down
17 changes: 12 additions & 5 deletions lib/Gitprep/API.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ sub create_wiki_page {
project => $project_row_id,
home => $title
};
$self->app->dbi->model('wiki')->insert($new_wiki);

eval {
$self->app->dbi->connector->txn(sub {
$self->app->dbi->model('wiki')->insert($new_wiki);
$self->app->manager->create_wiki_rep($user_id, $project_id);
$self->app->manager->create_wiki_work_rep($user_id, $project_id);
});
};

if (my $error = $@) {
die $error
}
}


die "aaaa";

}

sub get_pull_request_count {
Expand Down
2 changes: 1 addition & 1 deletion lib/Gitprep/Manager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ sub _create_rep {
}

sub create_wiki_rep {
my ($self, $user, $project, $opts) = @_;
my ($self, $user, $project) = @_;

# Create repository directory
my $git = $self->app->git;
Expand Down

0 comments on commit e1a4f3a

Please sign in to comment.