Sha256: 92a7e3bcb2a86f0a0718abca3677e4792c3c62704c97d8a6a5225a917175f8db

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# coding: utf-8
require "commander/blank"
require "commander/command"

module Abak::Flow
  module Commands
    class Compare
      # TODO : Быть может стоит сделать include ANSI

      def initialize
        manager = Manager.instance

        @configuration = manager.configuration
        @repository = manager.repository
        @git = manager.git
      end

      def run(args, options)
        Checkup.new.process(
          Array.new, ::Commander::Command::Options.new)

        current = @git.current_branch
        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 },
              upstream: ANSI.bold { "#{@repository.origin}" }) }

          head.update
        else
          say ANSI.yellow {
            I18n.t("commands.compare.diverging",
              branch: ANSI.bold { head }) }
        end

        say ANSI.green { head.compare_link(base) }
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
abak-flow-1.0.8 lib/abak-flow/commands/compare.rb