<commit_before>require 'pathname'
Puppet::Type.newtype(:x509_cert) do
  desc 'An x509 certificate'

  ensurable

  newparam(:path, :namevar => true) do
    validate do |value|
      path = Pathname.new(value)
      unless path.absolute?
        raise ArgumentError, "Path must be absolute: #{path}"
      end
    end
  end

  newparam(:days) do
    newvalues(/\d+/)
    defaultto(3650)
  end

  newparam(:template) do
    defaultto { "#{@resource[:path]}.cnf" }
    validate do |value|
      path = Pathname.new(value)
      unless path.absolute?
        raise ArgumentError, "Path must be absolute: #{path}"
      end
    end
  end
end<commit_msg>Autorequire template file in x509_cert type<commit_after>require 'pathname'
Puppet::Type.newtype(:x509_cert) do
  desc 'An x509 certificate'

  ensurable

  newparam(:path, :namevar => true) do
    validate do |value|
      path = Pathname.new(value)
      unless path.absolute?
        raise ArgumentError, "Path must be absolute: #{path}"
      end
    end
  end

  newparam(:days) do
    newvalues(/\d+/)
    defaultto(3650)
  end

  newparam(:template) do
    defaultto { "#{@resource[:path]}.cnf" }
    validate do |value|
      path = Pathname.new(value)
      unless path.absolute?
        raise ArgumentError, "Path must be absolute: #{path}"
      end
    end
  end

  autorequire(:file) do
    self[:template]
  end
end
{'fraction_non_alphanumeric': 0.11474219317356572, 'fraction_numerical': 0.01670297748729121, 'mean_word_length': 2.838440111420613, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7561239', 'n_tokens_mistral': 470, 'n_tokens_neox': 446, 'n_words': 122}