File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1717
1818Add repo
1919
20- ./bin/gitlab-projects add-project gitlab/gitlab-ci.git
20+ ./bin/gitlab-projects add-project gitlab/gitlab-ci.git
2121
2222Remove repo
2323
24- ./bin/gitlab-projects rm-project gitlab/gitlab-ci.git
24+ ./bin/gitlab-projects rm-project gitlab/gitlab-ci.git
25+
26+ Import repo
27+
28+ ./bin/gitlab-projects import-project https://github.com/randx/six.git
29+
2530
2631### Keys:
2732
2833
2934Add key
3035
31- ./bin/gitlab-keys add-key key-782 "ssh-rsa AAAAx321..."
36+ ./bin/gitlab-keys add-key key-782 "ssh-rsa AAAAx321..."
3237
3338Remove key
3439
35- ./bin/gitlab-keys rm-key key-23 "ssh-rsa AAAAx321..."
40+ ./bin/gitlab-keys rm-key key-23 "ssh-rsa AAAAx321..."
3641
Original file line number Diff line number Diff line change 1+ 1.0.0
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ def exec
1717 case @command
1818 when 'add-project' ; add_project
1919 when 'rm-project' ; rm_project
20+ when 'import-project' ; import_project
2021 else
2122 puts 'not allowed'
2223 end
@@ -33,4 +34,10 @@ def add_project
3334 def rm_project
3435 FileUtils . rm_rf ( full_path )
3536 end
37+
38+ def import_project
39+ dir = @project_name . match ( /[a-zA-Z\. \_ \- ]+\. git$/ ) . to_s
40+ cmd = "cd #{ @repos_path } && git clone --bare #{ @project_name } #{ dir } && ln -s #{ @hook_path } #{ @repos_path } /#{ dir } /hooks/post-receive"
41+ system ( cmd )
42+ end
3643end
You can’t perform that action at this time.
0 commit comments