Class: Cerberus::SCM::Git
Instance Method Summary collapse
- #current_revision(_full = false) ⇒ Object
- #has_changes? ⇒ Boolean
- #installed? ⇒ Boolean
- #last_author ⇒ Object
- #last_commit_message ⇒ Object
- #new? ⇒ Boolean
- #output ⇒ Object
- #update! ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from Cerberus::SCM::Base
Instance Method Details
#current_revision(_full = false) ⇒ Object
36 37 38 |
# File 'lib/cerberus/scm/git.rb', line 36 def current_revision( _full=false ) _full ? @revision : @revision.slice(0,8) end |
#has_changes? ⇒ Boolean
27 28 29 30 |
# File 'lib/cerberus/scm/git.rb', line 27 def has_changes? extract_current_head_revision new? or ( last_tested_revision != @revision ) end |
#installed? ⇒ Boolean
6 7 8 |
# File 'lib/cerberus/scm/git.rb', line 6 def installed? exec_successful? "#{@config[:bin_path]}git --version" end |
#last_author ⇒ Object
44 45 46 |
# File 'lib/cerberus/scm/git.rb', line 44 def @author end |
#last_commit_message ⇒ Object
40 41 42 |
# File 'lib/cerberus/scm/git.rb', line 40 def @message end |
#new? ⇒ Boolean
32 33 34 |
# File 'lib/cerberus/scm/git.rb', line 32 def new? @new == true end |
#output ⇒ Object
48 49 50 |
# File 'lib/cerberus/scm/git.rb', line 48 def output @status end |
#update! ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cerberus/scm/git.rb', line 10 def update! if test( ?d, File.join( @path,'.git' ) ) get_updates execute("reset", "--hard #{remote_head}") else FileUtils.rm_rf(@path) if test(?d, @path) encoded_url = (@config[:scm, :url].include?(' ') ? "\"#{@config[:scm, :url]}\"" : @config[:scm, :url]) @new = true @status = execute("clone", "#{encoded_url} #{@path}", false) execute('config', 'pager.diff false') # turn off git-diff $PAGER by default if branch = @config[:scm, :branch] execute('branch', "--track #{branch} #{remote_head}") execute('checkout', branch) end end end |