Module: TicGitNG::Command::Sync
- Defined in:
- lib/ticgit-ng/command/sync.rb
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ticgit-ng/command/sync.rb', line 16 def execute begin if .repo and .no_push tic.sync_tickets(.repo, false) elsif .repo tic.sync_tickets(.repo) elsif .no_push tic.sync_tickets('origin', false) else tic.sync_tickets() end rescue Git::GitExecuteError => e if e.[/does not appear to be a git repository/] repo= e..split("\n")[0][/^[^:]+/][/"\w+"/].gsub('"','') puts "Could not sync because git returned the following error:\n#{e.message.split("\n")[0][/[^:]+$/].strip}" exit end end end |
#parser(opts) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/ticgit-ng/command/sync.rb', line 4 def parser(opts) opts. = "Usage: ti sync [options]" opts.on_head( "-r REPO", "--repo REPO", "Sync ticgit-ng branch with REPO"){|v| .repo = v } opts.on_head( "-n", "--no-push", "Do not push to the remote repo"){|v| .no_push = true } end |