<commit_before>module Dapp
  module Builder
    # Chef
    class Chef < Base
      LOCAL_COOKBOOK_PATTERNS = %w(
        recipes/**/*
        files/**/*
        templates/**/*
      ).freeze

      STAGE_LOCAL_COOKBOOK_PATTERNS = %w(
        recipes/%{stage}.rb
        recipes/*_%{stage}.rb
        files/%{stage}/*
        templates/%{stage}/*
      ).freeze

      CHEFDK_IMAGE = 'dapp2/chefdk:0.15.16-1'.freeze # TODO: config, DSL, DEFAULT_CHEFDK_IMAGE
      CHEFDK_CONTAINER = 'dapp2_chefdk_0.15.16-1'.freeze # FIXME hashsum(image) or dockersafe()

      [:infra_install, :infra_setup, :app_install, :app_setup].each do |stage|
        define_method(:"#{stage}_checksum") { stage_cookbooks_checksum(stage) }

        define_method(:"#{stage}") do |image|
          install_stage_cookbooks(stage)
          install_chef_solo_stage_config(stage)

          unless stage_empty?(stage)
            image.add_volumes_from(chefdk_container)
            image.add_volume "#{stage_build_path(stage)}:#{container_stage_build_path(stage)}"
            image.add_commands ['/opt/chefdk/bin/chef-solo',
                                "-c #{container_stage_config_path(stage)}",
                                "-o #{stage_cookbooks_runlist(stage).join(',')}"].join(' ')
          end
        end
      end<commit_msg>Fix chefdk image name<commit_after>module Dapp
  module Builder
    # Chef
    class Chef < Base
      LOCAL_COOKBOOK_PATTERNS = %w(
        recipes/**/*
        files/**/*
        templates/**/*
      ).freeze

      STAGE_LOCAL_COOKBOOK_PATTERNS = %w(
        recipes/%{stage}.rb
        recipes/*_%{stage}.rb
        files/%{stage}/*
        templates/%{stage}/*
      ).freeze

      CHEFDK_IMAGE = 'dappdeps/chefdk:0.15.16-1'.freeze # TODO: config, DSL, DEFAULT_CHEFDK_IMAGE
      CHEFDK_CONTAINER = 'dappdeps_chefdk_0.15.16-1'.freeze # FIXME hashsum(image) or dockersafe()

      [:infra_install, :infra_setup, :app_install, :app_setup].each do |stage|
        define_method(:"#{stage}_checksum") { stage_cookbooks_checksum(stage) }

        define_method(:"#{stage}") do |image|
          install_stage_cookbooks(stage)
          install_chef_solo_stage_config(stage)

          unless stage_empty?(stage)
            image.add_volumes_from(chefdk_container)
            image.add_volume "#{stage_build_path(stage)}:#{container_stage_build_path(stage)}"
            image.add_commands ['/opt/chefdk/bin/chef-solo',
                                "-c #{container_stage_config_path(stage)}",
                                "-o #{stage_cookbooks_runlist(stage).join(',')}"].join(' ')
          end
        end
      end
{'fraction_non_alphanumeric': 0.13277693474962063, 'fraction_numerical': 0.009863429438543247, 'mean_word_length': 2.354961832061069, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4705285', 'n_tokens_mistral': 906, 'n_tokens_neox': 869, 'n_words': 122}