devdocs/lib/docs/scrapers/git.rb

30 lines
813 B
Ruby
Raw Normal View History

2013-12-13 19:00:07 +01:00
module Docs
class Git < UrlScraper
self.type = 'git'
2024-08-18 11:35:04 +02:00
self.release = '2.46.0'
2016-03-06 23:44:46 +01:00
self.base_url = 'https://git-scm.com/docs'
2013-12-13 19:00:07 +01:00
self.initial_paths = %w(/git.html)
2015-05-18 15:39:11 +02:00
self.links = {
2016-03-06 23:44:46 +01:00
home: 'https://git-scm.com/',
2015-05-18 15:39:11 +02:00
code: 'https://github.com/git/git'
}
2013-12-13 19:00:07 +01:00
html_filters.push 'git/entries', 'git/clean_html'
2013-12-13 19:00:07 +01:00
options[:container] = '#content'
options[:only_patterns] = [/\A\/[^\/]+\z/]
options[:skip] = %w(/howto-index.html)
2013-12-13 19:00:07 +01:00
2024-08-18 11:58:26 +02:00
# https://github.com/git/git-scm.com/blob/main/MIT-LICENSE.txt
2013-12-13 19:00:07 +01:00
options[:attribution] = <<-HTML
2024-08-18 11:58:26 +02:00
&copy; 2012&ndash;2024 Scott Chacon and others<br>
Licensed under the MIT License.
2013-12-13 19:00:07 +01:00
HTML
2019-03-10 03:02:24 +01:00
def get_latest_version(opts)
doc = fetch_doc('https://git-scm.com/', opts)
doc.at_css('.version').content.strip
end
2013-12-13 19:00:07 +01:00
end
end