Sha256: 6d7964cdecb8aa9fa126dce0c50d8b56b8ceb1a4e70fd95b23ee091c15d042fe
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
# coding: utf-8 module Abak::Flow module Commands class Publish include ANSI::Code def run(args, options) Checkup.new.process(Array.new, ::Commander::Command::Options.new) head = Branch.new(Manager.git.current_branch) base = Branch.new(options.base || head.extract_base_name) title = options.title || head.extract_title body = options.body || head.extract_body pr = PullRequest.new(base: base, head: head, title: title, body: body) validate_request(pr) say white { Manager.locale.word(self, "updating", branch: bold { head }, upstream: bold { "#{Manager.repository.origin}" }) } head.update say white { Manager.locale.word(self, "publicating", branch: bold { "#{Manager.repository.origin.owner}:#{head}" }, upstream: bold { "#{Manager.repository.origin}" }) } publicate_request(pr) say green { pr.link } end private def validate_request(request) inspector = Inspector.new(call_method: :valid?, collect_attribute: :errors) inspector.examine(request).on_fail do |insp| say red { Manager.locale.error(self) } say yellow { insp.output } exit 106 end end def publicate_request(request) inspector = Inspector.new(call_method: :publish, collect_attribute: :errors) inspector.examine(request).on_fail do |insp| say red { Manager.locale.error(self, 'publication.failed') } say yellow { insp.output } exit 107 end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
abak-flow-1.1.1 | lib/abak-flow/commands/publish.rb |
abak-flow-1.1.0 | lib/abak-flow/commands/publish.rb |