-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathnode.rb
More file actions
81 lines (68 loc) · 2.42 KB
/
node.rb
File metadata and controls
81 lines (68 loc) · 2.42 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
module Docs
class Node < UrlScraper
self.name = 'Node.js'
self.slug = 'node'
self.type = 'node'
self.links = {
home: 'https://nodejs.org/',
code: 'https://github.com/nodejs/node'
}
html_filters.push 'node/clean_html', 'node/entries', 'title'
options[:title] = false
options[:root_title] = 'Node.js'
options[:container] = '#apicontent'
options[:skip] = %w(index.html all.html documentation.html synopsis.html)
# options[:only] = ['addons.html']
options[:attribution] = <<-HTML
© Joyent, Inc. and other Node contributors<br>
Licensed under the MIT License.<br>
Node.js is a trademark of Joyent, Inc. and is used with its permission.<br>
We are not endorsed by or affiliated with Joyent.
HTML
version do
self.release = '20.2.0'
self.base_url = 'https://nodejs.org/api/'
end
version '18 LTS' do
self.release = '18.12.1'
self.base_url = 'https://nodejs.org/dist/latest-v18.x/docs/api/'
end
version '16 LTS' do
self.release = '16.13.2'
self.base_url = 'https://nodejs.org/dist/latest-v16.x/docs/api/'
end
version '14 LTS' do
self.release = '14.17.0'
self.base_url = 'https://nodejs.org/dist/latest-v14.x/docs/api/'
end
version '12 LTS' do
self.release = '12.22.1'
self.base_url = 'https://nodejs.org/dist/latest-v12.x/docs/api/'
html_filters.replace('node/entries', 'node/old_entries')
end
version '10 LTS' do
self.release = '10.24.1'
self.base_url = 'https://nodejs.org/dist/latest-v10.x/docs/api/'
html_filters.replace('node/entries', 'node/old_entries')
end
version '8 LTS' do
self.release = '8.17.0'
self.base_url = 'https://nodejs.org/dist/latest-v8.x/docs/api/'
html_filters.replace('node/entries', 'node/old_entries')
end
version '6 LTS' do
self.release = '6.17.1'
self.base_url = 'https://nodejs.org/dist/latest-v6.x/docs/api/'
html_filters.replace('node/entries', 'node/old_entries')
end
version '4 LTS' do
self.release = '4.9.1'
self.base_url = 'https://nodejs.org/dist/latest-v4.x/docs/api/'
html_filters.replace('node/entries', 'node/old_entries')
end
def get_latest_version(opts)
doc = fetch_doc('https://nodejs.org/en/', opts)
doc.at_css('#home-intro > .home-downloadblock:last-of-type > a')['data-version'][1..-1]
end
end
end