Top Level Namespace
- Includes:
- Commandant
Constant Summary collapse
- URL =
"http://projects.reductivelabs.com/issues/%d.xml"
Instance Method Summary collapse
- #assert_branch_exists ⇒ Object
- #assert_id_provided ⇒ Object
- #existing_branch ⇒ Object
- #parse_args(args) ⇒ Object
Instance Method Details
#assert_branch_exists ⇒ Object
31 32 33 34 |
# File 'bin/git-ticket', line 31 def assert_branch_exists assert_id_provided abort "Error: no ticket branch for #$id" if existing_branch.empty? end |
#assert_id_provided ⇒ Object
27 28 29 |
# File 'bin/git-ticket', line 27 def assert_id_provided abort "Error: ticket number required" unless $id end |
#existing_branch ⇒ Object
23 24 25 |
# File 'bin/git-ticket', line 23 def existing_branch `git branch`.gsub(/^\*?\s+/,'').split(/\n/).grep(/^(?:bug\-)?#{$id}\-/) end |
#parse_args(args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'bin/git-ticket', line 12 def parse_args(args) # Flags $help = args.delete('--help') || args.delete('-h') || args.empty? $branch = args.delete('--branch') || args.delete('-b') $interactive = args.delete('--interactive') || args.delete('-i') $delete = args.delete('--delete') || args.delete('-d') $list = args.delete('--list') || args.delete('-l') $id = args.grep(/^\d+$/).first && args.grep(/^\d+$/).first.to_i end |