Module: ReleaseNotes::Versioning::Semantic

Defined in:
lib/release_notes/versioning/semantic.rb

Class Method Summary collapse

Class Method Details

.increment(version, type) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/release_notes/versioning/semantic.rb', line 6

def increment(version, type)
  if version.nil?
    ReleaseNotes.starting_version
  else
    parts = parse_version(version.gsub('.md', ''))

    if type.downcase == 'major' or type == 'M'
      parts = increment_major(parts)
    elsif type.downcase == 'minor' or type == 'm'
      parts = increment_minor(parts)
    else
      parts = increment_patch(parts)
    end
      
    new_version = parts.join('.')
    new_version
  end
end