phpunit.rb 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. options[:skip] = [
  11. 'bibliography.html',
  12. 'copyright.html'
  13. ]
  14. options[:root_title] = 'PHPUnit'
  15. options[:title] = false
  16. options[:attribution] = <<-HTML
  17. &copy; 2005&ndash;2025 Sebastian Bergmann<br>
  18. Licensed under the Creative Commons Attribution 3.0 Unported License.
  19. HTML
  20. FILTERS = %w(phpunit/clean_html phpunit/entries title)
  21. version do
  22. self.release = '12.0'
  23. self.base_url = "https://docs.phpunit.de/en/#{release}/"
  24. html_filters.push FILTERS
  25. options[:container] = '.document'
  26. end
  27. version '9' do
  28. self.release = '9.5'
  29. self.base_url = "https://phpunit.readthedocs.io/en/#{release}/"
  30. html_filters.push FILTERS
  31. options[:container] = '.document'
  32. end
  33. version '8' do
  34. self.release = '8.5'
  35. self.base_url = "https://phpunit.readthedocs.io/en/#{release}/"
  36. html_filters.push FILTERS
  37. options[:container] = '.document'
  38. end
  39. OLDFILTERS = %w(phpunit/clean_html_old phpunit/entries_old title)
  40. OLDSKIP = %w(
  41. appendixes.index.html
  42. appendixes.bibliography.html
  43. appendixes.copyright.html)
  44. version '6' do
  45. self.release = '6.5'
  46. self.base_url = "https://phpunit.de/manual/#{release}/en/"
  47. html_filters.push OLDFILTERS
  48. options[:skip] = OLDSKIP
  49. end
  50. version '5' do
  51. self.release = '5.7'
  52. self.base_url = "https://phpunit.de/manual/#{release}/en/"
  53. html_filters.push OLDFILTERS
  54. options[:skip] = OLDSKIP
  55. end
  56. version '4' do
  57. self.release = '4.8'
  58. self.base_url = "https://phpunit.de/manual/#{release}/en/"
  59. options[:skip] = OLDSKIP
  60. html_filters.push OLDFILTERS
  61. end
  62. def get_latest_version(opts)
  63. doc = fetch_doc('https://phpunit.readthedocs.io/', opts)
  64. label = doc.at_css('meta[name="readthedocs-version-slug"]')["content"]
  65. label
  66. end
  67. end
  68. end