devdocs/lib/docs/scrapers/node.rb

56 lines
1.6 KiB
Ruby
Raw Normal View History

2013-10-24 20:25:52 +02:00
module Docs
class Node < UrlScraper
self.name = 'Node.js'
self.slug = 'node'
self.type = 'node'
2015-03-29 16:53:01 +02:00
self.links = {
home: 'https://nodejs.org/',
2015-11-01 16:56:45 +01:00
code: 'https://github.com/nodejs/node'
2015-03-29 16:53:01 +02:00
}
2013-10-24 20:25:52 +02:00
html_filters.push 'node/clean_html', 'node/entries', 'title'
2013-10-24 20:25:52 +02:00
options[:title] = false
options[:root_title] = 'Node.js'
options[:container] = '#apicontent'
options[:skip] = %w(index.html all.html documentation.html synopsis.html)
options[:attribution] = <<-HTML
2013-10-24 20:25:52 +02:00
&copy; Joyent, Inc. and other Node contributors<br>
2015-11-01 16:56:45 +01:00
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.
2013-10-24 20:25:52 +02:00
HTML
version do
2019-08-07 10:51:27 +02:00
self.release = '12.8.0'
self.base_url = 'https://nodejs.org/dist/latest-v12.x/docs/api/'
2018-11-04 23:15:16 +01:00
end
version '10 LTS' do
self.release = '10.13.0'
2018-04-28 16:22:26 +02:00
self.base_url = 'https://nodejs.org/dist/latest-v10.x/docs/api/'
2017-11-10 17:50:07 +01:00
end
version '8 LTS' do
2018-11-04 23:15:16 +01:00
self.release = '8.12.0'
2017-06-04 17:50:40 +02:00
self.base_url = 'https://nodejs.org/dist/latest-v8.x/docs/api/'
end
version '6 LTS' do
2018-08-19 23:45:36 +02:00
self.release = '6.14.4'
self.base_url = 'https://nodejs.org/dist/latest-v6.x/docs/api/'
end
version '4 LTS' do
2018-06-11 03:14:02 +02:00
self.release = '4.9.1'
self.base_url = 'https://nodejs.org/dist/latest-v4.x/docs/api/'
end
2019-03-10 03:02:24 +01:00
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
2013-10-24 20:25:52 +02:00
end
end