git.rb 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. module Docs
  2. class Git < UrlScraper
  3. self.type = 'git'
  4. self.release = '2.50.0'
  5. self.base_url = 'https://git-scm.com/docs'
  6. self.initial_paths = %w(
  7. /git.html
  8. /git-archimport.html
  9. /git-cherry.html
  10. /git-citool.html
  11. /git-column.html
  12. /git-cvsexportcommit.html
  13. /git-for-each-repo.html
  14. /git-get-tar-commit-id.html
  15. /git-http-fetch.html
  16. /git-http-push.html
  17. /git-merge-file.html
  18. /git-merge-index.html
  19. /git-merge-one-file.html
  20. /git-merge-tree.html
  21. /git-mktree.html
  22. /git-p4.html
  23. /git-pack-redundant.html
  24. /git-quiltimport.html
  25. /git-replay.html
  26. /git-sh-i18n.html
  27. /git-sh-i18n--envsubst.html
  28. /git-sh-setup.html
  29. /git-show-index.html
  30. /git-unpack-file.html
  31. /git-verify-commit.html
  32. /gitformat-index.html
  33. /scalar.html
  34. )
  35. self.links = {
  36. home: 'https://git-scm.com/',
  37. code: 'https://github.com/git/git'
  38. }
  39. html_filters.push 'git/entries', 'git/clean_html'
  40. options[:container] = '#content'
  41. options[:only_patterns] = [/\A\/[^\/]+\z/]
  42. options[:skip] = %w(/howto-index.html)
  43. # https://github.com/git/git?tab=License-1-ov-file#readme
  44. # NOT https://github.com/git/git-scm.com/blob/gh-pages/MIT-LICENSE.txt
  45. options[:attribution] = <<-HTML
  46. &copy; 2005&ndash;2025 Linus Torvalds and others<br>
  47. Licensed under the GNU General Public License version 2.
  48. HTML
  49. def get_latest_version(opts)
  50. doc = fetch_doc('https://git-scm.com/', opts)
  51. doc.at_css('.version').content.strip
  52. end
  53. end
  54. end