Commit a7304fe0 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix truncate repos. Added path option to import

parent 918068df
...@@ -25,7 +25,7 @@ Remove repo ...@@ -25,7 +25,7 @@ Remove repo
Import repo Import repo
./bin/gitlab-projects import-project https://github.com/randx/six.git ./bin/gitlab-projects import-project randx/six.git https://github.com/randx/six.git
### Keys: ### Keys:
......
...@@ -11,6 +11,8 @@ require_relative '../lib/gitlab_init' ...@@ -11,6 +11,8 @@ require_relative '../lib/gitlab_init'
# #
# /bin/gitlab-projects rm-project gitlab/gitlab-ci.git # /bin/gitlab-projects rm-project gitlab/gitlab-ci.git
# #
# /bin/gitlab-projects import-project randx/six.git https://github.com/randx/six.git
#
require File.join(ROOT_PATH, 'lib', 'gitlab_projects') require File.join(ROOT_PATH, 'lib', 'gitlab_projects')
GitlabProjects.new.exec GitlabProjects.new.exec
......
...@@ -41,8 +41,8 @@ class GitlabProjects ...@@ -41,8 +41,8 @@ class GitlabProjects
end end
def import_project def import_project
dir = @project_name.match(/[a-zA-Z\.\_\-]+\.git$/).to_s @source = ARGV.shift
cmd = "cd #{@repos_path} && git clone --bare #{@project_name} #{dir} && #{create_hooks_cmd}" cmd = "cd #{@repos_path} && git clone --bare #{@source} #{@project_name} && #{create_hooks_cmd}"
system(cmd) system(cmd)
end end
end end
...@@ -6,7 +6,7 @@ echo "Danger!!! Data Loss" ...@@ -6,7 +6,7 @@ echo "Danger!!! Data Loss"
while true; do while true; do
read -p "Do you wish to delete all directories (except gitolite-admin.git) from $home_dir/repositories/ (y/n) ?: " yn read -p "Do you wish to delete all directories (except gitolite-admin.git) from $home_dir/repositories/ (y/n) ?: " yn
case $yn in case $yn in
[Yy]* ) sh -c "find $home_dir/repositories/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs sudo rm -rf"; break;; [Yy]* ) sh -c "find $home_dir/repositories/. -maxdepth 1 -not -name 'gitolite-admin.git' -not -name '.' | xargs rm -rf"; break;;
[Nn]* ) exit;; [Nn]* ) exit;;
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
......
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