Sha256: 296db91226f10e0b54f54c5f49590d324501af5079bac1d7a5d9376a648db27c

Contents?: true

Size: 978 Bytes

Versions: 11

Compression:

Stored size: 978 Bytes

Contents

module RESTFramework
  module Version
    @_version = nil

    def self.get_version
      # Return cached @_version, if available.
      return @_version if @_version

      # First, attempt to get the version from git.
      begin
        version = `git describe 2>/dev/null`.strip
        raise "blank version" if version.nil? || version.match(/^\w*$/)
        # Check for local changes.
        changes = `git status --porcelain 2>/dev/null`
        version << '.localchanges' if changes.strip.length > 0
        return version
      rescue
      end

      # Git failed, so try to find a VERSION_STAMP.
      begin
        version = File.read(File.expand_path("VERSION_STAMP", __dir__))
        unless version.nil? || version.match(/^\w*$/)
          return (@_version = version)  # cache VERSION_STAMP content
        end
      rescue
      end

      # No VERSION_STAMP, so version is unknown.
      return '0.unknown'
    end
  end

  VERSION = Version.get_version()
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rest_framework-0.1.3 lib/rest_framework/version.rb
rest_framework-0.1.1 lib/rest_framework/version.rb
rest_framework-0.1.0 lib/rest_framework/version.rb
rest_framework-0.0.16 lib/rest_framework/version.rb
rest_framework-0.0.15 lib/rest_framework/version.rb
rest_framework-0.0.14 lib/rest_framework/version.rb
rest_framework-0.0.13 lib/rest_framework/version.rb
rest_framework-0.0.12 lib/rest_framework/version.rb
rest_framework-0.0.10 lib/rest_framework/version.rb
rest_framework-0.0.9 lib/rest_framework/version.rb
rest_framework-0.0.8 lib/rest_framework/version.rb