Top Level Namespace

Defined Under Namespace

Modules: Tagistrano

Instance Method Summary collapse

Instance Method Details

#ask_for_tagObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/tagistrano/tagging.rb', line 14

def ask_for_tag
  next_tags = Tagistrano::Tag.next_tags

  puts "\nTag: (leave blank to skip tagging)".underline

  prompt = <<-prompt

1. Major #{next_tags.first}
2. Minor #{next_tags.second}
3. Patch #{next_tags.third}
  prompt

  ask(prompt, '')

  option = fetch(prompt)

  if ["1", "2", "3", ""].include?(option.strip)
    option.to_i > 0 ? next_tags[option.to_i - 1] : nil
  else
    puts "Didn't get 1, 2, 3 or blank".colorize(:red)
    ask_for_tag
  end
end

#tag_releaseObject



6
7
8
9
10
11
12
# File 'lib/tagistrano/tagging.rb', line 6

def tag_release
  if tag = ask_for_tag.presence
    puts "\nTagging as #{tag}\n\n".colorize(:green)
    `git tag #{tag}`
    `git push --tags`
  end
end