Created
March 21, 2011 20:10
-
-
Save michaelbarton/880115 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Git < Thor | |
| desc "branch", "Name of current branch" | |
| def branch | |
| puts branch_name | |
| end | |
| private | |
| def git(command,args) | |
| `git #{command} #{args}` | |
| end | |
| def branch_name | |
| git('name-rev', '--name-only HEAD 2> /dev/null').strip | |
| end | |
| def master? | |
| branch_name == "master" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment