module Asgit
Constants
- VERSION
Public Class Methods
current_branch()
click to toggle source
Get current git branch based on exec directory @return [String] the current checked out branch
# File lib/asgit.rb, line 17 def current_branch resp = Shell.run( "git symbolic-ref HEAD --short" ) if !resp.stdout.strip.empty? || resp.success? return resp.stdout.strip else raise Shell::ResponseError, resp.stderr end end
current_commit()
click to toggle source
Get current git commit based on exec directory @return [String] the current commit level
# File lib/asgit.rb, line 28 def current_commit Shell.run( "git rev-parse HEAD" ).stdout.strip end
remote_up_to_date?()
click to toggle source
Check if branch is in sync with remote @return [Boolean]
# File lib/asgit.rb, line 34 def remote_up_to_date? resp = Shell.run "git push --dry-run --porcelain" return resp.success? && resp.stdout.match(/#{current_branch}\s+?\[up\sto\sdate\]/) end
working_tree_clean?()
click to toggle source
Check if working tree is clean @return [Boolean] true if branch is clean
# File lib/asgit.rb, line 11 def working_tree_clean? Shell.run( "git status --porcelain" ).stdout.empty? end