<commit_before>require 'fpm/cookery/packager'
require 'fpm/cookery/facts'

module FPM
  module Cookery
    class OmnibusPackager
      include FPM::Cookery::Utils

      attr_reader :packager, :recipe, :config

      def initialize(packager, config = {})
        @packager = packager
        @recipe = packager.recipe
        @config = config
        @depends = []
      end

      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"

        recipe.omnibus_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) do |dep_recipe|
            dep_recipe.destdir = "#{recipe.omnibus_dir}/embedded" if recipe.omnibus_dir

            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 at #{recipe_file} for child recipe #{name}; starting build"
            pkg.dispense

            @depends += dep_recipe.depends
            Log.info "Finished building #{name}, moving on to next recipe"
          end
        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

        packager.config[:input] = recipe.destdir
        packager.config[:keep_destdir] = true

        packager.dispense
      end

      private

      def build_recipe_file_path(name)
        # Look for recipes in the same dir as the recipe we loaded
        File.expand_path(File.dirname(recipe.filename) + "/#{name}.rb")
      end
    end
  end
end
<commit_msg>Remove config attribute from omnibus packager.<commit_after>require 'fpm/cookery/packager'
require 'fpm/cookery/facts'

module FPM
  module Cookery
    class OmnibusPackager
      include FPM::Cookery::Utils

      attr_reader :packager, :recipe

      def initialize(packager)
        @packager = packager
        @recipe = packager.recipe
        @depends = []
      end

      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"

        recipe.omnibus_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) do |dep_recipe|
            dep_recipe.destdir = "#{recipe.omnibus_dir}/embedded" if recipe.omnibus_dir

            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 at #{recipe_file} for child recipe #{name}; starting build"
            pkg.dispense

            @depends += dep_recipe.depends
            Log.info "Finished building #{name}, moving on to next recipe"
          end
        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

        packager.config[:input] = recipe.destdir
        packager.config[:keep_destdir] = true

        packager.dispense
      end

      private

      def build_recipe_file_path(name)
        # Look for recipes in the same dir as the recipe we loaded
        File.expand_path(File.dirname(recipe.filename) + "/#{name}.rb")
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.09229651162790697, 'fraction_numerical': 0.00048449612403100775, 'mean_word_length': 2.418046357615894, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '802761', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1244, 'n_words': 327}