Class/Module Index [+]

Quicksearch

Compass::Version

Public Instance Methods

version() click to toggle source

Returns a hash representing the version. The :major, :minor, and :teeny keys have their respective numbers. The :string key contains a human-readable string representation of the version. The :rev key will have the current revision hash.

This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum

# File lib/compass/version.rb, line 9
def version
  if defined?(@version)
    @version
  else
    read_version
  end
end

Protected Instance Methods

read_version() click to toggle source
# File lib/compass/version.rb, line 23
def read_version
  require 'yaml'
  @version = YAML::load(File.read(scope('VERSION.yml')))
  @version[:teeny]  = @version[:patch]
  @version[:string] = "#{@version[:major]}.#{@version[:minor]}"
  @version[:string] << ".#{@version[:patch]}" if @version[:patch]
  @version[:string] << ".#{@version[:build]}" if @version[:build]
  @version[:string] << ".#{@version[:state]}" if @version[:state]
  @version[:string] << ".#{@version[:iteration]}" if @version[:iteration]
  if !ENV['OFFICIAL'] && r = revision
    @version[:string] << ".#{r[0..6]}"
  end
  @version
end
revision() click to toggle source
# File lib/compass/version.rb, line 38
def revision
  revision_from_git
end
revision_from_git() click to toggle source
# File lib/compass/version.rb, line 42
def revision_from_git
  if File.exists?(scope('.git/HEAD'))
    Dir.chdir scope(".") do
      `git rev-parse HEAD`
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.