Class: Octopolo::Scripts::CompareRelease

Inherits:
Object
  • Object
show all
Includes:
CLIWrapper, ConfigWrapper, GitWrapper, Base
Defined in:
lib/octopolo/scripts/compare_release.rb

Instance Attribute Summary collapse

Attributes included from CLIWrapper

#cli

Attributes included from ConfigWrapper

#config

Attributes included from GitWrapper

#git

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

included

Constructor Details

#initialize(start = nil, stop = nil) ⇒ CompareRelease

Returns a new instance of CompareRelease.



18
19
20
21
# File 'lib/octopolo/scripts/compare_release.rb', line 18

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

Instance Attribute Details

#startObject

Returns the value of attribute start.



11
12
13
# File 'lib/octopolo/scripts/compare_release.rb', line 11

def start
  @start
end

#stopObject

Returns the value of attribute stop.



12
13
14
# File 'lib/octopolo/scripts/compare_release.rb', line 12

def stop
  @stop
end

Class Method Details

.execute(start, stop) ⇒ Object



14
15
16
# File 'lib/octopolo/scripts/compare_release.rb', line 14

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

Instance Method Details

#ask_starting_tagObject

Public: Ask, if not already set, which tag to start with



30
31
32
# File 'lib/octopolo/scripts/compare_release.rb', line 30

def ask_starting_tag
  self.start ||= cli.ask("Start with which tag?", git.recent_release_tags)
end

#ask_stopping_tagObject

Public: Ask, if not already set, which tag to end with



35
36
37
# File 'lib/octopolo/scripts/compare_release.rb', line 35

def ask_stopping_tag
  self.stop ||= cli.ask("Compare from #{start} to which tag?", git.recent_release_tags)
end

#compare_urlObject

Public: The GitHub compare URL for the selected tags



46
47
48
# File 'lib/octopolo/scripts/compare_release.rb', line 46

def compare_url
  "https://github.com/#{config.github_repo}/compare/#{start}...#{stop}?w=1"
end

#executeObject



23
24
25
26
27
# File 'lib/octopolo/scripts/compare_release.rb', line 23

def execute
  ask_starting_tag
  ask_stopping_tag
  open_compare_page
end

#open_compare_pageObject

Public: Open the GitHub compare URL for the starting and ending branches



40
41
42
43
# File 'lib/octopolo/scripts/compare_release.rb', line 40

def open_compare_page
  cli.copy_to_clipboard compare_url
  cli.open compare_url
end