<commit_before>if defined?(ChefSpec)
  unit_types = %w(
    automount
    timer
    target
    swap
    socket
    device
    mount
    path
    service
    slice
  )
  actions = %w(create delete enable disable start stop)
  unit_types.each do |type|
    ChefSpec.define_matcher("systemd_#{type}".to_sym)
    actions.each do |action|
      define_method("#{action}_systemd_#{type}".to_sym) do |resource_name|
        ChefSpec::Matchers::ResourceMatcher.new(
          "systemd_#{type}".to_sym,
          action.to_sym,
          resource_name
        )
      end
    end
  end
end
<commit_msg>add matchers for new resources<commit_after>if defined?(ChefSpec)
  unit_types = %w(
    automount
    timer
    target
    swap
    socket
    device
    mount
    path
    service
    slice
  )

  daemons = %w(
    journald
    logind
    resolved
    timesyncd
  )

  actions = %i(create delete )
  unit_actions = %i( enable disable start stop restart )

  (unit_types | daemons).each do |type|
    ChefSpec.define_matcher("systemd_#{type}".to_sym)
    actions.each do |action|
      define_method("#{action}_systemd_#{type}".to_sym) do |resource_name|
        ChefSpec::Matchers::ResourceMatcher.new(
          "systemd_#{type}".to_sym,
          action, resource_name
        )
      end
    end
  end

  unit_types.each do |type|
    unit_actions.each do |action|
      define_method("#{action}_systemd_#{type}".to_sym) do |resource_name|
        ChefSpec::Matchers::ResourceMatcher.new(
          "systemd_#{type}".to_sym,
          action, resource_name
        )
      end
    end
  end

  ChefSpec.define_matcher(:systemd_networkd_link)
  actions.each do |action|
    define_method("#{action}_systemd_networkd_link") do |resource_name|
      ChefSpec::Matchers::ResourceMatcher.new(
        :systemd_networkd_link,
        action, resource_name
      )
    end
  end
end

{'fraction_non_alphanumeric': 0.09925293489861259, 'fraction_numerical': 0.0, 'mean_word_length': 2.605769230769231, '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': '5286010', 'n_tokens_mistral': 628, 'n_tokens_neox': 632, 'n_words': 121}