History

Implement get_latest_version for the remaining scrapers

Jasper van Merle committed 7 years ago

Commit 6ee16931 parent 0315c8854 files · +335 −2Browse files

Unified · Split

54 files
  1. lib/docs/scrapers/nginx.rb +7 −0
  2. lib/docs/scrapers/nginx_lua_module.rb +10 −0
  3. lib/docs/scrapers/nim.rb +6 −0
  4. lib/docs/scrapers/node.rb +6 −0
  5. lib/docs/scrapers/nokogiri2.rb +6 −0
  6. lib/docs/scrapers/npm.rb +6 −0
  7. lib/docs/scrapers/numpy.rb +6 −0
  8. lib/docs/scrapers/openjdk.rb +21 −0
  9. lib/docs/scrapers/opentsdb.rb +6 −0
  10. lib/docs/scrapers/padrino.rb +6 −0
  11. lib/docs/scrapers/pandas.rb +7 −0
  12. lib/docs/scrapers/perl.rb +6 −0
  13. lib/docs/scrapers/phalcon.rb +6 −0
  14. lib/docs/scrapers/phaser.rb +6 −0
  15. lib/docs/scrapers/phoenix.rb +6 −0
  16. lib/docs/scrapers/php.rb +7 −0
  17. lib/docs/scrapers/phpunit.rb +7 −0
  18. lib/docs/scrapers/postgresql.rb +7 −0
  19. lib/docs/scrapers/pug.rb +4 −0
  20. lib/docs/scrapers/puppeteer.rb +6 −0
  21. lib/docs/scrapers/pygame.rb +6 −0
  22. lib/docs/scrapers/python.rb +6 −0
  23. lib/docs/scrapers/q.rb +4 −0
  24. lib/docs/scrapers/qt.rb +7 −0
  25. lib/docs/scrapers/ramda.rb +6 −0
  26. lib/docs/scrapers/react.rb +6 −0
  27. lib/docs/scrapers/react_native.rb +6 −0
  28. lib/docs/scrapers/redis.rb +7 −0
  29. lib/docs/scrapers/redux.rb +4 −0
  30. lib/docs/scrapers/relay.rb +6 −0
  31. lib/docs/scrapers/requirejs.rb +4 −0
  32. lib/docs/scrapers/rethinkdb.rb +6 −0
  33. lib/docs/scrapers/rust.rb +7 −0
  34. lib/docs/scrapers/sass.rb +6 −0
  35. lib/docs/scrapers/scikit_image.rb +6 −0
  36. lib/docs/scrapers/scikit_learn.rb +6 −0
  37. lib/docs/scrapers/sinon.rb +6 −0
  38. lib/docs/scrapers/socketio.rb +4 −0
  39. lib/docs/scrapers/sqlite.rb +6 −0
  40. lib/docs/scrapers/statsmodels.rb +5 −0
  41. lib/docs/scrapers/symfony.rb +6 −0
  42. lib/docs/scrapers/tcl_tk.rb +7 −0
  43. lib/docs/scrapers/tensorflow.rb +6 −0
  44. lib/docs/scrapers/terraform.rb +6 −0
  45. lib/docs/scrapers/twig.rb +6 −0
  46. lib/docs/scrapers/typescript.rb +6 −0
  47. lib/docs/scrapers/underscore.rb +6 −0
  48. lib/docs/scrapers/vagrant.rb +6 −0
  49. lib/docs/scrapers/vue.rb +6 −0
  50. lib/docs/scrapers/vulkan.rb +6 −0
  51. lib/docs/scrapers/webpack.rb +4 −0
  52. lib/docs/scrapers/yarn.rb +6 −0
  53. lib/docs/scrapers/yii.rb +6 −0
  54. lib/tasks/updates.thor +2 −2
