Class: FPM::Cookery::ChainPackager
- Inherits:
-
Object
- Object
- FPM::Cookery::ChainPackager
- Includes:
- Utils
- Defined in:
- lib/fpm/cookery/chain_packager.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#packager ⇒ Object
readonly
Returns the value of attribute packager.
-
#recipe ⇒ Object
readonly
Returns the value of attribute recipe.
Instance Method Summary collapse
-
#initialize(packager, config) ⇒ ChainPackager
constructor
A new instance of ChainPackager.
- #install_build_deps ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(packager, config) ⇒ ChainPackager
Returns a new instance of ChainPackager.
11 12 13 14 15 |
# File 'lib/fpm/cookery/chain_packager.rb', line 11 def initialize(packager, config) @packager = packager @recipe = packager.recipe @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/fpm/cookery/chain_packager.rb', line 9 def config @config end |
#packager ⇒ Object (readonly)
Returns the value of attribute packager.
9 10 11 |
# File 'lib/fpm/cookery/chain_packager.rb', line 9 def packager @packager end |
#recipe ⇒ Object (readonly)
Returns the value of attribute recipe.
9 10 11 |
# File 'lib/fpm/cookery/chain_packager.rb', line 9 def recipe @recipe end |
Instance Method Details
#install_build_deps ⇒ Object
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 |
# File 'lib/fpm/cookery/chain_packager.rb', line 17 def install_build_deps recipe.run_lifecycle_hook(:before_dependency_installation) DependencyInspector.verify!([], recipe.build_depends) recipe.chain_recipes.each do |name| recipe_file = build_recipe_file_path(name) unless File.exists?(recipe_file) Log.fatal "Cannot find a recipe for #{name} at #{recipe_file}" exit 1 end FPM::Cookery::Book.instance.load_recipe(recipe_file, config) do |dep_recipe| depPackager = FPM::Cookery::Packager.new(dep_recipe, config.to_hash) depPackager.target = FPM::Cookery::Facts.target.to_s #Chain, chain, chain ... if dep_recipe.omnibus_package == true FPM::Cookery::OmnibusPackager.new(depPackager, config).install_build_deps elsif dep_recipe.chain_package == true FPM::Cookery::ChainPackager.new(depPackager, config).install_build_deps else depPackager.install_build_deps end end recipe.run_lifecycle_hook(:after_dependency_installation) Log.info("Build dependencies installed!") end end |
#run ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fpm/cookery/chain_packager.rb', line 44 def run Log.info "Recipe #{recipe.name} is a chain package; looking for child recipes to build" recipe.chain_recipes.each do |name| recipe_file = build_recipe_file_path(name) unless File.exists?(recipe_file) Log.fatal "Cannot find a recipe for #{name} at #{recipe_file}" exit 1 end Log.info "Located recipe at #{recipe_file} for child recipe #{name}; starting build" FPM::Cookery::Book.instance.load_recipe(recipe_file, config) do |dep_recipe| depPackager = FPM::Cookery::Packager.new(dep_recipe, config.to_hash) depPackager.target = FPM::Cookery::Facts.target.to_s #Chain, chain, chain ... if dep_recipe.omnibus_package == true FPM::Cookery::OmnibusPackager.new(depPackager, config).run elsif dep_recipe.chain_package == true FPM::Cookery::ChainPackager.new(depPackager, config).run else depPackager.dispense end end Log.info "Finished building #{name}, moving on to next recipe" end packager.dispense end |