Sha256: fc7ee62aeb3aba5a11e31f1e94bf8b5c2c8b7b7a0850035de0b9fd8c62a2a30a
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
require 'rake' require 'rake/dsl_definition' module Git class NoTagFoundError < Exception; end include Rake::DSL def git_clone(repos, dir) sh "git clone #{repos} #{dir}" end def git_active_branch %x{git branch}.split("\n").select { |b| b =~ /^\*/ }.first.split(" ").last.strip end def git_push(commit, repo, options = []) commit ||= "HEAD" options ||= [] begin sh "git update-ref refs/heroku_san/deploy #{commit}^{commit}" sh "git push #{repo} #{options.join(' ')} refs/heroku_san/deploy:refs/heads/master" ensure sh "git update-ref -d refs/heroku_san/deploy" end end def git_parsed_tag(tag) git_rev_parse(git_tag(tag)) end def git_rev_parse(ref) return nil if ref.nil? %x{git rev-parse #{ref}}.split("\n").first end def git_tag(glob) return nil if glob.nil? %x{git tag -l '#{glob}'}.split("\n").last || (raise NoTagFoundError, "No tag found [#{glob}]") end def git_revision(repo) %x{git ls-remote --heads #{repo} master}.split.first end def git_named_rev(ref) %x{git name-rev #{ref}}.chomp end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
heroku_san-4.2.3 | lib/git.rb |
heroku_san-4.2.2 | lib/git.rb |
heroku_san-4.2.1 | lib/git.rb |
heroku_san-4.0.8 | lib/git.rb |