summaryrefslogtreecommitdiff
path: root/lib/gitlab_projects.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2013-11-01 13:29:17 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2013-11-01 13:57:01 +0100
commit7ba6725f3c8e49104407807468b27596a51a1d5e (patch)
tree3b916f3b012d1aaf9add91b4ebdb83abcda61ddb /lib/gitlab_projects.rb
parente76ad1dcb81e7be46f89b2fa4b848078a6318845 (diff)
downloadgitlab-shell-7ba6725f3c8e49104407807468b27596a51a1d5e.tar.gz
Bypass the shell in GitlabProjects
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r--lib/gitlab_projects.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index 5bcf623..0354b87 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -48,34 +48,34 @@ class GitlabProjects
def create_branch
branch_name = ARGV.shift
ref = ARGV.shift || "HEAD"
- cmd = "cd #{full_path} && git branch #{branch_name} #{ref}"
- system(cmd)
+ cmd = %W(git --git-dir=#{full_path} branch #{branch_name} #{ref})
+ system(*cmd)
end
def rm_branch
branch_name = ARGV.shift
- cmd = "cd #{full_path} && git branch -D #{branch_name}"
- system(cmd)
+ cmd = %W(git --git-dir=#{full_path} branch -D #{branch_name})
+ system(*cmd)
end
def create_tag
tag_name = ARGV.shift
ref = ARGV.shift || "HEAD"
- cmd = "cd #{full_path} && git tag #{tag_name} #{ref}"
- system(cmd)
+ cmd = %W(git --git-dir=#{full_path} tag #{tag_name} #{ref})
+ system(*cmd)
end
def rm_tag
tag_name = ARGV.shift
- cmd = "cd #{full_path} && git tag -d #{tag_name}"
- system(cmd)
+ cmd = %W(git --git-dir=#{full_path} tag -d #{tag_name})
+ system(*cmd)
end
def add_project
$logger.info "Adding project #{@project_name} at <#{full_path}>."
FileUtils.mkdir_p(full_path, mode: 0770)
- cmd = "cd #{full_path} && git init --bare"
- system(cmd) && create_hooks(full_path)
+ cmd = %W(git --git-dir=#{full_path} init --bare)
+ system(*cmd) && create_hooks(full_path)
end
def create_hooks(path)
@@ -94,8 +94,8 @@ class GitlabProjects
def import_project
@source = ARGV.shift
$logger.info "Importing project #{@project_name} from <#{@source}> to <#{full_path}>."
- cmd = "cd #{repos_path} && git clone --bare #{@source} #{project_name}"
- system(cmd) && create_hooks(full_path)
+ cmd = %W(git clone --bare #{@source} #{project_name})
+ system(*cmd, chdir: repos_path) && create_hooks(full_path)
end
# Move repository from one directory to another
@@ -156,8 +156,8 @@ class GitlabProjects
end
$logger.info "Forking project from <#{full_path}> to <#{full_destination_path}>."
- cmd = "cd #{namespaced_path} && git clone --bare #{full_path}"
- system(cmd) && create_hooks(full_destination_path)
+ cmd = %W(git clone --bare #{full_path})
+ system(*cmd, chdir: namespaced_path) && create_hooks(full_destination_path)
end
def update_head