diff options
author | Angus MacArthur <amacarthur@blackberry.com> | 2013-03-28 11:59:48 -0400 |
---|---|---|
committer | Angus MacArthur <amacarthur@blackberry.com> | 2013-04-11 01:12:18 -0400 |
commit | a471d5526249654f93dae8d88b92c2cddb287178 (patch) | |
tree | 5f6b1b6d89285d2ae7439b2e70678b5894aba2c7 /lib/gitlab_projects.rb | |
parent | 8e75018c538d422c8273e2dbcde65404fe8fd42b (diff) | |
download | gitlab-shell-a471d5526249654f93dae8d88b92c2cddb287178.tar.gz |
add fork_project command
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r-- | lib/gitlab_projects.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index aef343e..3115868 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -29,6 +29,7 @@ class GitlabProjects when 'rm-project'; rm_project when 'mv-project'; mv_project when 'import-project'; import_project + when 'fork-project'; fork_project else puts 'not allowed' false @@ -84,4 +85,16 @@ class GitlabProjects FileUtils.mv(full_path, new_full_path) end + + def fork_project + new_namespace = ARGV.shift + + return false unless new_namespace + + namespaced_path = File.join(repos_path, new_namespace) + return false unless File.exists?(namespaced_path) + + cmd = "cd #{namespaced_path} && git clone --bare #{@full_path}" + system(cmd) + end end |