<commit_before>require 'formula'

class Lldpd < Formula
  desc "Implementation library for LLDP"
  homepage 'https://vincentbernat.github.io/lldpd/'
  url 'http://media.luffy.cx/files/lldpd/lldpd-0.7.12.tar.gz'
  sha1 '2d602aaaad01d1f76f8e1c87e48dca1c6725ba78'

  bottle do
    sha1 "c77debb346c325a44b8e91a7b983b251dc1db76f" => :yosemite
    sha1 "52737f6933bc2d052ece4877d36c021fd6e648c1" => :mavericks
    sha1 "6d6d4f6d4b7e23b9f707db180c99c24174ff9293" => :mountain_lion
  end

  option 'with-snmp', "Build SNMP subagent support"
  option 'with-json', "Build JSON support for lldpcli"

  depends_on 'pkg-config' => :build
  depends_on 'readline'
  depends_on 'libevent'
  depends_on 'net-snmp' if build.with? "snmp"
  depends_on 'jansson'  if build.with? "json"

  def install
    readline = Formula["readline"]
    args = ["--prefix=#{prefix}",
            "--with-xml",
            "--with-readline",
            "--with-privsep-chroot=/var/empty",
            "--with-privsep-user=nobody",
            "--with-privsep-group=nogroup",
            "--with-launchddaemonsdir=no",
            "CPPFLAGS=-I#{readline.include} -DRONLY=1",
            "LDFLAGS=-L#{readline.lib}"]
    args << "--with-snmp" if build.with? "snmp"
    args << "--with-json" if build.with? "json"

    system "./configure", *args
    system "make"
    system "make install"
  end

  plist_options :startup => true

  def plist
    additional_args = ""
    if build.with? "snmp"
      additional_args += "<string>-x</string>"
    end
    return <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>#{plist_name}</string>
      <key>ProgramArguments</key>
      <array>
        <string>#{opt_sbin}/lldpd</string>
        #{additional_args}
      </array>
      <key>RunAtLoad</key><true/>
      <key>KeepAlive</key><true/>
    </dict>
    </plist>
    EOS
  end

end
<commit_msg>lldpd 0.7.15<commit_after>class Lldpd < Formula
  desc "Implementation library for LLDP"
  homepage "https://vincentbernat.github.io/lldpd/"
  url "http://media.luffy.cx/files/lldpd/lldpd-0.7.15.tar.gz"
  sha256 "c891d6d4480a6a890561ac43d8cc923bd027deb82a3999d65f37d96ca368c246"

  bottle do
    sha1 "c77debb346c325a44b8e91a7b983b251dc1db76f" => :yosemite
    sha1 "52737f6933bc2d052ece4877d36c021fd6e648c1" => :mavericks
    sha1 "6d6d4f6d4b7e23b9f707db180c99c24174ff9293" => :mountain_lion
  end

  option "with-snmp", "Build SNMP subagent support"
  option "with-json", "Build JSON support for lldpcli"

  depends_on "pkg-config" => :build
  depends_on "readline"
  depends_on "libevent"
  depends_on "net-snmp" if build.with? "snmp"
  depends_on "jansson"  if build.with? "json"

  def install
    readline = Formula["readline"]
    args = ["--prefix=#{prefix}",
            "--with-xml",
            "--with-readline",
            "--with-privsep-chroot=/var/empty",
            "--with-privsep-user=nobody",
            "--with-privsep-group=nogroup",
            "--with-launchddaemonsdir=no",
            "CPPFLAGS=-I#{readline.include} -DRONLY=1",
            "LDFLAGS=-L#{readline.lib}"]
    args << "--with-snmp" if build.with? "snmp"
    args << "--with-json" if build.with? "json"

    system "./configure", *args
    system "make"
    system "make install"
  end

  plist_options :startup => true

  def plist
    additional_args = ""
    if build.with? "snmp"
      additional_args += "<string>-x</string>"
    end
    <<-EOS.undent
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
      <key>Label</key>
      <string>#{plist_name}</string>
      <key>ProgramArguments</key>
      <array>
        <string>#{opt_sbin}/lldpd</string>
        #{additional_args}
      </array>
      <key>RunAtLoad</key><true/>
      <key>KeepAlive</key><true/>
    </dict>
    </plist>
    EOS
  end
end

{'fraction_non_alphanumeric': 0.15825575698187164, 'fraction_numerical': 0.06320431161195493, 'mean_word_length': 2.805219012115564, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 2, '>': 61, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '3987679', 'n_tokens_mistral': 1714, 'n_tokens_neox': 1572, 'n_words': 264}