Sha256: b4f44c97f61b76398962cd3c7d253187289ad6594d384e9d4cb95d7d1eea54f7
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
module Docman class GitUtil def self.get(repo, path, type, version) if File.directory? path Dir.chdir path `git checkout #{version} && git pull origin #{version}` if type == 'branch' if type == 'tag' `git fetch --tags` `git checkout "tags/#{version}"` end else `git clone #{repo} #{path}` Dir.chdir path `git checkout #{version}` end result = `git rev-parse --short HEAD` result.delete!("\n") end def self.update(path) `cd #{path} && git pull` end def self.commit(root_path, path, message) if self.repo_changed? path puts message Dir.chdir root_path path.slice! "#{root_path}/" `git pull` `git add --all #{path}` `git commit -m "#{message}"` end end def self.repo_changed?(path) not Exec.do "#{Application::bin}/dm_repo_clean.sh #{path}" end def self.push(root_path, version) Dir.chdir root_path `git push origin #{version}` end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
docman-0.0.5 | lib/docman/git_util.rb |
docman-0.0.4 | lib/docman/git_util.rb |
docman-0.0.3 | lib/docman/git_util.rb |