Sha256: 2a3e1b0fea3f3f1151dcfcaebb9cc555acf94b7fd485eb80e65113292eb1346a

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

module RTM # :nodoc:
  module VERSION # :nodoc:
    unless self.const_defined?("MAJOR")
      require 'date'
      if Object.const_defined?("Gem") && rtmgem = Gem.loaded_specs["rtm"]
        # Try to determine version from Gem, if we're loaded from there
        today = rtmgem.date
      elsif File.exist?(File.join(File.dirname(__FILE__), "../../../.hg"))
        begin
          # Try to get the latest Mercurial commit date
           hg_date_string = `hg --cwd "#{File.dirname(__FILE__)}" parent --template "{date|isodate}"`
           today = Date.parse(hg_date_string)
         rescue Exception => e
           warn("We're running from Mercurial, but Mercurial binary 'hg' is not in system path (or something else with parsing version from hg went wront)")
         end
      end
      # Fall back to current day if not set before
      today ||= Date.today

      DATE = [today.year, today.month, today.day]
      ISODATE = "%04d-%02d-%02d" % DATE # => "2010-01-26"
      COMPACTDATE = "%04d%02d%02d" % DATE # => "20100126"

      MAJOR  = 0
      MINOR  = 3
      TINY   = 0
      BUILD  = ENV['BUILD_NUMBER'] || COMPACTDATE

      #STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
      STRING = [MAJOR, MINOR, TINY].compact.join('.')

      SUMMARY = "rtm #{STRING}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.3.0 lib/rtm/version.rb