Class: Ace::Task::CLI::Commands::GithubSync
- Inherits:
-
Support::Cli::Command
- Object
- Support::Cli::Command
- Ace::Task::CLI::Commands::GithubSync
- Includes:
- Support::Cli::Base
- Defined in:
- lib/ace/task/cli/commands/github_sync.rb
Overview
ace-support-cli Command class for ace-task github-sync
Instance Method Summary collapse
Instance Method Details
#call(ref: nil, **options) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ace/task/cli/commands/github_sync.rb', line 29 def call(ref: nil, **) all = [:all] if !all && (ref.nil? || ref.strip.empty?) raise Ace::Support::Cli::Error.new("Provide a task reference or use --all") end manager = Ace::Task::Organisms::TaskManager.new result = manager.github_sync(ref: ref, all: all) raise Ace::Support::Cli::Error.new("Task '#{ref}' not found") if result.nil? print_failures(result[:failures]) if result[:failed].to_i.positive? raise Ace::Support::Cli::Error.new( "GitHub sync incomplete: synced #{result[:synced]}, failed #{result[:failed]}, skipped #{result[:skipped]}" ) elsif all puts "GitHub sync complete: synced #{result[:synced]} linked task(s), skipped #{result[:skipped]} task(s)" elsif result[:synced].positive? puts "GitHub sync complete: #{result[:task_id]}" else puts "No linked GitHub issues for task #{result[:task_id]}" end end |