Class: CookbookDevelopment::MetadataVersion

Inherits:
VersionFile
  • Object
show all
Defined in:
lib/cookbook/development/rake/version_tasks.rb

Constant Summary

Constants inherited from VersionFile

VersionFile::ALT_VERSION_FILE, VersionFile::VERSION_FILE

Instance Attribute Summary

Attributes inherited from VersionFile

#path, #version

Instance Method Summary collapse

Methods inherited from VersionFile

#bump, #bump!, in_dir, #save

Constructor Details

#initialize(path) ⇒ MetadataVersion

Returns a new instance of MetadataVersion.



60
61
62
63
64
65
# File 'lib/cookbook/development/rake/version_tasks.rb', line 60

def initialize(path)
  @path = Pathname.new(path)
  @metadata = @path.read
  @metadata =~ /version\s+'(\d+\.\d+\.\d+)'/
  @version = $1
end

Instance Method Details

#to_sObject



67
68
69
# File 'lib/cookbook/development/rake/version_tasks.rb', line 67

def to_s
  @metadata.sub(/(^version\s+')(\d+\.\d+\.\d+)(')/, "\\1#{@version}\\3" )
end