Class: FPM::Cookery::Package::Version
- Inherits:
-
Object
- Object
- FPM::Cookery::Package::Version
- Defined in:
- lib/fpm/cookery/package/version.rb
Overview
See the following URLs for package naming conventions.
Constant Summary collapse
- REVISION_DELIMITER =
{ :default => '-' }
- VENDOR_DELIMITER =
{ :deb => '+', :rpm => '.', :default => '-' }
Instance Attribute Summary collapse
-
#epoch ⇒ Object
readonly
Returns the value of attribute epoch.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(recipe, target, config) ⇒ Version
constructor
A new instance of Version.
- #revision_delimiter ⇒ Object
- #to_s ⇒ Object (also: #to_str)
- #vendor ⇒ Object
- #vendor_delimiter ⇒ Object
Constructor Details
#initialize(recipe, target, config) ⇒ Version
Returns a new instance of Version.
21 22 23 24 25 26 27 |
# File 'lib/fpm/cookery/package/version.rb', line 21 def initialize(recipe, target, config) @recipe = recipe @target = target @config = config @revision = recipe.revision @version, @epoch = split_version(@recipe.version) end |
Instance Attribute Details
#epoch ⇒ Object (readonly)
Returns the value of attribute epoch.
19 20 21 |
# File 'lib/fpm/cookery/package/version.rb', line 19 def epoch @epoch end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
19 20 21 |
# File 'lib/fpm/cookery/package/version.rb', line 19 def revision @revision end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
19 20 21 |
# File 'lib/fpm/cookery/package/version.rb', line 19 def version @version end |
Instance Method Details
#revision_delimiter ⇒ Object
33 34 35 |
# File 'lib/fpm/cookery/package/version.rb', line 33 def revision_delimiter REVISION_DELIMITER[:default] end |
#to_s ⇒ Object Also known as: to_str
41 42 43 44 45 46 |
# File 'lib/fpm/cookery/package/version.rb', line 41 def to_s s_revision = revision ? "#{revision_delimiter}#{revision}" : "" s_vendor = vendor ? "#{vendor_delimiter}#{vendor}" : "" "#{version}#{s_revision}#{s_vendor}" end |
#vendor ⇒ Object
29 30 31 |
# File 'lib/fpm/cookery/package/version.rb', line 29 def vendor @config[:vendor] || @recipe.vendor end |
#vendor_delimiter ⇒ Object
37 38 39 |
# File 'lib/fpm/cookery/package/version.rb', line 37 def vendor_delimiter VENDOR_DELIMITER[@target.to_sym] || VENDOR_DELIMITER[:default] end |