forked from freeCodeCamp/devdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git.rb
28 lines (24 loc) · 746 Bytes
/
git.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Docs
class Git < UrlScraper
self.type = 'git'
self.release = '2.38.0'
self.base_url = 'https://git-scm.com/docs'
self.initial_paths = %w(/git.html)
self.links = {
home: 'https://git-scm.com/',
code: 'https://github.com/git/git'
}
html_filters.push 'git/entries', 'git/clean_html'
options[:container] = '#content'
options[:only_patterns] = [/\A\/[^\/]+\z/]
options[:skip] = %w(/howto-index.html)
options[:attribution] = <<-HTML
© 2012–2022 Scott Chacon and others<br>
Licensed under the MIT License.
HTML
def get_latest_version(opts)
doc = fetch_doc('https://git-scm.com/', opts)
doc.at_css('.version').content.strip
end
end
end