Module: PDK::Util::Version
- Defined in:
- lib/pdk/util/version.rb
Class Method Summary collapse
- .git_ref ⇒ Object
- .pdk_ref ⇒ Object
- .pkg_sha ⇒ Object
- .version_file ⇒ Object
- .version_string ⇒ Object
Class Method Details
.git_ref ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/pdk/util/version.rb', line 26 def self.git_ref require 'pdk/util/git' source_git_dir = File.join(PDK::Util::Filesystem.('../../..', File.dirname(__FILE__)), '.git') return unless PDK::Util::Filesystem.directory?(source_git_dir) PDK::Util::Git.describe(source_git_dir) end |
.pdk_ref ⇒ Object
12 13 14 15 |
# File 'lib/pdk/util/version.rb', line 12 def self.pdk_ref ref = "#{pkg_sha} #{git_ref}".strip ref.empty? ? nil : "(#{ref})" end |
.pkg_sha ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/pdk/util/version.rb', line 17 def self.pkg_sha if version_file && PDK::Util::Filesystem.exist?(version_file) ver = PDK::Util::Filesystem.read_file(version_file) sha = ver.strip.split('.')[5] unless ver.nil? end sha end |
.version_file ⇒ Object
35 36 37 38 39 40 |
# File 'lib/pdk/util/version.rb', line 35 def self.version_file require 'pdk/util' # FIXME: this gets called a LOT and doesn't currently get cached PDK::Util.find_upwards('PDK_VERSION', File.dirname(__FILE__)) end |