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 => '-' }
- DEFAULT_VERSION =
fpm sets the default version in FPM::Command; since we bypass the command line interface, we need to set our own value.
'1.0'
Instance Attribute Summary collapse
-
#epoch ⇒ Object
readonly
Returns the value of attribute epoch.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
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
- #version ⇒ Object
Constructor Details
#initialize(recipe, target, config) ⇒ Version
Returns a new instance of Version.
25 26 27 28 29 30 31 |
# File 'lib/fpm/cookery/package/version.rb', line 25 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.
23 24 25 |
# File 'lib/fpm/cookery/package/version.rb', line 23 def epoch @epoch end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
23 24 25 |
# File 'lib/fpm/cookery/package/version.rb', line 23 def revision @revision end |
Instance Method Details
#revision_delimiter ⇒ Object
41 42 43 |
# File 'lib/fpm/cookery/package/version.rb', line 41 def revision_delimiter REVISION_DELIMITER[:default] end |
#to_s ⇒ Object Also known as: to_str
50 51 52 53 54 55 |
# File 'lib/fpm/cookery/package/version.rb', line 50 def to_s s_revision = revision ? "#{revision_delimiter}#{revision}" : "" s_vendor = vendor ? "#{vendor_delimiter}#{vendor}" : "" "#{version}#{s_revision}#{s_vendor}" end |
#vendor ⇒ Object
33 34 35 |
# File 'lib/fpm/cookery/package/version.rb', line 33 def vendor @config[:vendor] || @recipe.vendor end |
#vendor_delimiter ⇒ Object
45 46 47 48 |
# File 'lib/fpm/cookery/package/version.rb', line 45 def vendor_delimiter return @config[:vendor_delimiter] if @config[:vendor_delimiter] VENDOR_DELIMITER[@target.to_sym] || VENDOR_DELIMITER[:default] end |
#version ⇒ Object
37 38 39 |
# File 'lib/fpm/cookery/package/version.rb', line 37 def version @version ||= DEFAULT_VERSION end |