lib/versionator/git.rb in versionator-0.0.4 vs lib/versionator/git.rb in versionator-0.1.0
- old
+ new
@@ -1,28 +1,32 @@
module Versionator
module Git
- def git_checkout
- git_command("git checkout master")
+ def git_current_branch
+ git_command("git branch").split(/\n/).grep(/\*/).first.gsub('* ', '')
end
- def git_pull
- git_command("git pull origin master")
+ def git_checkout(branch = 'master')
+ git_command("git checkout #{branch}")
end
+ def git_pull(branch = 'master')
+ git_command("git pull origin #{branch}")
+ end
+
def git_tag
git_command("git tag v#{version_name}")
end
- def git_commit(message=nil)
+ def git_commit(message = nil)
message = "tag new release v#{version_name}" if message.blank?
git_command("git commit -a -m '#{message}'")
end
- def git_push
- git_command("git push origin master --tags")
+ def git_push(branch = 'master')
+ git_command("git push origin #{branch} --tags")
end
def git_command(str)
systemu(str).drop(1).join(" ")
end
end
-end
\ No newline at end of file
+end