<commit_before>require 'yaml'

module Opsicle
  module CredentialConverterHelper
    def convert_fog_to_aws
      directory_path = File.expand_path("~/.aws/")
      cred_path = File.expand_path("~/.aws/credentials")

      # open/make new credentials file, read, and gather the groups of aws credentials already in file
      Dir.mkdir(directory_path) unless File.directory?(directory_path)
      cred_file = File.open(cred_path, "a+")
      cred_text = cred_file.read
      cred_groups = cred_text.scan(/\[([\S]*)\]/).flatten

      # open existing fog file, and load as yaml hash
      fog_path = File.expand_path("~/.fog")
      fog_hash = YAML::load_file(fog_path)

      # for each environment in the fog file, go through and if it isn't in credentials file, then put it and data in
      fog_hash.each do | environment, credentials |<commit_msg>Cleaning up directory and file paths<commit_after>require 'yaml'

module Opsicle
  module CredentialConverterHelper
    def convert_fog_to_aws
      directory_path = File.expand_path("~/.aws/")
      file_path = directory_path + "/credentials"

      # open/make new credentials file, read, and gather the groups of aws credentials already in file
      Dir.mkdir(directory_path) unless File.directory?(directory_path)
      cred_file = File.open(file_path, "a+")
      cred_text = cred_file.read
      cred_groups = cred_text.scan(/\[([\S]*)\]/).flatten

      # open existing fog file, and load as yaml hash
      fog_path = File.expand_path("~/.fog")
      fog_hash = YAML::load_file(fog_path)

      # for each environment in the fog file, go through and if it isn't in credentials file, then put it and data in
      fog_hash.each do | environment, credentials |
{'fraction_non_alphanumeric': 0.09837019790454016, 'fraction_numerical': 0.0, 'mean_word_length': 3.3964194373401533, 'pattern_counts': {'":': 0, '<': 3, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1447963', 'n_tokens_mistral': 528, 'n_tokens_neox': 519, 'n_words': 158}