diff options
-rw-r--r-- | README.md | 4 | ||||
-rwxr-xr-x | bin/gitlab-projects | 2 | ||||
-rw-r--r-- | lib/gitlab_projects.rb | 2 | ||||
-rw-r--r-- | spec/gitlab_projects_spec.rb | 13 |
4 files changed, 17 insertions, 4 deletions
@@ -33,6 +33,10 @@ Import repo ./bin/gitlab-projects import-project randx/six.git https://github.com/randx/six.git +Fork repo + + ./bin/gitlab-projects fork-project gitlab/gitlab-ci.git randx + ### Keys: diff --git a/bin/gitlab-projects b/bin/gitlab-projects index 95d0475..8803931 100755 --- a/bin/gitlab-projects +++ b/bin/gitlab-projects @@ -13,6 +13,8 @@ require_relative '../lib/gitlab_init' # # /bin/gitlab-projects mv-project gitlab/gitlab-ci.git randx/fork.git # +# /bin/gitlab-projects fork-project gitlab/gitlab-ci.git randx +# # /bin/gitlab-projects import-project randx/six.git https://github.com/randx/six.git # require File.join(ROOT_PATH, 'lib', 'gitlab_projects') diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb index 3115868..d726f32 100644 --- a/lib/gitlab_projects.rb +++ b/lib/gitlab_projects.rb @@ -94,7 +94,7 @@ class GitlabProjects namespaced_path = File.join(repos_path, new_namespace) return false unless File.exists?(namespaced_path) - cmd = "cd #{namespaced_path} && git clone --bare #{@full_path}" + cmd = "cd #{namespaced_path} && git clone --bare #{full_path}" system(cmd) end end diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb index 50d5023..ef7fa96 100644 --- a/spec/gitlab_projects_spec.rb +++ b/spec/gitlab_projects_spec.rb @@ -78,13 +78,20 @@ describe GitlabProjects do end describe :fork_project do + let(:gl_project_import) { build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git') } let(:gl_projects) { build_gitlab_projects('fork-project', repo_name, 'forked-to-namespace')} + before do + FileUtils.mkdir_p(tmp_repo_path) + FileUtils.mkdir_p(File.join(tmp_repos_path, 'forked-to-namespace')) + gl_project_import.exec + end + it "should fork the repo" do gl_projects.exec - File.exists?(File.join(tmp_repo_path, 'forked-to-namespace', repo_name)) - File.exists?(File.join(tmp_repo_path, 'forked-to-namespace', repo_name, '/hooks/update/post-receive')) - File.exists?(File.join(tmp_repo_path, 'forked-to-namespace', repo_name, '/hooks/update/')) + File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name)).should be_true + File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name, '/hooks/update/post-receive')).should be_true + File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name, '/hooks/update/')).should be_true end end |