diff options
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r-- | lib/gitlab_projects.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 83f542a..33b1c21 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -17,6 +17,7 @@ class GitlabProjects case @command when 'add-project'; add_project when 'rm-project'; rm_project + when 'import-project'; import_project else puts 'not allowed' end @@ -33,4 +34,10 @@ class GitlabProjects def rm_project FileUtils.rm_rf(full_path) end + + def import_project + dir = @project_name.match(/[a-zA-Z\.\_\-]+\.git$/).to_s + cmd = "cd #{@repos_path} && git clone --bare #{@project_name} #{dir} && ln -s #{@hook_path} #{@repos_path}/#{dir}/hooks/post-receive" + system(cmd) + end end |