lib/docman/git_util.rb in docman-0.0.57 vs lib/docman/git_util.rb in docman-0.0.58
- old
+ new
@@ -80,15 +80,19 @@
exec %Q(commit -m "#{message}") if repo_changed? path
self.tag(root_path, tag) if tag
end
end
- def self.pull(path)
+ def self.pull(path, options = nil)
Dir.chdir path
- exec 'pull'
+ exec "pull#{options}"
end
+ def self.branch()
+ exec "rev-parse --abbrev-ref HEAD", false
+ end
+
def self.repo?(path)
File.directory? File.join(path, '.git')
end
def self.repo_changed?(path)
@@ -99,13 +103,13 @@
Dir.chdir path
result = `git rev-parse --short origin/#{branch}`
result.delete!("\n")
end
- def self.push(root_path, version)
+ def self.push(root_path, version, show_result = true)
Dir.chdir root_path
- exec "pull origin #{version}"
- exec "push origin #{version}"
+ exec "pull origin #{version}", show_result
+ exec "push origin #{version}", show_result
end
def self.tag(root_path, tag)
Dir.chdir root_path
exec %Q(tag -a -m "Tagged to #{tag}" "#{tag}")
\ No newline at end of file