Module: Version

Defined in:
lib/autosparkle/helpers/version_helpers.rb

Overview

This module is used to bump the version of the app It receives the current version and the method to bump the version It returns the new version

Class Method Summary collapse

Class Method Details

.bump(current_version, method) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/autosparkle/helpers/version_helpers.rb', line 7

def self.bump(current_version, method)
  major, minor, patch = current_version.segments

  case method
  when 'major'
    major += 1
    # Reset minor and patch versions
    minor = 0
    patch = 0
  when 'minor'
    minor += 1
    # Reset patch version
    patch = 0
  when 'patch'
    patch += 1
  else
    raise ArgumentError, "Unknown bump method: #{method}"
  end

  "#{major}.#{minor}.#{patch}"
end