Class: FPM::Cookery::Package::Package
- Inherits:
-
Object
- Object
- FPM::Cookery::Package::Package
- Defined in:
- lib/fpm/cookery/package/package.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#fpm ⇒ Object
readonly
Returns the value of attribute fpm.
-
#recipe ⇒ Object
readonly
Returns the value of attribute recipe.
Instance Method Summary collapse
- #add_script(type, content) ⇒ Object
- #cleanup ⇒ Object
- #convert(output_class) ⇒ Object
- #epoch=(value) ⇒ Object
- #fpm_object ⇒ Object
-
#initialize(recipe, config = {}) ⇒ Package
constructor
A new instance of Package.
- #maintainer=(value) ⇒ Object
- #package_input ⇒ Object
- #package_setup ⇒ Object
- #vendor=(value) ⇒ Object
-
#version=(version) ⇒ Object
XXX should go away and set in initializer.
Constructor Details
#initialize(recipe, config = {}) ⇒ Package
Returns a new instance of Package.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fpm/cookery/package/package.rb', line 9 def initialize(recipe, config = {}) @recipe = recipe @config = config @fpm = fpm_object @fpm.name = recipe.name @fpm.url = recipe.homepage @fpm.category = recipe.section || 'optional' @fpm.description = recipe.description.strip if recipe.description @fpm.architecture = recipe.arch.to_s if recipe.arch @fpm.dependencies += recipe.depends @fpm.conflicts += recipe.conflicts @fpm.provides += recipe.provides @fpm.replaces += recipe.replaces @fpm.config_files += recipe.config_files @fpm.directories += recipe.directories @fpm.attributes[:deb_compression] = 'gz' @fpm.attributes[:deb_user] = 'root' @fpm.attributes[:deb_group] = 'root' @fpm.attributes[:rpm_compression] = 'gzip' @fpm.attributes[:rpm_digest] = 'md5' @fpm.attributes[:rpm_user] = 'root' @fpm.attributes[:rpm_group] = 'root' @fpm.attributes[:rpm_defattrfile] = '-' @fpm.attributes[:rpm_defattrdir] = '-' # TODO replace remove_excluded_files() in packager with this. @fpm.attributes[:excludes] = [] # Package type specific code should be called in package_setup. package_setup # combine recipe specific fpm attributes. here allows to # overwrite the values from package_setup(). @fpm.attributes.merge!(recipe.fpm_attributes) # The input for the FPM package will be set here. package_input # The call to input() overwrites the license and vendor attributes. # XXX Needs to be fixed in fpm/package/dir.rb. fpm.license = recipe.license if recipe.license end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/fpm/cookery/package/package.rb', line 7 def config @config end |
#fpm ⇒ Object (readonly)
Returns the value of attribute fpm.
7 8 9 |
# File 'lib/fpm/cookery/package/package.rb', line 7 def fpm @fpm end |
#recipe ⇒ Object (readonly)
Returns the value of attribute recipe.
7 8 9 |
# File 'lib/fpm/cookery/package/package.rb', line 7 def recipe @recipe end |
Instance Method Details
#add_script(type, content) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/fpm/cookery/package/package.rb', line 77 def add_script(type, content) case type.to_sym when :pre_install fpm.scripts[:before_install] = content when :post_install fpm.scripts[:after_install] = content when :pre_uninstall fpm.scripts[:before_remove] = content when :post_uninstall fpm.scripts[:after_remove] = content end end |
#cleanup ⇒ Object
73 74 75 |
# File 'lib/fpm/cookery/package/package.rb', line 73 def cleanup fpm.cleanup end |
#convert(output_class) ⇒ Object
69 70 71 |
# File 'lib/fpm/cookery/package/package.rb', line 69 def convert(output_class) fpm.convert(output_class) end |
#epoch=(value) ⇒ Object
105 106 107 |
# File 'lib/fpm/cookery/package/package.rb', line 105 def epoch=(value) fpm.epoch = value end |
#fpm_object ⇒ Object
55 56 57 58 |
# File 'lib/fpm/cookery/package/package.rb', line 55 def fpm_object # Has to be overwritten in a subclass. raise Error::MethodNotImplemented, "The #fpm_object method has not been implemented in #{self.class}" end |
#maintainer=(value) ⇒ Object
97 98 99 |
# File 'lib/fpm/cookery/package/package.rb', line 97 def maintainer=(value) fpm.maintainer = value end |
#package_input ⇒ Object
64 65 66 67 |
# File 'lib/fpm/cookery/package/package.rb', line 64 def package_input # Has to be overwritten in a subclass. raise Error::MethodNotImplemented, "The #package_input method has not been implemented in #{self.class}" end |
#package_setup ⇒ Object
60 61 62 |
# File 'lib/fpm/cookery/package/package.rb', line 60 def package_setup # Can be overwritten in a subclass. end |
#vendor=(value) ⇒ Object
101 102 103 |
# File 'lib/fpm/cookery/package/package.rb', line 101 def vendor=(value) fpm.vendor = value end |
#version=(version) ⇒ Object
XXX should go away and set in initializer
91 92 93 94 95 |
# File 'lib/fpm/cookery/package/package.rb', line 91 def version=(version) fpm.version = version.version fpm.iteration = version.revision fpm.vendor = version.vendor end |