Class: FPM::Fry::Recipe::PackageBuilder
- Inherits:
-
Object
- Object
- FPM::Fry::Recipe::PackageBuilder
- Defined in:
- lib/fpm/fry/recipe/builder.rb
Direct Known Subclasses
Instance Attribute Summary collapse
- #inspector ⇒ FPM::Fry::Inspector? readonly
- #logger ⇒ Cabin::Channel readonly
- #package_recipe ⇒ FPM::Fry::PackageRecipe readonly
- #variables ⇒ Hash<Symbol,Object> readonly
Instance Method Summary collapse
- #after_install(*args) ⇒ Object (also: #post_install, #postinstall)
- #after_remove(*args) ⇒ Object (also: #after_uninstall, #post_uninstall, #postuninstall)
- #architecture ⇒ Object
- #before_install(*args) ⇒ Object (also: #pre_install, #preinstall)
- #before_remove(*args) ⇒ Object (also: #before_uninstall, #pre_uninstall, #preuninstall)
- #codename ⇒ Object
- #conflicts(name, options = {}) ⇒ Object
- #depends(name, options = {}) ⇒ Object
- #distribution ⇒ Object (also: #platform)
- #files(pattern) ⇒ Object
-
#flavour ⇒ String
Returns the package type ( e.g. “debian” or “redhat” ).
-
#initialize(variables, package_recipe, options = {}) ⇒ PackageBuilder
constructor
private
A new instance of PackageBuilder.
- #iteration(value = Not) ⇒ Object (also: #revision)
- #name(value = Not) ⇒ Object
- #output_hooks ⇒ Object
- #plugin(name, *args, &block) ⇒ Object
- #provides(name, options = {}) ⇒ Object
-
#release ⇒ String
(also: #distribution_version)
The release version of the distribution ( e.g. “12.04” or “6.0.7” ).
- #replaces(name, options = {}) ⇒ Object
- #script(type, value = Not) ⇒ Object
- #vendor(value = Not) ⇒ Object
- #version(value = Not) ⇒ Object
Constructor Details
#initialize(variables, package_recipe, options = {}) ⇒ PackageBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PackageBuilder.
27 28 29 30 31 32 |
# File 'lib/fpm/fry/recipe/builder.rb', line 27 def initialize( variables, package_recipe, = {}) @variables = variables @package_recipe = package_recipe @logger = .fetch(:logger){ Cabin::Channel.get } @inspector = [:inspector] end |
Instance Attribute Details
#inspector ⇒ FPM::Fry::Inspector? (readonly)
24 25 26 |
# File 'lib/fpm/fry/recipe/builder.rb', line 24 def inspector @inspector end |
#logger ⇒ Cabin::Channel (readonly)
21 22 23 |
# File 'lib/fpm/fry/recipe/builder.rb', line 21 def logger @logger end |
#package_recipe ⇒ FPM::Fry::PackageRecipe (readonly)
18 19 20 |
# File 'lib/fpm/fry/recipe/builder.rb', line 18 def package_recipe @package_recipe end |
#variables ⇒ Hash<Symbol,Object> (readonly)
15 16 17 |
# File 'lib/fpm/fry/recipe/builder.rb', line 15 def variables @variables end |
Instance Method Details
#after_install(*args) ⇒ Object Also known as: post_install, postinstall
145 146 147 |
# File 'lib/fpm/fry/recipe/builder.rb', line 145 def after_install(*args) script(:after_install, *args) end |
#after_remove(*args) ⇒ Object Also known as: after_uninstall, post_uninstall, postuninstall
158 159 160 |
# File 'lib/fpm/fry/recipe/builder.rb', line 158 def after_remove(*args) script(:after_remove, *args) end |
#architecture ⇒ Object
58 59 60 |
# File 'lib/fpm/fry/recipe/builder.rb', line 58 def architecture variables[:architecture] end |
#before_install(*args) ⇒ Object Also known as: pre_install, preinstall
139 140 141 |
# File 'lib/fpm/fry/recipe/builder.rb', line 139 def before_install(*args) script(:before_install, *args) end |
#before_remove(*args) ⇒ Object Also known as: before_uninstall, pre_uninstall, preuninstall
151 152 153 |
# File 'lib/fpm/fry/recipe/builder.rb', line 151 def before_remove(*args) script(:before_remove, *args) end |
#codename ⇒ Object
54 55 56 |
# File 'lib/fpm/fry/recipe/builder.rb', line 54 def codename variables[:codename] end |
#conflicts(name, options = {}) ⇒ Object
89 90 91 92 93 94 95 96 97 |
# File 'lib/fpm/fry/recipe/builder.rb', line 89 def conflicts( name , = {} ) name, = parse_package(name, ) if package_recipe.conflicts.key? name raise Error.new("duplicate conflict",package: name) elsif package_recipe.depends.key? name raise Error.new("conflicting package is already a dependency",package: name) end package_recipe.conflicts[name] = end |
#depends(name, options = {}) ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/fpm/fry/recipe/builder.rb', line 79 def depends( name , = {} ) name, = parse_package(name, ) if package_recipe.depends.key? name raise Error.new("duplicate dependency",package: name) elsif package_recipe.conflicts.key? name raise Error.new("depending package is already a conflicting package",package: name) end package_recipe.depends[name] = end |
#distribution ⇒ Object Also known as: platform
40 41 42 |
# File 'lib/fpm/fry/recipe/builder.rb', line 40 def distribution variables[:distribution] end |
#files(pattern) ⇒ Object
109 110 111 |
# File 'lib/fpm/fry/recipe/builder.rb', line 109 def files( pattern ) package_recipe.files << pattern end |
#flavour ⇒ String
Returns the package type ( e.g. “debian” or “redhat” ).
36 37 38 |
# File 'lib/fpm/fry/recipe/builder.rb', line 36 def flavour variables[:flavour] end |
#iteration(value = Not) ⇒ Object Also known as: revision
62 63 64 |
# File 'lib/fpm/fry/recipe/builder.rb', line 62 def iteration(value = Not) get_or_set('@iteration',value) end |
#name(value = Not) ⇒ Object
71 72 73 |
# File 'lib/fpm/fry/recipe/builder.rb', line 71 def name(value = Not) get_or_set('@name',value) end |
#output_hooks ⇒ Object
165 166 167 |
# File 'lib/fpm/fry/recipe/builder.rb', line 165 def output_hooks package_recipe.output_hooks end |
#plugin(name, *args, &block) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/fpm/fry/recipe/builder.rb', line 113 def plugin(name, *args, &block) logger.debug('Loading Plugin', name: name, args: args, block: block, load_path: $LOAD_PATH) if name =~ /\A\./ require name else require File.join('fpm/fry/plugin',name) end module_name = File.basename(name,'.rb').gsub(/(?:\A|_)([a-z])/){ $1.upcase } mod = FPM::Fry::Plugin.const_get(module_name) if mod.respond_to? :apply mod.apply(self, *args, &block) else if args.any? or block_given? raise ArgumentError, "Simple plugins can't accept additional arguments and blocks." end extend(mod) end end |
#provides(name, options = {}) ⇒ Object
99 100 101 102 |
# File 'lib/fpm/fry/recipe/builder.rb', line 99 def provides( name , = {} ) name, = parse_package(name, ) package_recipe.provides[name] = end |
#release ⇒ String Also known as: distribution_version
The release version of the distribution ( e.g. “12.04” or “6.0.7” )
47 48 49 |
# File 'lib/fpm/fry/recipe/builder.rb', line 47 def release variables[:release] end |
#replaces(name, options = {}) ⇒ Object
104 105 106 107 |
# File 'lib/fpm/fry/recipe/builder.rb', line 104 def replaces( name , = {} ) name, = parse_package(name, ) package_recipe.replaces[name] = end |
#script(type, value = Not) ⇒ Object
132 133 134 135 136 137 |
# File 'lib/fpm/fry/recipe/builder.rb', line 132 def script(type, value = Not) if value != Not package_recipe.scripts[type] << value end return package_recipe.scripts[type] end |
#vendor(value = Not) ⇒ Object
75 76 77 |
# File 'lib/fpm/fry/recipe/builder.rb', line 75 def vendor(value = Not) get_or_set('@vendor',value) end |
#version(value = Not) ⇒ Object
67 68 69 |
# File 'lib/fpm/fry/recipe/builder.rb', line 67 def version(value = Not) get_or_set('@version',value) end |