Commit 96454ac5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

import-project feature

parent 25f4a829
...@@ -23,6 +23,11 @@ Remove repo ...@@ -23,6 +23,11 @@ Remove repo
./bin/gitlab-projects rm-project gitlab/gitlab-ci.git ./bin/gitlab-projects rm-project gitlab/gitlab-ci.git
Import repo
./bin/gitlab-projects import-project https://github.com/randx/six.git
### Keys: ### Keys:
......
...@@ -17,6 +17,7 @@ class GitlabProjects ...@@ -17,6 +17,7 @@ class GitlabProjects
case @command case @command
when 'add-project'; add_project when 'add-project'; add_project
when 'rm-project'; rm_project when 'rm-project'; rm_project
when 'import-project'; import_project
else else
puts 'not allowed' puts 'not allowed'
end end
...@@ -33,4 +34,10 @@ class GitlabProjects ...@@ -33,4 +34,10 @@ class GitlabProjects
def rm_project def rm_project
FileUtils.rm_rf(full_path) FileUtils.rm_rf(full_path)
end 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 end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment