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
- 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.
- #to_s ⇒ Object (also: #to_str)
- #vendor ⇒ Object
- #vendor_delimiter ⇒ Object
Constructor Details
#initialize(recipe, target, config) ⇒ Version
Returns a new instance of Version.
17 18 19 20 21 22 23 |
# File 'lib/fpm/cookery/package/version.rb', line 17 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.
15 16 17 |
# File 'lib/fpm/cookery/package/version.rb', line 15 def epoch @epoch end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
15 16 17 |
# File 'lib/fpm/cookery/package/version.rb', line 15 def revision @revision end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
15 16 17 |
# File 'lib/fpm/cookery/package/version.rb', line 15 def version @version end |
Instance Method Details
#to_s ⇒ Object Also known as: to_str
33 34 35 36 37 38 39 |
# File 'lib/fpm/cookery/package/version.rb', line 33 def to_s if vendor "#{version}-#{revision}#{vendor_delimiter}#{vendor}" else "#{version}-#{revision}" end end |
#vendor ⇒ Object
25 26 27 |
# File 'lib/fpm/cookery/package/version.rb', line 25 def vendor @config[:vendor] || @recipe.vendor end |
#vendor_delimiter ⇒ Object
29 30 31 |
# File 'lib/fpm/cookery/package/version.rb', line 29 def vendor_delimiter VENDOR_DELIMITER[@target.to_sym] || VENDOR_DELIMITER[:default] end |