summaryrefslogtreecommitdiff
path: root/lib/gitlab_projects.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-08 03:49:40 -0700
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-07-08 03:49:40 -0700
commit05e2c4359d1f1e8addb33d6cb1980bc6dedf8bbd (patch)
tree6b05858d45dc74a6777f1d7d61a64295811812c7 /lib/gitlab_projects.rb
parente049749a06831b87435bc41d108755fcc75679cf (diff)
parent66cfc50fcde2d13b56e774db49b71ff38e057008 (diff)
downloadgitlab-shell-05e2c4359d1f1e8addb33d6cb1980bc6dedf8bbd.tar.gz
Merge pull request #69 from thomasbiddle/support_adding_and_removing_branches_and_tags
Support adding and removing branches and tags
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r--lib/gitlab_projects.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index 8c280ea..c933296 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -26,6 +26,10 @@ class GitlabProjects
def exec
case @command
+ when 'create-branch'; create_branch
+ when 'rm-branch'; rm_branch
+ when 'create-tag'; create_tag
+ when 'rm-tag'; rm_tag
when 'add-project'; add_project
when 'rm-project'; rm_project
when 'mv-project'; mv_project
@@ -41,6 +45,32 @@ class GitlabProjects
protected
+ def create_branch
+ branch_name = ARGV.shift
+ ref = ARGV.shift || "HEAD"
+ cmd = "cd #{full_path} && git 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)
+ end
+
+ def create_tag
+ tag_name = ARGV.shift
+ ref = ARGV.shift || "HEAD"
+ cmd = "cd #{full_path} && git 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)
+ end
+
def add_project
$logger.info "Adding project #{@project_name} at <#{full_path}>."
FileUtils.mkdir_p(full_path, mode: 0770)