phpunit.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. module Docs
  2. class Phpunit < UrlScraper
  3. self.name = 'PHPUnit'
  4. self.type = 'phpunit'
  5. self.root_path = 'index.html'
  6. self.links = {
  7. home: 'https://phpunit.de/',
  8. code: 'https://github.com/sebastianbergmann/phpunit'
  9. }
  10. html_filters.push 'phpunit/clean_html', 'phpunit/entries', 'title'
  11. options[:root_title] = 'PHPUnit'
  12. options[:title] = false
  13. options[:skip] = %w(
  14. appendixes.index.html
  15. appendixes.bibliography.html
  16. appendixes.copyright.html)
  17. options[:attribution] = <<-HTML
  18. &copy; 2005&ndash;2017 Sebastian Bergmann<br>
  19. Licensed under the Creative Commons Attribution 3.0 Unported License.
  20. HTML
  21. version '6' do
  22. self.release = '6.5'
  23. self.base_url = "https://phpunit.de/manual/#{release}/en/"
  24. end
  25. version '5' do
  26. self.release = '5.7'
  27. self.base_url = "https://phpunit.de/manual/#{release}/en/"
  28. end
  29. version '4' do
  30. self.release = '4.8'
  31. self.base_url = "https://phpunit.de/manual/#{release}/en/"
  32. end
  33. def get_latest_version(options, &block)
  34. fetch_doc('https://phpunit.readthedocs.io/', options) do |doc|
  35. label = doc.at_css('.rst-current-version').content.strip
  36. block.call label.scan(/v: ([0-9.]+)/)[0][0]
  37. end
  38. end
  39. end
  40. end