Class: CookbookDevelopment::MetadataVersion
- Inherits:
-
VersionFile
- Object
- VersionFile
- CookbookDevelopment::MetadataVersion
- 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
Instance Method Summary collapse
-
#initialize(path) ⇒ MetadataVersion
constructor
A new instance of MetadataVersion.
- #to_s ⇒ Object
Methods inherited from VersionFile
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_s ⇒ Object
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 |