<commit_before>require "json"
require "boxen/config"

config   = Boxen::Config.load
facts    = {}
factsdir = File.join config.homedir, "config", "facts"

facts["github_login"]  = config.login
facts["github_email"]  = config.email
facts["github_name"]   = config.name
facts["github_token"]  = config.token

facts["boxen_home"]    = config.homedir
facts["boxen_srcdir"]  = config.srcdir
facts["boxen_repodir"] = config.repodir
facts["luser"]         = config.user

Dir["#{config.homedir}/config/facts/*.json"].each do |file|
  facts.merge! JSON.parse File.read file
end

facts.each { |k, v| Facter.add(k) { setcode { v } } }<commit_msg>Expose a boxen_user fact and deprecate luser<commit_after>require "json"
require "boxen/config"

config   = Boxen::Config.load
facts    = {}
factsdir = "#{config.homedir}/config/facts"

facts["github_login"]  = config.login
facts["github_email"]  = config.email
facts["github_name"]   = config.name
facts["github_token"]  = config.token

facts["boxen_home"]    = config.homedir
facts["boxen_srcdir"]  = config.srcdir
facts["boxen_repodir"] = config.repodir
facts["boxen_user"]    = config.user
facts["luser"]         = config.user # this is goin' away

Dir["#{config.homedir}/config/facts/*.json"].each do |file|
  facts.merge! JSON.parse File.read file
end

facts.each { |k, v| Facter.add(k) { setcode { v } } }
{'fraction_non_alphanumeric': 0.16196136701337296, 'fraction_numerical': 0.0, 'mean_word_length': 4.635983263598327, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3784045', 'n_tokens_mistral': 510, 'n_tokens_neox': 487, 'n_words': 93}