summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2020-03-09 12:11:12 -0700
committerSean Whitton <spwhitton@spwhitton.name>2020-03-09 12:12:14 -0700
commit198451435d669e388e5963fe0667e0460b8c75dc (patch)
tree092badf8f7561036ccdf0f780af073fa5b32f582 /lib
parent6545565d13b6748057f632ea1834f21e722f8a79 (diff)
downloadp5-API-GitForge-198451435d669e388e5963fe0667e0460b8c75dc.tar.gz
Implement API::GitForge::GitLab::_ensure_repo()
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'lib')
-rw-r--r--lib/API/GitForge/GitLab.pm13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/API/GitForge/GitLab.pm b/lib/API/GitForge/GitLab.pm
index f4baaad..3f38bf7 100644
--- a/lib/API/GitForge/GitLab.pm
+++ b/lib/API/GitForge/GitLab.pm
@@ -111,8 +111,17 @@ sub _clean_config_fork {
}
sub _ensure_repo {
- # TODO
- die "unimplemented";
+ my ($self, $target) = @_;
+ my ($ns, $repo) = _extract_project_id($target);
+
+ # first we are required to get the namespace id
+ my $namespace = $self->{_api}->namespace($ns)
+ or croak "invalid project namespace $ns";
+
+ # now create the project unless it already exists
+ return if $self->{_api}->project($target);
+ $self->{_api}
+ ->create_project({ name => $repo, namespace_id => $namespace->{id} });
}
sub _nuke_fork {