<commit_before>require 'chef/knife'

class Chef
  class Knife
    class Kitchen < Knife
      include FileUtils

      banner "knife kitchen NAME"

      def run
        name = @name_args.first
        mkdir name
        %w(nodes roles data_bags site-cookbooks cookbooks).each do |dir|
          mkdir name + "/#{dir}"
          touch name + "/#{dir}/.gitkeep"
        end
        File.open(name + "/solo.rb", 'w') do |f|
          f << <<-RUBY.gsub(/^ {12}/, '')
            file_cache_path "/tmp/chef-solo"
            data_bag_path   "/tmp/chef-solo/data_bags"
            cookbook_path   [ "/tmp/chef-solo/site-cookbooks",
                              "/tmp/chef-solo/cookbooks" ]
            role_path       "/tmp/chef-solo/roles"<commit_msg>Adding conditional on dir creation when running knife kitchen<commit_after>require 'chef/knife'

class Chef
  class Knife
    class Kitchen < Knife
      include FileUtils

      banner "knife kitchen NAME or initialize current directory with '.'"

      def run
        name = @name_args.first
        mkdir name if name != '.'
        %w(nodes roles data_bags site-cookbooks cookbooks).each do |dir|
          mkdir name + "/#{dir}"
          touch name + "/#{dir}/.gitkeep"
        end
        File.open(name + "/solo.rb", 'w') do |f|
          f << <<-RUBY.gsub(/^ {12}/, '')
            file_cache_path "/tmp/chef-solo"
            data_bag_path   "/tmp/chef-solo/data_bags"
            cookbook_path   [ "/tmp/chef-solo/site-cookbooks",
                              "/tmp/chef-solo/cookbooks" ]
            role_path       "/tmp/chef-solo/roles"
{'fraction_non_alphanumeric': 0.12625, 'fraction_numerical': 0.0025, 'mean_word_length': 1.7555938037865748, 'pattern_counts': {'":': 0, '<': 13, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3711364', 'n_tokens_mistral': 530, 'n_tokens_neox': 511, 'n_words': 118}