lib/docs/scrapers/nginx.rb+7−0
@@ -25,5 +25,12 @@ module Docs · 24 unmodified lines
2525 &copy; 2011-2018 Nginx, Inc.<br>
2626 Licensed under the BSD License.
2727 HTML
28+
29+ def get_latest_version(options, &block)
30+ fetch_doc('https://nginx.org/en/download.html', options) do |doc|
31+ table = doc.at_css('#content > table').inner_html
32+ block.call table.scan(/nginx-([0-9.]+)</)[0][0]
33+ end
34+ end
2835 end
2936 end
lib/docs/scrapers/nginx_lua_module.rb+10−0
@@ -4,6 +4,9 @@ module Docs · 3 unmodified lines
44 self.slug = 'nginx_lua_module'
55 self.release = '0.10.13'
66 self.base_url = "https://github.com/openresty/lua-nginx-module/tree/v#{self.release}/"
7+ self.links = {
8+ code: 'https://github.com/openresty/lua-nginx-module'
9+ }
710
811 html_filters.push 'nginx_lua_module/clean_html', 'nginx_lua_module/entries', 'title'
912
@@ -15,5 +18,12 @@ module Docs · 5 unmodified lines
1518 &copy; 2009&ndash;2018 Yichun "agentzh" Zhang (章亦春), OpenResty Inc.<br>
1619 Licensed under the BSD License.
1720 HTML
21+
22+ def get_latest_version(options, &block)
23+ get_github_tags('openresty', 'lua-nginx-module', options) do |tags|
24+ tag = tags.find { |tag| !tag['name'].include?('rc') }
25+ block.call tag['name'][1..-1]
26+ end
27+ end
1828 end
1929 end
lib/docs/scrapers/nim.rb+6−0
@@ -17,5 +17,11 @@ module Docs · 16 unmodified lines
1717 &copy; 2006&ndash;2018 Andreas Rumpf<br>
1818 Licensed under the MIT License.
1919 HTML
20+
21+ def get_latest_version(options, &block)
22+ fetch_doc('https://nim-lang.org/docs/overview.html', options) do |doc|
23+ block.call doc.at_css('.container > .docinfo > tbody > tr:last-child > td').content.strip
24+ end
25+ end
2026 end
2127 end
lib/docs/scrapers/node.rb+6−0
@@ -46,5 +46,11 @@ module Docs · 45 unmodified lines
4646 self.release = '4.9.1'
4747 self.base_url = 'https://nodejs.org/dist/latest-v4.x/docs/api/'
4848 end
49+
50+ def get_latest_version(options, &block)
51+ fetch_doc('https://nodejs.org/en/', options) do |doc|
52+ block.call doc.at_css('#home-intro > .home-downloadblock:last-of-type > a')['data-version'][1..-1]
53+ end
54+ end
4955 end
5056 end
lib/docs/scrapers/nokogiri2.rb+6−0
@@ -19,5 +19,11 @@ module Docs · 18 unmodified lines
1919 Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid, Lars Kanis<br>
2020 Licensed under the MIT License.
2121 HTML
22+
23+ def get_latest_version(options, &block)
24+ get_latest_github_release('sparklemotion', 'nokogiri', options) do |release|
25+ block.call release['tag_name'][1..-1]
26+ end
27+ end
2228 end
2329 end
lib/docs/scrapers/npm.rb+6−0
@@ -29,5 +29,11 @@ module Docs · 28 unmodified lines
2929 Licensed under the npm License.<br>
3030 npm is a trademark of npm, Inc.
3131 HTML
32+
33+ def get_latest_version(options, &block)
34+ get_latest_github_release('npm', 'cli', options) do |release|
35+ block.call release['tag_name'][1..-1]
36+ end
37+ end
3238 end
3339 end
lib/docs/scrapers/numpy.rb+6−0
@@ -49,5 +49,11 @@ module Docs · 48 unmodified lines
4949 self.release = '1.10.4'
5050 self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/"
5151 end
52+
53+ def get_latest_version(options, &block)
54+ get_latest_github_release('numpy', 'numpy', options) do |release|
55+ block.call release['tag_name'][1..-1]
56+ end
57+ end
5258 end
5359 end
lib/docs/scrapers/openjdk.rb+21−0
@@ -86,5 +86,26 @@ module Docs · 85 unmodified lines
8686 def read_file(path)
8787 File.read(path).force_encoding('iso-8859-1').encode('utf-8') rescue nil
8888 end
89+
90+ def get_latest_version(options, &block)
91+ latest_version = 8
92+ current_attempt = latest_version
93+ attempts = 0
94+
95+ while attempts < 3
96+ current_attempt += 1
97+
98+ fetch_doc("https://packages.debian.org/sid/openjdk-#{current_attempt}-doc", options) do |doc|
99+ if doc.at_css('.perror').nil?
100+ latest_version = current_attempt
101+ attempts = 0
102+ else
103+ attempts += 1
104+ end
105+ end
106+ end
107+
108+ block.call latest_version.to_s
109+ end
89110 end
90111 end
lib/docs/scrapers/opentsdb.rb+6−0
@@ -18,5 +18,11 @@ module Docs · 17 unmodified lines
1818 &copy; 2010&ndash;2016 The OpenTSDB Authors<br>
1919 Licensed under the GNU LGPLv2.1+ and GPLv3+ licenses.
2020 HTML
21+
22+ def get_latest_version(options, &block)
23+ get_latest_github_release('OpenTSDB', 'opentsdb', options) do |release|
24+ block.call release['tag_name'][1..-1]
25+ end
26+ end
2127 end
2228 end
lib/docs/scrapers/padrino.rb+6−0
@@ -23,5 +23,11 @@ module Docs · 22 unmodified lines
2323 stub 'index2' do
2424 request_one(url_for('index')).body
2525 end
26+
27+ def get_latest_version(options, &block)
28+ get_github_tags('padrino', 'padrino-framework', options) do |tags|
29+ block.call tags[0]['name']
30+ end
31+ end
2632 end
2733 end
lib/docs/scrapers/pandas.rb+7−0
@@ -49,5 +49,12 @@ module Docs · 48 unmodified lines
4949 self.release = '0.18.1'
5050 self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"
5151 end
52+
53+ def get_latest_version(options, &block)
54+ fetch_doc('http://pandas.pydata.org/pandas-docs/stable/', options) do |doc|
55+ label = doc.at_css('.body > .section > p').content
56+ block.call label.scan(/Version: ([0-9.]+)/)[0][0]
57+ end
58+ end
5259 end
5360 end
lib/docs/scrapers/perl.rb+6−0
@@ -43,5 +43,11 @@ module Docs · 42 unmodified lines
4343 self.release = '5.20.2'
4444 self.base_url = "https://perldoc.perl.org/#{self.release}/"
4545 end
46+
47+ def get_latest_version(options, &block)
48+ fetch('https://perldoc.perl.org/static/perlversion.js', options) do |body|
49+ block.call body.scan(/>Perl ([0-9.]+)/)[0][0]
50+ end
51+ end
4652 end
4753 end
lib/docs/scrapers/phalcon.rb+6−0
@@ -29,5 +29,11 @@ module Docs · 28 unmodified lines
2929 self.release = '2.0.13'
3030 self.base_url = 'https://docs.phalconphp.com/en/2.0.0/'
3131 end
32+
33+ def get_latest_version(options, &block)
34+ fetch_doc('https://docs.phalconphp.com/', options) do |doc|
35+ block.call doc.at_css('.custom-select__version').content.strip.sub(/Version /, '')
36+ end
37+ end
3238 end
3339 end
lib/docs/scrapers/phaser.rb+6−0
@@ -25,5 +25,11 @@ module Docs · 24 unmodified lines
2525 &copy; 2016 Richard Davey, Photon Storm Ltd.<br>
2626 Licensed under the MIT License.
2727 HTML
28+
29+ def get_latest_version(options, &block)
30+ get_latest_github_release('photonstorm', 'phaser', options) do |release|
31+ block.call release['tag_name'][1..-1]
32+ end
33+ end
2834 end
2935 end
lib/docs/scrapers/phoenix.rb+6−0
@@ -46,5 +46,11 @@ module Docs · 45 unmodified lines
4646 HTML
4747 end
4848 }
49+
50+ def get_latest_version(options, &block)
51+ fetch_doc('https://hexdocs.pm/phoenix/Phoenix.html', options) do |doc|
52+ block.call doc.at_css('.sidebar-projectVersion').content.strip[1..-1]
53+ end
54+ end
4955 end
5056 end
lib/docs/scrapers/php.rb+7−0
@@ -66,5 +66,12 @@ module Docs · 65 unmodified lines
6666 &copy; 1997&ndash;2018 The PHP Documentation Group<br>
6767 Licensed under the Creative Commons Attribution License v3.0 or later.
6868 HTML
69+
70+ def get_latest_version(options, &block)
71+ fetch_doc('https://secure.php.net/manual/en/doc.changelog.php', options) do |doc|
72+ label = doc.at_css('tbody.gen-changelog > tr > td').content
73+ block.call label.split(',').last.strip
74+ end
75+ end
6976 end
7077 end
lib/docs/scrapers/phpunit.rb+7−0
@@ -37,5 +37,12 @@ module Docs · 36 unmodified lines
3737 self.release = '4.8'
3838 self.base_url = "https://phpunit.de/manual/#{release}/en/"
3939 end
40+
41+ def get_latest_version(options, &block)
42+ fetch_doc('https://phpunit.readthedocs.io/', options) do |doc|
43+ label = doc.at_css('.rst-current-version').content.strip
44+ block.call label.scan(/v: ([0-9.]+)/)[0][0]
45+ end
46+ end
4047 end
4148 end
lib/docs/scrapers/postgresql.rb+7−0
@@ -80,5 +80,12 @@ module Docs · 79 unmodified lines
8080
8181 html_filters.insert_before 'postgresql/extract_metadata', 'postgresql/normalize_class_names'
8282 end
83+
84+ def get_latest_version(options, &block)
85+ fetch_doc('https://www.postgresql.org/docs/current/index.html', options) do |doc|
86+ label = doc.at_css('#pgContentWrap h1.title').content
87+ block.call label.scan(/([0-9.]+)/)[0][0]
88+ end
89+ end
8390 end
8491 end
lib/docs/scrapers/pug.rb+4−0
@@ -18,6 +18,10 @@ module Docs · 17 unmodified lines
1818 Licensed under the MIT license.
1919 HTML
2020
21+ def get_latest_version(options, &block)
22+ get_npm_version('pug', options, &block)
23+ end
24+
2125 private
2226
2327 def parse(response) # Hook here because Nokogori removes whitespace from textareas
lib/docs/scrapers/puppeteer.rb+6−0
@@ -14,5 +14,11 @@ module Docs · 13 unmodified lines
1414 &copy; 2017 Google Inc<br>
1515 Licensed under the Apache License 2.0.
1616 HTML
17+
18+ def get_latest_version(options, &block)
19+ get_github_file_contents('GoogleChrome', 'puppeteer', 'README.md', options) do |contents|
20+ block.call contents.scan(/\/v([0-9.]+)\/docs\/api\.md/)[0][0]
21+ end
22+ end
1723 end
1824 end
lib/docs/scrapers/pygame.rb+6−0
@@ -17,5 +17,11 @@ module Docs · 16 unmodified lines
1717 &copy; Pygame Developpers.<br>
1818 Licensed under the GNU LGPL License version 2.1.
1919 HTML
20+
21+ def get_latest_version(options, &block)
22+ get_latest_github_release('pygame', 'pygame', options) do |release|
23+ block.call release['tag_name']
24+ end
25+ end
2026 end
2127 end
lib/docs/scrapers/python.rb+6−0
@@ -50,5 +50,11 @@ module Docs · 49 unmodified lines
5050
5151 html_filters.push 'python/entries_v2', 'sphinx/clean_html', 'python/clean_html'
5252 end
53+
54+ def get_latest_version(options, &block)
55+ fetch_doc('https://docs.python.org/', options) do |doc|
56+ block.call doc.at_css('.version_switcher_placeholder').content
57+ end
58+ end
5359 end
5460 end
lib/docs/scrapers/q.rb+4−0
@@ -19,5 +19,9 @@ module Docs · 18 unmodified lines
1919 &copy; 2009&ndash;2017 Kristopher Michael Kowal<br>
2020 Licensed under the MIT License.
2121 HTML
22+
23+ def get_latest_version(options, &block)
24+ get_npm_version('q', options, &block)
25+ end
2226 end
2327 end
lib/docs/scrapers/qt.rb+7−0
@@ -117,5 +117,12 @@ module Docs · 116 unmodified lines
117117 self.release = '5.6'
118118 self.base_url = 'https://doc.qt.io/qt-5.6/'
119119 end
120+
121+ def get_latest_version(options, &block)
122+ fetch_doc('https://doc.qt.io/qt-5/index.html', options) do |doc|
123+ label = doc.at_css('.mainContent h1.title').content
124+ block.call label.sub(/Qt /, '')
125+ end
126+ end
120127 end
121128 end
lib/docs/scrapers/ramda.rb+6−0
@@ -15,6 +15,12 @@ module Docs · 14 unmodified lines
1515 &copy; 2013&ndash;2016 Scott Sauyet and Michael Hurley<br>
1616 Licensed under the MIT License.
1717 HTML
18+
19+ def get_latest_version(options, &block)
20+ fetch_doc('https://ramdajs.com/docs/', options) do |doc|
21+ block.call doc.at_css('.navbar-brand > .version').content[1..-1]
22+ end
23+ end
1824 end
1925 end
2026
lib/docs/scrapers/react.rb+6−0
@@ -30,5 +30,11 @@ module Docs · 29 unmodified lines
3030 &copy; 2013&ndash;present Facebook Inc.<br>
3131 Licensed under the Creative Commons Attribution 4.0 International Public License.
3232 HTML
33+
34+ def get_latest_version(options, &block)
35+ fetch_doc('https://reactjs.org/docs/getting-started.html', options) do |doc|
36+ block.call doc.at_css('a[href="/versions"]').content.strip[1..-1]
37+ end
38+ end
3339 end
3440 end
lib/docs/scrapers/react_native.rb+6−0
@@ -30,5 +30,11 @@ module Docs · 29 unmodified lines
3030 &copy; 2015&ndash;2018 Facebook Inc.<br>
3131 Licensed under the Creative Commons Attribution 4.0 International Public License.
3232 HTML
33+
34+ def get_latest_version(options, &block)
35+ fetch_doc('https://facebook.github.io/react-native/docs/getting-started.html', options) do |doc|
36+ block.call doc.at_css('header > a > h3').content
37+ end
38+ end
3339 end
3440 end
lib/docs/scrapers/redis.rb+7−0
@@ -19,5 +19,12 @@ module Docs · 18 unmodified lines
1919 &copy; 2009&ndash;2018 Salvatore Sanfilippo<br>
2020 Licensed under the Creative Commons Attribution-ShareAlike License 4.0.
2121 HTML
22+
23+ def get_latest_version(options, &block)
24+ fetch('http://download.redis.io/redis-stable/00-RELEASENOTES', options) do |body|
25+ body = body.lines[1..-1].join
26+ block.call body.scan(/Redis ([0-9.]+)/)[0][0]
27+ end
28+ end
2229 end
2330 end
lib/docs/scrapers/redux.rb+4−0
@@ -20,5 +20,9 @@ module Docs · 19 unmodified lines
2020 stub '' do
2121 request_one('http://redux.js.org/index.html').body
2222 end
23+
24+ def get_latest_version(options, &block)
25+ get_npm_version('redux', options, &block)
26+ end
2327 end
2428 end
lib/docs/scrapers/relay.rb+6−0
@@ -18,5 +18,11 @@ module Docs · 17 unmodified lines
1818 &copy; 2013&ndash;present Facebook Inc.<br>
1919 Licensed under the BSD License.
2020 HTML
21+
22+ def get_latest_version(options, &block)
23+ fetch_doc('http://facebook.github.io/relay/en/', options) do |doc|
24+ block.call doc.at_css('header > a > h3').content[1..-1]
25+ end
26+ end
2127 end
2228 end
lib/docs/scrapers/requirejs.rb+4−0
@@ -30,5 +30,9 @@ module Docs · 29 unmodified lines
3030 &copy; jQuery Foundation and other contributors<br>
3131 Licensed under the MIT License.
3232 HTML
33+
34+ def get_latest_version(options, &block)
35+ get_npm_version('requirejs', options, &block)
36+ end
3337 end
3438 end
lib/docs/scrapers/rethinkdb.rb+6−0
@@ -58,6 +58,12 @@ module Docs · 57 unmodified lines
5858 CODE
5959 end
6060
61+ def get_latest_version(options, &block)
62+ get_latest_github_release('rethinkdb', 'rethinkdb', options) do |release|
63+ block.call release['tag_name'][1..-1]
64+ end
65+ end
66+
6167 private
6268
6369 def process_response?(response)
lib/docs/scrapers/rust.rb+7−0
@@ -39,6 +39,13 @@ module Docs · 38 unmodified lines
3939 Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
4040 HTML
4141
42+ def get_latest_version(options, &block)
43+ fetch_doc('https://www.rust-lang.org/', options) do |doc|
44+ label = doc.at_css('.button-download + p > a').content
45+ block.call label.sub(/Version /, '')
46+ end
47+ end
48+
4249 private
4350
4451 REDIRECT_RGX = /http-equiv="refresh"/i
lib/docs/scrapers/sass.rb+6−0
@@ -23,5 +23,11 @@ module Docs · 22 unmodified lines
2323 &copy; 2006&ndash;2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br>
2424 Licensed under the MIT License.
2525 HTML
26+
27+ def get_latest_version(options, &block)
28+ get_github_file_contents('sass', 'sass', 'VERSION', options) do |contents|
29+ block.call contents.strip
30+ end
31+ end
2632 end
2733 end
lib/docs/scrapers/scikit_image.rb+6−0
@@ -20,5 +20,11 @@ module Docs · 19 unmodified lines
2020 &copy; 2011 the scikit-image team<br>
2121 Licensed under the BSD 3-clause License.
2222 HTML
23+
24+ def get_latest_version(options, &block)
25+ get_github_tags('scikit-image', 'scikit-image', options) do |tags|
26+ block.call tags[0]['name'][1..-1]
27+ end
28+ end
2329 end
2430 end
lib/docs/scrapers/scikit_learn.rb+6−0
@@ -25,5 +25,11 @@ module Docs · 24 unmodified lines
2525 Licensed under the 3-clause BSD License.
2626 HTML
2727
28+ def get_latest_version(options, &block)
29+ fetch_doc('https://scikit-learn.org/stable/documentation.html', options) do |doc|
30+ label = doc.at_css('.body h1').content
31+ block.call label.scan(/([0-9.]+)/)[0][0]
32+ end
33+ end
2834 end
2935 end
lib/docs/scrapers/sinon.rb+6−0
@@ -52,5 +52,11 @@ module Docs · 51 unmodified lines
5252 self.release = '1.17.7'
5353 self.base_url = "https://sinonjs.org/releases/v#{release}/"
5454 end
55+
56+ def get_latest_version(options, &block)
57+ fetch('https://sinonjs.org/', options) do |body|
58+ block.call body.scan(/\/releases\/v([0-9.]+)/)[0][0]
59+ end
60+ end
5561 end
5662 end
lib/docs/scrapers/socketio.rb+4−0
@@ -20,5 +20,9 @@ module Docs · 19 unmodified lines
2020 &copy; 2014&ndash;2015 Automattic<br>
2121 Licensed under the MIT License.
2222 HTML
23+
24+ def get_latest_version(options, &block)
25+ get_npm_version('socket.io', options, &block)
26+ end
2327 end
2428 end
lib/docs/scrapers/sqlite.rb+6−0
@@ -41,6 +41,12 @@ module Docs · 40 unmodified lines
4141
4242 options[:attribution] = 'SQLite is in the Public Domain.'
4343
44+ def get_latest_version(options, &block)
45+ fetch_doc('https://sqlite.org/chronology.html', options) do |doc|
46+ block.call doc.at_css('#chrontab > tbody > tr > td:last-child > a').content
47+ end
48+ end
49+
4450 private
4551
4652 def parse(response)
lib/docs/scrapers/statsmodels.rb+5−0
@@ -21,5 +21,10 @@ module Docs · 20 unmodified lines
2121 Licensed under the 3-clause BSD License.
2222 HTML
2323
24+ def get_latest_version(options, &block)
25+ fetch_doc('http://www.statsmodels.org/stable/', options) do |doc|
26+ block.call doc.at_css('.sphinxsidebarwrapper h3 + p > b').content
27+ end
28+ end
2429 end
2530 end
lib/docs/scrapers/symfony.rb+6−0
@@ -70,5 +70,11 @@ module Docs · 69 unmodified lines
7070 self.release = '2.7.35'
7171 self.base_url = "https://api.symfony.com/#{version}/"
7272 end
73+
74+ def get_latest_version(options, &block)
75+ get_latest_github_release('symfony', 'symfony', options) do |release|
76+ block.call release['tag_name'][1..-1]
77+ end
78+ end
7379 end
7480 end
lib/docs/scrapers/tcl_tk.rb+7−0
@@ -25,5 +25,12 @@ module Docs · 24 unmodified lines
2525 options[:attribution] = <<-HTML
2626 Licensed under <a href="http://tcl.tk/software/tcltk/license.html">Tcl/Tk terms</a>
2727 HTML
28+
29+ def get_latest_version(options, &block)
30+ fetch_doc('https://www.tcl.tk/man/tcl/contents.htm', options) do |doc|
31+ label = doc.at_css('h2').content
32+ block.call label.scan(/Tk([0-9.]+)/)[0][0]
33+ end
34+ end
2835 end
2936 end
lib/docs/scrapers/tensorflow.rb+6−0
@@ -56,6 +56,12 @@ module Docs · 55 unmodified lines
5656 /\Aextend/]
5757 end
5858
59+ def get_latest_version(options, &block)
60+ get_latest_github_release('tensorflow', 'tensorflow', options) do |release|
61+ block.call release['tag_name'][1..-1]
62+ end
63+ end
64+
5965 private
6066
6167 def parse(response)
lib/docs/scrapers/terraform.rb+6−0
@@ -18,5 +18,11 @@ module Docs · 17 unmodified lines
1818 &copy; 2018 HashiCorp</br>
1919 Licensed under the MPL 2.0 License.
2020 HTML
21+
22+ def get_latest_version(options, &block)
23+ get_github_file_contents('hashicorp', 'terraform-website', 'content/config.rb', options) do |contents|
24+ block.call contents.scan(/version\s+=\s+"([0-9.]+)"/)[0][0]
25+ end
26+ end
2127 end
2228 end
lib/docs/scrapers/twig.rb+6−0
@@ -28,5 +28,11 @@ module Docs · 27 unmodified lines
2828 self.release = '1.34.3'
2929 self.base_url = 'https://twig.symfony.com/doc/1.x/'
3030 end
31+
32+ def get_latest_version(options, &block)
33+ get_github_tags('twigphp', 'Twig', options) do |tags|
34+ block.call tags[0]['name'][1..-1]
35+ end
36+ end
3137 end
3238 end
lib/docs/scrapers/typescript.rb+6−0
@@ -24,6 +24,12 @@ module Docs · 23 unmodified lines
2424 &copy; Microsoft and other contributors<br>
2525 Licensed under the Apache License, Version 2.0.
2626 HTML
27+
28+ def get_latest_version(options, &block)
29+ get_latest_github_release('Microsoft', 'TypeScript', options) do |release|
30+ block.call release['tag_name'][1..-1]
31+ end
32+ end
2733 end
2834 end
2935
lib/docs/scrapers/underscore.rb+6−0
@@ -20,5 +20,11 @@ module Docs · 19 unmodified lines
2020 &copy; 2009&ndash;2018 Jeremy Ashkenas, DocumentCloud and Investigative Reporters &amp; Editors<br>
2121 Licensed under the MIT License.
2222 HTML
23+
24+ def get_latest_version(options, &block)
25+ fetch_doc('https://underscorejs.org/', options) do |doc|
26+ block.call doc.at_css('.version').content[1...-1]
27+ end
28+ end
2329 end
2430 end
lib/docs/scrapers/vagrant.rb+6−0
@@ -18,5 +18,11 @@ module Docs · 17 unmodified lines
1818 &copy; 2010&ndash;2018 Mitchell Hashimoto<br>
1919 Licensed under the MPL 2.0 License.
2020 HTML
21+
22+ def get_latest_version(options, &block)
23+ get_github_file_contents('hashicorp', 'vagrant', 'website/config.rb', options) do |contents|
24+ block.call contents.scan(/version\s+=\s+"([0-9.]+)"/)[0][0]
25+ end
26+ end
2127 end
2228 end
lib/docs/scrapers/vue.rb+6−0
@@ -32,5 +32,11 @@ module Docs · 31 unmodified lines
3232 self.root_path = '/guide/index.html'
3333 self.initial_paths = %w(/api/index.html)
3434 end
35+
36+ def get_latest_version(options, &block)
37+ get_latest_github_release('vuejs', 'vue', options) do |release|
38+ block.call release['tag_name'][1..-1]
39+ end
40+ end
3541 end
3642 end
lib/docs/scrapers/vulkan.rb+6−0
@@ -20,5 +20,11 @@ module Docs · 19 unmodified lines
2020 Licensed under the Creative Commons Attribution 4.0 International License.<br>
2121 Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.
2222 HTML
23+
24+ def get_latest_version(options, &block)
25+ get_github_tags('KhronosGroup', 'Vulkan-Docs', options) do |tags|
26+ block.call tags[0]['name'][1..-1]
27+ end
28+ end
2329 end
2430 end
lib/docs/scrapers/webpack.rb+4−0
@@ -68,5 +68,9 @@ module Docs · 67 unmodified lines
6868 Licensed under the MIT License.
6969 HTML
7070 end
71+
72+ def get_latest_version(options, &block)
73+ get_npm_version('webpack', options, &block)
74+ end
7175 end
7276 end
lib/docs/scrapers/yarn.rb+6−0
@@ -20,5 +20,11 @@ module Docs · 19 unmodified lines
2020 &copy; 2016&ndash;present Yarn Contributors<br>
2121 Licensed under the BSD License.
2222 HTML
23+
24+ def get_latest_version(options, &block)
25+ get_latest_github_release('yarnpkg', 'yarn', options) do |release|
26+ block.call release['tag_name'][1..-1]
27+ end
28+ end
2329 end
2430 end
lib/docs/scrapers/yii.rb+6−0
@@ -34,5 +34,11 @@ module Docs · 33 unmodified lines
3434
3535 options[:container] = '.grid_9'
3636 end
37+
38+ def get_latest_version(options, &block)
39+ get_latest_github_release('yiisoft', 'yii2', options) do |release|
40+ block.call release['tag_name']
41+ end
42+ end
3743 end
3844 end
lib/tasks/updates.thor+2−2
@@ -58,7 +58,7 @@ class UpdatesCLI < Thor · 57 unmodified lines
5858
5959 private
6060
61− def check_doc(doc, options)
61+ def check_doc(doc, opts)
6262 # Newer scraper versions always come before older scraper versions
6363 # Therefore, the first item's release value is the latest scraper version
6464 #
@@ -71,7 +71,7 @@ class UpdatesCLI < Thor · 6 unmodified lines
7171
7272 logger.debug("Checking #{doc.name}")
7373
74− instance.get_latest_version(options) do |latest_version|
74+ instance.get_latest_version(opts) do |latest_version|
7575 return {
7676 name: doc.name,
7777 scraper_version: scraper_version,