Module: Asgit
- Defined in:
- lib/asgit.rb,
lib/asgit/url.rb,
lib/asgit/shell.rb,
lib/asgit/project.rb,
lib/asgit/version.rb,
lib/asgit/services.rb,
lib/asgit/services/github.rb,
lib/asgit/services/service.rb,
lib/asgit/services/bitbucket.rb
Defined Under Namespace
Modules: Services, Shell Classes: Project, Url
Constant Summary collapse
- VERSION =
"0.4.0"
Class Method Summary collapse
-
.current_branch ⇒ String
Get current git branch based on exec directory.
-
.current_commit ⇒ String
Get current git commit based on exec directory.
-
.remote_up_to_date? ⇒ Boolean
Check if branch is in sync with remote.
-
.working_tree_clean? ⇒ Boolean
Check if working tree is clean.
Class Method Details
.current_branch ⇒ String
Get current git branch based on exec directory
17 18 19 20 21 22 23 24 |
# 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 ⇒ String
Get current git commit based on exec directory
28 29 30 |
# File 'lib/asgit.rb', line 28 def current_commit Shell.run( "git rev-parse HEAD" ).stdout.strip end |
.remote_up_to_date? ⇒ Boolean
Check if branch is in sync with remote
34 35 36 37 |
# 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? ⇒ Boolean
Check if working tree is clean
11 12 13 |
# File 'lib/asgit.rb', line 11 def working_tree_clean? Shell.run( "git status --porcelain" ).stdout.empty? end |