lib/abak-flow/request.rb in abak-flow-1.0.3 vs lib/abak-flow/request.rb in abak-flow-1.0.4

- old
+ new

@@ -13,11 +13,11 @@ command :checkup do |c| c.syntax = "git request checkup" c.description = "Проверить все ли настроено для работы с github и удаленными репозиториями" c.action do |args, options| - m = Manager.new + m = Manager.instance v = Visitor.new(m.configuration, m.repository, call: :ready?, inspect: :errors) v.exit_on_fail(:checkup, 1) say ANSI.green { I18n.t("commands.checkup.success") } end @@ -29,17 +29,17 @@ c.option "--base STRING", String, "Имя ветки с которой нужно сравнить" c.option "--head STRING", String, "Имя ветки которую нужно сравнить" c.action do |args, options| - m = Manager.new + m = Manager.instance v = Visitor.new(m.configuration, m.repository, call: :ready?, inspect: :errors) v.exit_on_fail(:compare, 1) current = m.git.current_branch - head = Branch.new(options.head || current, m) - base = Branch.new(options.base || head.pick_up_base_name, m) + head = Branch.new(options.head || current) + base = Branch.new(options.base || head.extract_base_name) if head.current? say ANSI.white { I18n.t("commands.compare.updating", branch: ANSI.bold { head }, @@ -63,17 +63,17 @@ c.option "--title STRING", String, "Заголовок для вашего pull request" c.option "--body STRING", String, "Текст для вашего pull request" c.option "--base STRING", String, "Имя ветки, в которую нужно принять изменения" c.action do |args, options| - m = Manager.new + m = Manager.instance - head = Branch.new(m.git.current_branch, m) - base = Branch.new(options.base || head.pick_up_base_name, m) + head = Branch.new(m.git.current_branch) + base = Branch.new(options.base || head.extract_base_name) - title = options.title || head.pick_up_title - body = options.body || head.pick_up_body + title = options.title || head.extract_title + body = options.body || head.extract_body p = PullRequest.new({base: base, head: head, title: title, body: body}, m) v = Visitor.new(m.configuration, m.repository, p, call: :ready?, inspect: :errors) v.exit_on_fail(:publish, 1) @@ -100,15 +100,15 @@ command :done do |c| c.syntax = "git request done" c.description = "Удалить ветки (local и origin) в которых велась работа" c.action do |args, options| - m = Manager.new + m = Manager.instance v = Visitor.new(m.configuration, m.repository, call: :ready?, inspect: :errors) v.exit_on_fail(:done, 1) - branch = Branch.new(m.git.current_branch, m) + branch = Branch.new(m.git.current_branch) if branch.develop? || branch.master? say ANSI.red { I18n.t("commands.done.errors.branch_is_incorrect", branch: ANSI.bold { branch }) } @@ -135,10 +135,10 @@ # TODO : Быть может стоит вынести это в настройки # и позволить выбирать, куда отправлять # при удалении ветки, а по умолчанию использовать master m.git.checkout( - branch.pick_up_base_name(or_use: Branch::DEVELOPMENT)) + branch.extract_base_name(if_undef: Branch::DEVELOPMENT)) branch.delete_on_local end end # command :done end