git.rb 906 B

123456789101112131415161718192021222324252627282930
  1. module Docs
  2. class Git < UrlScraper
  3. self.type = 'git'
  4. self.release = '2.48.1'
  5. self.base_url = 'https://git-scm.com/docs'
  6. self.initial_paths = %w(/git.html)
  7. self.links = {
  8. home: 'https://git-scm.com/',
  9. code: 'https://github.com/git/git'
  10. }
  11. html_filters.push 'git/entries', 'git/clean_html'
  12. options[:container] = '#content'
  13. options[:only_patterns] = [/\A\/[^\/]+\z/]
  14. options[:skip] = %w(/howto-index.html)
  15. # https://github.com/git/git?tab=License-1-ov-file#readme
  16. # NOT https://github.com/git/git-scm.com/blob/main/MIT-LICENSE.txt
  17. options[:attribution] = <<-HTML
  18. &copy; 2005&ndash;2024 Linus Torvalds and others<br>
  19. Licensed under the GNU General Public License version 2.
  20. HTML
  21. def get_latest_version(opts)
  22. doc = fetch_doc('https://git-scm.com/', opts)
  23. doc.at_css('.version').content.strip
  24. end
  25. end
  26. end