Class: Dflat::Version::Dir

Inherits:
Dir
  • Object
show all
Includes:
LockIt::Mixin, Namaste::Mixin
Defined in:
lib/dflat/version.rb

Direct Known Subclasses

Delta, Empty, Full

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load(path) ⇒ Object



10
11
12
13
14
15
# File 'lib/dflat/version.rb', line 10

def self.load path
  d = Dir.new path
  return Full.new path if d.entries.any? { |f| f =~ /full/ }
  return Delta.new path if types.any? { |t| t[:name] =~ /redd/i }
	return Empty.new path
end

Instance Method Details

#manifestObject



20
21
22
23
24
# File 'lib/dflat/version.rb', line 20

def manifest
  data = ''
  data = open(manifest_path).read if File.exists? manifest_path
  @manifest ||= Checkm::Manifest.new data, :path => data_path
end

#manifest!Object



26
27
28
29
# File 'lib/dflat/version.rb', line 26

def manifest!
  @manifest = nil
  manifest
end

#versionObject



17
18
19
# File 'lib/dflat/version.rb', line 17

def version
  File.basename(path)
end