/usr/lib/ruby/1.8/compass/version.rb is in libcompass-ruby1.8 0.10.6~dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | module Compass
module Version
# 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
def version
if defined?(@version)
@version
else
read_version
end
end
protected
def scope(file) # :nodoc:
File.join(File.dirname(__FILE__), '..', '..', file)
end
def read_version
require 'yaml'
@version = YAML::load(File.read(File.join('/usr/lib/ruby', RUBY_VERSION.match(/^\d+\.\d+/).to_s, 'compass/VERSION.yml')))
@version[:teeny] = @version[:patch]
@version[:string] = "#{@version[:major]}.#{@version[:minor]}.#{@version[:patch]}"
@version[:string] << ".#{@version[:build]}" if @version[:build]
@version
end
def revision
revision_from_git
end
def revision_from_git
if File.exists?(scope('.git/HEAD'))
rev = File.read(scope('.git/HEAD')).strip
if rev =~ /^ref: (.*)$/
rev = File.read(scope(".git/#{$1}")).strip
end
end
end
end
extend Compass::Version
def self.const_missing(const)
# This avoid reading from disk unless the VERSION is requested.
if const == :VERSION
version[:string]
else
super
end
end
end
|