Module: DevopsAssist::VersionManager

Extended by:
TR::VUtils
Defined in:
lib/devops_assist/version_manager.rb

Class Method Summary collapse

Class Method Details

.prompt_version(gemName, last_version = "0.1.0") ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/devops_assist/version_manager.rb', line 8

def self.prompt_version(gemName, last_version = "0.1.0")

  #begin

    last_version = "0.1.0" if is_empty?(last_version)

    pmt = TTY::Prompt.new
    vers = possible_versions(last_version)

    vv = []
    vv << vers[2]
    vv << vers[1]
    vv << vers[0]

    vv << "Custom"
    vv << "Quit"
    #vers << [      #          "Maybe not now..."      #          ,"Nah, forget it..."      #].sample

    vsel = pmt.select("  Please select one of the versions below:") do |menu|
      menu.choice "#{last_version} (current version - no change in version)", :no_change
      #vers.each do |v|
      vv.each do |v|
        menu.choice v
      end
    end

    case vsel
    when :no_change
      vsel = last_version
    when "Custom"
      vsel = pmt.ask("  Please provide custom version no:", required: true) 
    when vv[-1]
      raise DevopsAssist::Error, "  Aborted. Have a nice day! " 
    end

    vsel

  #rescue TTY::Reader::InputInterrupt
  #  raise DevopsAssist::Error
  #end
  
end