nginx.rb 913 B

123456789101112131415161718192021222324252627282930313233343536
  1. module Docs
  2. class Nginx < UrlScraper
  3. self.name = 'nginx'
  4. self.type = 'nginx'
  5. self.release = '1.25.1'
  6. self.base_url = 'https://nginx.org/en/docs/'
  7. self.links = {
  8. home: 'https://nginx.org/',
  9. code: 'https://hg.nginx.org/nginx'
  10. }
  11. html_filters.push 'nginx/clean_html', 'nginx/entries'
  12. options[:container] = '#content'
  13. options[:skip] = %w(
  14. contributing_changes.html
  15. dirindex.html
  16. varindex.html)
  17. options[:skip_patterns] = [/\/faq\//]
  18. # http://nginx.org/LICENSE
  19. options[:attribution] = <<-HTML
  20. &copy; 2002-2021 Igor Sysoev<br>
  21. &copy; 2011-2023 Nginx, Inc.<br>
  22. Licensed under the BSD License.
  23. HTML
  24. def get_latest_version(opts)
  25. doc = fetch_doc('https://nginx.org/en/download.html', opts)
  26. table = doc.at_css('#content > table').inner_html
  27. table.scan(/nginx-([0-9.]+)</)[0][0]
  28. end
  29. end
  30. end