<commit_before># knife-block - a plugin to enable the use of multiple knife configuration files
# to allow interaction with multiple knife servers in an easy and consistent manner
#
# Based on a bash script by <NAME> (<EMAIL>)
#
# Copyright (c) <NAME> / Green and Secure IT Limited 2012
#

# Monkey patch ::Chef::Knife to give us back the config file, cause there's
# no public method to actually use the lookup logic
class Chef
  class Knife
    def get_config_file
      # locate_config_file is only compatible with Chef 11
      if GreenAndSecure.current_chef_version >= ::Gem::Version.new('11.8.0')
        config[:config_file] ||= ::Chef::Knife.locate_config_file
      elsif GreenAndSecure.current_chef_version >= ::Gem::Version.new('11.0.0')
        locate_config_file
      else
        GreenAndSecure.locate_config_file config
      end

      # if we haven't created our knife.rb yet, set defaults to ~/.chef so we can create the config.
      config[:config_file] ? File.dirname(config[:config_file]) : File.join(ENV['HOME'], '.chef')
    end
  end
end

module GreenAndSecure
  @@current_chef_version = ::Gem::Version.new(::Chef::VERSION)
  @@knife = ::Chef::Knife.new

  def current_chef_version
    @@current_chef_version
  end
<commit_msg>Fixes knife-block for chef 12, using chef_config_dir instead of locate_config_file<commit_after># knife-block - a plugin to enable the use of multiple knife configuration files
# to allow interaction with multiple knife servers in an easy and consistent manner
#
# Based on a bash script by <NAME> (<EMAIL>)
#
# Copyright (c) <NAME> / Green and Secure IT Limited 2012
#

# Monkey patch ::Chef::Knife to give us back the config file, cause there's
# no public method to actually use the lookup logic
class Chef
  class Knife
    def get_config_file
      # locate_config_file is only compatible with Chef 11
      if GreenAndSecure.current_chef_version >= ::Gem::Version.new('12.0.0')
        config[:config_file] ||= ::Chef::Knife.chef_config_dir
      elsif GreenAndSecure.current_chef_version >= ::Gem::Version.new('11.8.0')
        config[:config_file] ||= ::Chef::Knife.locate_config_file
      elsif GreenAndSecure.current_chef_version >= ::Gem::Version.new('11.0.0')
        locate_config_file
      else
        GreenAndSecure.locate_config_file config
      end

      # if we haven't created our knife.rb yet, set defaults to ~/.chef so we can create the config.
      config[:config_file] ? File.dirname(config[:config_file]) : File.join(ENV['HOME'], '.chef')
    end
  end
end

module GreenAndSecure
  @@current_chef_version = ::Gem::Version.new(::Chef::VERSION)
  @@knife = ::Chef::Knife.new

  def current_chef_version
    @@current_chef_version
  end

{'fraction_non_alphanumeric': 0.10264900662251655, 'fraction_numerical': 0.012509197939661517, 'mean_word_length': 3.8990990990990992, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 14, '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': '5158117', 'n_tokens_mistral': 893, 'n_tokens_neox': 844, 'n_words': 262}