varnish.rb 1007 B

1234567891011121314151617181920212223242526272829303132333435
  1. module Docs
  2. class Varnish < UrlScraper
  3. self.name = 'Varnish'
  4. self.type = 'sphinx'
  5. self.root_path = 'index.html'
  6. self.links = {
  7. home: 'https://varnish-cache.org/',
  8. code: 'https://github.com/varnishcache/varnish-cache'
  9. }
  10. html_filters.push 'varnish/entries', 'sphinx/clean_html'
  11. options[:container] = '.body > section'
  12. options[:skip] = %w(genindex.html search.html)
  13. options[:skip_patterns] = [/phk/, /glossary/, /whats-new/]
  14. options[:attribution] = <<-HTML
  15. Copyright &copy; 2006 Verdens Gang AS<br>
  16. Copyright &copy; 2006&ndash;2020 Varnish Software AS<br>
  17. Licensed under the BSD-2-Clause License.
  18. HTML
  19. version do
  20. self.release = '7.4'
  21. self.base_url = "https://varnish-cache.org/docs/#{release}/"
  22. end
  23. def get_latest_version(opts)
  24. contents = get_github_file_contents('varnishcache', 'varnish-cache', 'doc/changes.rst', opts)
  25. contents.scan(/Varnish\s+Cache\s+([0-9.]+)/)[0][0]
  26. end
  27. end
  28. end