Sha256: 85034748cb54923b39e2a91eb851ebc0b830c3fa95d364202c13abfd6a20ddf0

Contents?: true

Size: 1.26 KB

Versions: 42

Compression:

Stored size: 1.26 KB

Contents

require_relative "../scripts"

module Octopolo
  module Scripts
    class CompareRelease
      include Base
      include GitWrapper
      include ConfigWrapper
      include CLIWrapper

      attr_accessor :start
      attr_accessor :stop

      def self.execute(start, stop)
        new(start, stop).execute
      end

      def initialize(start=nil, stop=nil)
        @start = start
        @stop  = stop
      end

      def execute
        ask_starting_tag
        ask_stopping_tag
        open_compare_page
      end

      # Public: Ask, if not already set, which tag to start with
      def ask_starting_tag
        self.start ||= cli.ask("Start with which tag?", git.recent_release_tags)
      end

      # Public: Ask, if not already set, which tag to end with
      def ask_stopping_tag
        self.stop ||= cli.ask("Compare from #{start} to which tag?", git.recent_release_tags)
      end

      # Public: Open the GitHub compare URL for the starting and ending branches
      def open_compare_page
        cli.copy_to_clipboard compare_url
        cli.open compare_url
      end

      # Public: The GitHub compare URL for the selected tags
      def compare_url
        "https://github.com/#{config.github_repo}/compare/#{start}...#{stop}?w=1"
      end
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
octopolo-1.12.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.11.4 lib/octopolo/scripts/compare_release.rb
octopolo-1.11.3 lib/octopolo/scripts/compare_release.rb
octopolo-1.11.1 lib/octopolo/scripts/compare_release.rb
octopolo-1.11.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.9.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.8.1 lib/octopolo/scripts/compare_release.rb
octopolo-1.8.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.7.1 lib/octopolo/scripts/compare_release.rb
octopolo-1.7.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.6.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.5.3 lib/octopolo/scripts/compare_release.rb
octopolo-1.5.2 lib/octopolo/scripts/compare_release.rb
octopolo-1.5.1 lib/octopolo/scripts/compare_release.rb
octopolo-1.5.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.4.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.3.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.2.1 lib/octopolo/scripts/compare_release.rb
octopolo-1.2.0 lib/octopolo/scripts/compare_release.rb
octopolo-1.1.1 lib/octopolo/scripts/compare_release.rb