Module: ASConstants

Defined in:
common/asconstants.rb

Overview

will be adding this file to .gitignore the version and schema_info values should be updated with the ant dist task

Defined Under Namespace

Modules: Repository, Solr

Class Method Summary collapse

Class Method Details

.find_versionObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'common/asconstants.rb', line 47

def self.find_version
  # give priority to env, if this is set there's a reason for it
  return ENV['ARCHIVESSPACE_VERSION'] if ENV['ARCHIVESSPACE_VERSION']

  # should be safe to assume that if we're a devserver we have git and would prefer the branch or tag ...
  return `git symbolic-ref -q --short HEAD || git describe --tags --exact-match`.chomp if java.lang.System.get_property('aspace.devserver')

  version = java.lang.ClassLoader.getSystemClassLoader.getResourceAsStream("ARCHIVESSPACE_VERSION")
  return version.to_io.read.strip if version

  version = File.join(*[ ASUtils.find_base_directory, 'ARCHIVESSPACE_VERSION'])
  return File.read(version).chomp if File.file? version

  # well, we tried our best
  raise 'ARCHIVESSPACE_VERSION not found'
end

.VERSIONObject



36
37
38
39
40
41
42
43
# File 'common/asconstants.rb', line 36

def self.VERSION
  begin
    find_version
  rescue Exception => ex
    $stderr.puts("Unable to determine ArchivesSpace version: #{ex.message}")
    'NO VERSION'
  end
end