Module: FeduxOrgStdlib::Versionable

Included in:
Rake::VersionBumpTask
Defined in:
lib/fedux_org_stdlib/versionable.rb

Instance Method Summary collapse

Instance Method Details

#version_file(working_directory = Dir.getwd) ⇒ Object

Raises:

  • (Exceptions::VersionFileNotFound)


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fedux_org_stdlib/versionable.rb', line 6

def version_file(working_directory = Dir.getwd)
  paths = []
  paths << File.join(working_directory, 'lib', '*', 'version.rb')
  paths << File.join(working_directory, 'lib', '*', '*', 'version.rb')

  file = Dir.glob(paths.shift).first while !paths.blank? and file.blank?

  raise Exceptions::VersionFileNotFound, JSON.dump(message: 'Cannot find version file') unless file

  file
end