Top Level Namespace
Defined Under Namespace
Modules: DateParser, Editor, Hashify, StringHelper, Worklog Classes: DefaultHeaderMiddleware, Hash, Person, Printer, Statistics, Summary, WorkLogApp, WorkLogResponse, WorkLogServer, WorkLogger, WorklogCLI
Constant Summary collapse
- STATS =
Data.define(:total_days, :total_entries, :total_epics, :avg_entries, :first_entry, :last_entry)
Instance Method Summary collapse
-
#current_version ⇒ String
Returns the current version of the gem from ‘.version`.
-
#increment_version(version, part = 'patch') ⇒ String
Increment version number according to SemVer.
Instance Method Details
#current_version ⇒ String
Returns the current version of the gem from ‘.version`. Versioning follows SemVer.
8 9 10 11 |
# File 'lib/version.rb', line 8 def current_version version_file_path = File.join(Pathname.new(__dir__).parent, '.version') File.read(version_file_path).strip end |
#increment_version(version, part = 'patch') ⇒ String
Increment version number according to SemVer.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/version.rb', line 17 def increment_version(version, part = 'patch') raise ArgumentError if version.nil? || version.empty? || !version.match?(/^\d+\.\d+\.\d+$/) # Validate the part to increment raise ArgumentError, "Invalid part: #{part}" unless %w[major minor patch].include?(part) major, minor, patch = version.split('.').map(&:to_i) case part when 'major' major += 1 minor = 0 patch = 0 when 'minor' minor += 1 patch = 0 when 'patch' patch += 1 end [major, minor, patch].join('.') end |