Class: FPM::Cookery::OmnibusPackager
- Inherits:
-
Object
- Object
- FPM::Cookery::OmnibusPackager
- Includes:
- Utils
- Defined in:
- lib/fpm/cookery/omnibus_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) ⇒ OmnibusPackager
constructor
A new instance of OmnibusPackager.
- #load_omnibus_recipes(_recipe) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(packager, config) ⇒ OmnibusPackager
Returns a new instance of OmnibusPackager.
11 12 13 14 15 16 |
# File 'lib/fpm/cookery/omnibus_packager.rb', line 11 def initialize(packager, config) @packager = packager @config = config @recipe = packager.recipe @depends = [] end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
9 10 11 |
# File 'lib/fpm/cookery/omnibus_packager.rb', line 9 def config @config end |
#packager ⇒ Object (readonly)
Returns the value of attribute packager.
9 10 11 |
# File 'lib/fpm/cookery/omnibus_packager.rb', line 9 def packager @packager end |
#recipe ⇒ Object (readonly)
Returns the value of attribute recipe.
9 10 11 |
# File 'lib/fpm/cookery/omnibus_packager.rb', line 9 def recipe @recipe end |
Instance Method Details
#load_omnibus_recipes(_recipe) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fpm/cookery/omnibus_packager.rb', line 18 def load_omnibus_recipes(_recipe) dep_recipes = [] _recipe.omnibus_recipes.each do |name| recipe_file = build_recipe_file_path(name) Log.info "Loading dependency recipe #{name} from #{recipe_file}" 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| dep_recipe.destdir = "#{recipe.omnibus_dir}/embedded" if recipe.omnibus_dir dep_recipe.omnibus_installing = true if recipe.omnibus_dir if dep_recipe.omnibus_recipes.any? dep_recipes += load_omnibus_recipes(dep_recipe) end dep_recipes << dep_recipe end end dep_recipes end |
#run ⇒ Object
40 41 42 43 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 |
# File 'lib/fpm/cookery/omnibus_packager.rb', line 40 def run # Omnibus packages are many builds in one package; e.g. Ruby + Puppet together. Log.info "Recipe #{recipe.name} is an Omnibus package; looking for child recipes to build" dep_recipes = load_omnibus_recipes(recipe) dep_recipes.uniq.each do |dep_recipe| pkg = FPM::Cookery::Packager.new(dep_recipe, :skip_package => true, :keep_destdir => true) pkg.target = FPM::Cookery::Facts.target.to_s Log.info "Located recipe for child recipe #{dep_recipe.name}; starting build" pkg.dispense @depends += dep_recipe.depends Log.info "Finished building #{dep_recipe.name}, moving on to next recipe" end # Now all child recipes are built; set depends to combined set of dependencies recipe.class.depends(@depends.flatten.uniq) Log.info "Combined dependencies: #{recipe.depends.join(', ')}" recipe.destdir = recipe.omnibus_dir if recipe.omnibus_dir if recipe.omnibus_additional_paths packager.config[:input] = [ recipe.destdir ] + recipe.omnibus_additional_paths else packager.config[:input] = recipe.destdir end packager.config[:keep_destdir] = true packager.dispense end |