Module: ChiliProject::VERSION

Defined in:
lib/chili_project/version.rb

Overview

:nodoc:

Constant Summary collapse

MAJOR =
3
MINOR =
8
PATCH =
0
TINY =

Redmine compat

PATCH
REVISION =
self.revision
ARRAY =
[MAJOR, MINOR, PATCH, REVISION].compact
STRING =
ARRAY.join('.')

Class Method Summary collapse

Class Method Details

.revisionObject


40
41
42
43
44
45
46
47
48
49
# File 'lib/chili_project/version.rb', line 40

def self.revision
  @revision ||= begin
    git = Redmine::Scm::Adapters::GitAdapter
    git_dir = Rails.root.join('.git')

    if File.directory? git_dir
      git.send(:shellout, "#{git.sq_bin} --git-dir=#{git.shell_quote git_dir.to_s} rev-parse --short=9 HEAD") { |io| io.read }.to_s.chomp
    end
  end
end

.specialObject

Used by semver to define the special version (if any). A special version “satify but have a lower precedence than the associated normal version”. So 2.0.0RC1 would be part of the 2.0.0 series but be considered to be an older version.

1.4.0 < 2.0.0RC1 < 2.0.0RC2 < 2.0.0 < 2.1.0

This method may be overridden by third party code to provide vendor or distribution specific versions. They may or may not follow semver.org:

2.0.0debian-2

36
37
38
# File 'lib/chili_project/version.rb', line 36

def self.special
  ''
end

.to_aObject


55
# File 'lib/chili_project/version.rb', line 55

def self.to_a; ARRAY end

.to_sObject


56
# File 'lib/chili_project/version.rb', line 56

def self.to_s; STRING end

.to_semverObject


57
58
59
# File 'lib/chili_project/version.rb', line 57

def self.to_semver
  [MAJOR, MINOR, PATCH].join('.') + special
end