git.rb 813 B

1234567891011121314151617181920212223242526272829
  1. module Docs
  2. class Git < UrlScraper
  3. self.type = 'git'
  4. self.release = '2.46.0'
  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-scm.com/blob/main/MIT-LICENSE.txt
  16. options[:attribution] = <<-HTML
  17. &copy; 2012&ndash;2024 Scott Chacon and others<br>
  18. Licensed under the MIT License.
  19. HTML
  20. def get_latest_version(opts)
  21. doc = fetch_doc('https://git-scm.com/', opts)
  22. doc.at_css('.version').content.strip
  23. end
  24. end
  25. end