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
25 &copy; 2011-2018 Nginx, Inc.<br>25 &copy; 2011-2018 Nginx, Inc.<br>
26 Licensed under the BSD License.26 Licensed under the BSD License.
27 HTML27 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
28 end35 end
29end36end
lib/docs/scrapers/nginx_lua_module.rb+10−0
@@ -4,6 +4,9 @@ module Docs · 3 unmodified lines
4 self.slug = 'nginx_lua_module'4 self.slug = 'nginx_lua_module'
5 self.release = '0.10.13'5 self.release = '0.10.13'
6 self.base_url = "https://github.com/openresty/lua-nginx-module/tree/v#{self.release}/"6 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 }
7 10
8 html_filters.push 'nginx_lua_module/clean_html', 'nginx_lua_module/entries', 'title'11 html_filters.push 'nginx_lua_module/clean_html', 'nginx_lua_module/entries', 'title'
9 12
@@ -15,5 +18,12 @@ module Docs · 5 unmodified lines
15 &copy; 2009&ndash;2018 Yichun "agentzh" Zhang (章亦春), OpenResty Inc.<br>18 &copy; 2009&ndash;2018 Yichun "agentzh" Zhang (章亦春), OpenResty Inc.<br>
16 Licensed under the BSD License.19 Licensed under the BSD License.
17 HTML20 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
18 end28 end
19end29end
lib/docs/scrapers/nim.rb+6−0
@@ -17,5 +17,11 @@ module Docs · 16 unmodified lines
17 &copy; 2006&ndash;2018 Andreas Rumpf<br>17 &copy; 2006&ndash;2018 Andreas Rumpf<br>
18 Licensed under the MIT License.18 Licensed under the MIT License.
19 HTML19 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
20 end26 end
21end27end
lib/docs/scrapers/node.rb+6−0
@@ -46,5 +46,11 @@ module Docs · 45 unmodified lines
46 self.release = '4.9.1'46 self.release = '4.9.1'
47 self.base_url = 'https://nodejs.org/dist/latest-v4.x/docs/api/'47 self.base_url = 'https://nodejs.org/dist/latest-v4.x/docs/api/'
48 end48 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
49 end55 end
50end56end
lib/docs/scrapers/nokogiri2.rb+6−0
@@ -19,5 +19,11 @@ module Docs · 18 unmodified lines
19 Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid, Lars Kanis<br>19 Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid, Lars Kanis<br>
20 Licensed under the MIT License.20 Licensed under the MIT License.
21 HTML21 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
22 end28 end
23end29end
lib/docs/scrapers/npm.rb+6−0
@@ -29,5 +29,11 @@ module Docs · 28 unmodified lines
29 Licensed under the npm License.<br>29 Licensed under the npm License.<br>
30 npm is a trademark of npm, Inc.30 npm is a trademark of npm, Inc.
31 HTML31 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
32 end38 end
33end39end
lib/docs/scrapers/numpy.rb+6−0
@@ -49,5 +49,11 @@ module Docs · 48 unmodified lines
49 self.release = '1.10.4'49 self.release = '1.10.4'
50 self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/"50 self.base_url = "https://docs.scipy.org/doc/numpy-#{self.release}/reference/"
51 end51 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
52 end58 end
53end59end
lib/docs/scrapers/openjdk.rb+21−0
@@ -86,5 +86,26 @@ module Docs · 85 unmodified lines
86 def read_file(path)86 def read_file(path)
87 File.read(path).force_encoding('iso-8859-1').encode('utf-8') rescue nil87 File.read(path).force_encoding('iso-8859-1').encode('utf-8') rescue nil
88 end88 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
89 end110 end
90end111end
lib/docs/scrapers/opentsdb.rb+6−0
@@ -18,5 +18,11 @@ module Docs · 17 unmodified lines
18 &copy; 2010&ndash;2016 The OpenTSDB Authors<br>18 &copy; 2010&ndash;2016 The OpenTSDB Authors<br>
19 Licensed under the GNU LGPLv2.1+ and GPLv3+ licenses.19 Licensed under the GNU LGPLv2.1+ and GPLv3+ licenses.
20 HTML20 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
21 end27 end
22end28end
lib/docs/scrapers/padrino.rb+6−0
@@ -23,5 +23,11 @@ module Docs · 22 unmodified lines
23 stub 'index2' do23 stub 'index2' do
24 request_one(url_for('index')).body24 request_one(url_for('index')).body
25 end25 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
26 end32 end
27end33end
lib/docs/scrapers/pandas.rb+7−0
@@ -49,5 +49,12 @@ module Docs · 48 unmodified lines
49 self.release = '0.18.1'49 self.release = '0.18.1'
50 self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"50 self.base_url = "http://pandas.pydata.org/pandas-docs/version/#{self.release}/"
51 end51 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
52 end59 end
53end60end
lib/docs/scrapers/perl.rb+6−0
@@ -43,5 +43,11 @@ module Docs · 42 unmodified lines
43 self.release = '5.20.2'43 self.release = '5.20.2'
44 self.base_url = "https://perldoc.perl.org/#{self.release}/"44 self.base_url = "https://perldoc.perl.org/#{self.release}/"
45 end45 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
46 end52 end
47end53end
lib/docs/scrapers/phalcon.rb+6−0
@@ -29,5 +29,11 @@ module Docs · 28 unmodified lines
29 self.release = '2.0.13'29 self.release = '2.0.13'
30 self.base_url = 'https://docs.phalconphp.com/en/2.0.0/'30 self.base_url = 'https://docs.phalconphp.com/en/2.0.0/'
31 end31 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
32 end38 end
33end39end
lib/docs/scrapers/phaser.rb+6−0
@@ -25,5 +25,11 @@ module Docs · 24 unmodified lines
25 &copy; 2016 Richard Davey, Photon Storm Ltd.<br>25 &copy; 2016 Richard Davey, Photon Storm Ltd.<br>
26 Licensed under the MIT License.26 Licensed under the MIT License.
27 HTML27 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
28 end34 end
29end35end
lib/docs/scrapers/phoenix.rb+6−0
@@ -46,5 +46,11 @@ module Docs · 45 unmodified lines
46 HTML46 HTML
47 end47 end
48 }48 }
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
49 end55 end
50end56end
lib/docs/scrapers/php.rb+7−0
@@ -66,5 +66,12 @@ module Docs · 65 unmodified lines
66 &copy; 1997&ndash;2018 The PHP Documentation Group<br>66 &copy; 1997&ndash;2018 The PHP Documentation Group<br>
67 Licensed under the Creative Commons Attribution License v3.0 or later.67 Licensed under the Creative Commons Attribution License v3.0 or later.
68 HTML68 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
69 end76 end
70end77end
lib/docs/scrapers/phpunit.rb+7−0
@@ -37,5 +37,12 @@ module Docs · 36 unmodified lines
37 self.release = '4.8'37 self.release = '4.8'
38 self.base_url = "https://phpunit.de/manual/#{release}/en/"38 self.base_url = "https://phpunit.de/manual/#{release}/en/"
39 end39 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
40 end47 end
41end48end
lib/docs/scrapers/postgresql.rb+7−0
@@ -80,5 +80,12 @@ module Docs · 79 unmodified lines
80 80
81 html_filters.insert_before 'postgresql/extract_metadata', 'postgresql/normalize_class_names'81 html_filters.insert_before 'postgresql/extract_metadata', 'postgresql/normalize_class_names'
82 end82 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
83 end90 end
84end91end
lib/docs/scrapers/pug.rb+4−0
@@ -18,6 +18,10 @@ module Docs · 17 unmodified lines
18 Licensed under the MIT license.18 Licensed under the MIT license.
19 HTML19 HTML
20 20
21 def get_latest_version(options, &block)
22 get_npm_version('pug', options, &block)
23 end
24
21 private25 private
22 26
23 def parse(response) # Hook here because Nokogori removes whitespace from textareas27 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
14 &copy; 2017 Google Inc<br>14 &copy; 2017 Google Inc<br>
15 Licensed under the Apache License 2.0.15 Licensed under the Apache License 2.0.
16 HTML16 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
17 end23 end
18end24end
lib/docs/scrapers/pygame.rb+6−0
@@ -17,5 +17,11 @@ module Docs · 16 unmodified lines
17 &copy; Pygame Developpers.<br>17 &copy; Pygame Developpers.<br>
18 Licensed under the GNU LGPL License version 2.1.18 Licensed under the GNU LGPL License version 2.1.
19 HTML19 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
20 end26 end
21end27end
lib/docs/scrapers/python.rb+6−0
@@ -50,5 +50,11 @@ module Docs · 49 unmodified lines
50 50
51 html_filters.push 'python/entries_v2', 'sphinx/clean_html', 'python/clean_html'51 html_filters.push 'python/entries_v2', 'sphinx/clean_html', 'python/clean_html'
52 end52 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
53 end59 end
54end60end
lib/docs/scrapers/q.rb+4−0
@@ -19,5 +19,9 @@ module Docs · 18 unmodified lines
19 &copy; 2009&ndash;2017 Kristopher Michael Kowal<br>19 &copy; 2009&ndash;2017 Kristopher Michael Kowal<br>
20 Licensed under the MIT License.20 Licensed under the MIT License.
21 HTML21 HTML
22
23 def get_latest_version(options, &block)
24 get_npm_version('q', options, &block)
25 end
22 end26 end
23end27end
lib/docs/scrapers/qt.rb+7−0
@@ -117,5 +117,12 @@ module Docs · 116 unmodified lines
117 self.release = '5.6'117 self.release = '5.6'
118 self.base_url = 'https://doc.qt.io/qt-5.6/'118 self.base_url = 'https://doc.qt.io/qt-5.6/'
119 end119 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
120 end127 end
121end128end
lib/docs/scrapers/ramda.rb+6−0
@@ -15,6 +15,12 @@ module Docs · 14 unmodified lines
15 &copy; 2013&ndash;2016 Scott Sauyet and Michael Hurley<br>15 &copy; 2013&ndash;2016 Scott Sauyet and Michael Hurley<br>
16 Licensed under the MIT License.16 Licensed under the MIT License.
17 HTML17 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
18 end24 end
19end25end
20 26
lib/docs/scrapers/react.rb+6−0
@@ -30,5 +30,11 @@ module Docs · 29 unmodified lines
30 &copy; 2013&ndash;present Facebook Inc.<br>30 &copy; 2013&ndash;present Facebook Inc.<br>
31 Licensed under the Creative Commons Attribution 4.0 International Public License.31 Licensed under the Creative Commons Attribution 4.0 International Public License.
32 HTML32 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
33 end39 end
34end40end
lib/docs/scrapers/react_native.rb+6−0
@@ -30,5 +30,11 @@ module Docs · 29 unmodified lines
30 &copy; 2015&ndash;2018 Facebook Inc.<br>30 &copy; 2015&ndash;2018 Facebook Inc.<br>
31 Licensed under the Creative Commons Attribution 4.0 International Public License.31 Licensed under the Creative Commons Attribution 4.0 International Public License.
32 HTML32 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
33 end39 end
34end40end
lib/docs/scrapers/redis.rb+7−0
@@ -19,5 +19,12 @@ module Docs · 18 unmodified lines
19 &copy; 2009&ndash;2018 Salvatore Sanfilippo<br>19 &copy; 2009&ndash;2018 Salvatore Sanfilippo<br>
20 Licensed under the Creative Commons Attribution-ShareAlike License 4.0.20 Licensed under the Creative Commons Attribution-ShareAlike License 4.0.
21 HTML21 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
22 end29 end
23end30end
lib/docs/scrapers/redux.rb+4−0
@@ -20,5 +20,9 @@ module Docs · 19 unmodified lines
20 stub '' do20 stub '' do
21 request_one('http://redux.js.org/index.html').body21 request_one('http://redux.js.org/index.html').body
22 end22 end
23
24 def get_latest_version(options, &block)
25 get_npm_version('redux', options, &block)
26 end
23 end27 end
24end28end
lib/docs/scrapers/relay.rb+6−0
@@ -18,5 +18,11 @@ module Docs · 17 unmodified lines
18 &copy; 2013&ndash;present Facebook Inc.<br>18 &copy; 2013&ndash;present Facebook Inc.<br>
19 Licensed under the BSD License.19 Licensed under the BSD License.
20 HTML20 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
21 end27 end
22end28end
lib/docs/scrapers/requirejs.rb+4−0
@@ -30,5 +30,9 @@ module Docs · 29 unmodified lines
30 &copy; jQuery Foundation and other contributors<br>30 &copy; jQuery Foundation and other contributors<br>
31 Licensed under the MIT License.31 Licensed under the MIT License.
32 HTML32 HTML
33
34 def get_latest_version(options, &block)
35 get_npm_version('requirejs', options, &block)
36 end
33 end37 end
34end38end
lib/docs/scrapers/rethinkdb.rb+6−0
@@ -58,6 +58,12 @@ module Docs · 57 unmodified lines
58 CODE58 CODE
59 end59 end
60 60
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
61 private67 private
62 68
63 def process_response?(response)69 def process_response?(response)
lib/docs/scrapers/rust.rb+7−0
@@ -39,6 +39,13 @@ module Docs · 38 unmodified lines
39 Licensed under the Apache License, Version 2.0 or the MIT license, at your option.39 Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
40 HTML40 HTML
41 41
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
42 private49 private
43 50
44 REDIRECT_RGX = /http-equiv="refresh"/i51 REDIRECT_RGX = /http-equiv="refresh"/i
lib/docs/scrapers/sass.rb+6−0
@@ -23,5 +23,11 @@ module Docs · 22 unmodified lines
23 &copy; 2006&ndash;2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br>23 &copy; 2006&ndash;2016 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein<br>
24 Licensed under the MIT License.24 Licensed under the MIT License.
25 HTML25 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
26 end32 end
27end33end
lib/docs/scrapers/scikit_image.rb+6−0
@@ -20,5 +20,11 @@ module Docs · 19 unmodified lines
20 &copy; 2011 the scikit-image team<br>20 &copy; 2011 the scikit-image team<br>
21 Licensed under the BSD 3-clause License.21 Licensed under the BSD 3-clause License.
22 HTML22 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
23 end29 end
24end30end
lib/docs/scrapers/scikit_learn.rb+6−0
@@ -25,5 +25,11 @@ module Docs · 24 unmodified lines
25 Licensed under the 3-clause BSD License.25 Licensed under the 3-clause BSD License.
26 HTML26 HTML
27 27
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
28 end34 end
29end35end
lib/docs/scrapers/sinon.rb+6−0
@@ -52,5 +52,11 @@ module Docs · 51 unmodified lines
52 self.release = '1.17.7'52 self.release = '1.17.7'
53 self.base_url = "https://sinonjs.org/releases/v#{release}/"53 self.base_url = "https://sinonjs.org/releases/v#{release}/"
54 end54 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
55 end61 end
56end62end
lib/docs/scrapers/socketio.rb+4−0
@@ -20,5 +20,9 @@ module Docs · 19 unmodified lines
20 &copy; 2014&ndash;2015 Automattic<br>20 &copy; 2014&ndash;2015 Automattic<br>
21 Licensed under the MIT License.21 Licensed under the MIT License.
22 HTML22 HTML
23
24 def get_latest_version(options, &block)
25 get_npm_version('socket.io', options, &block)
26 end
23 end27 end
24end28end
lib/docs/scrapers/sqlite.rb+6−0
@@ -41,6 +41,12 @@ module Docs · 40 unmodified lines
41 41
42 options[:attribution] = 'SQLite is in the Public Domain.'42 options[:attribution] = 'SQLite is in the Public Domain.'
43 43
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
44 private50 private
45 51
46 def parse(response)52 def parse(response)
lib/docs/scrapers/statsmodels.rb+5−0
@@ -21,5 +21,10 @@ module Docs · 20 unmodified lines
21 Licensed under the 3-clause BSD License.21 Licensed under the 3-clause BSD License.
22 HTML22 HTML
23 23
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
24 end29 end
25end30end
lib/docs/scrapers/symfony.rb+6−0
@@ -70,5 +70,11 @@ module Docs · 69 unmodified lines
70 self.release = '2.7.35'70 self.release = '2.7.35'
71 self.base_url = "https://api.symfony.com/#{version}/"71 self.base_url = "https://api.symfony.com/#{version}/"
72 end72 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
73 end79 end
74end80end
lib/docs/scrapers/tcl_tk.rb+7−0
@@ -25,5 +25,12 @@ module Docs · 24 unmodified lines
25 options[:attribution] = <<-HTML25 options[:attribution] = <<-HTML
26 Licensed under <a href="http://tcl.tk/software/tcltk/license.html">Tcl/Tk terms</a>26 Licensed under <a href="http://tcl.tk/software/tcltk/license.html">Tcl/Tk terms</a>
27 HTML27 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
28 end35 end
29end36end
lib/docs/scrapers/tensorflow.rb+6−0
@@ -56,6 +56,12 @@ module Docs · 55 unmodified lines
56 /\Aextend/]56 /\Aextend/]
57 end57 end
58 58
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
59 private65 private
60 66
61 def parse(response)67 def parse(response)
lib/docs/scrapers/terraform.rb+6−0
@@ -18,5 +18,11 @@ module Docs · 17 unmodified lines
18 &copy; 2018 HashiCorp</br>18 &copy; 2018 HashiCorp</br>
19 Licensed under the MPL 2.0 License.19 Licensed under the MPL 2.0 License.
20 HTML20 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
21 end27 end
22end28end
lib/docs/scrapers/twig.rb+6−0
@@ -28,5 +28,11 @@ module Docs · 27 unmodified lines
28 self.release = '1.34.3'28 self.release = '1.34.3'
29 self.base_url = 'https://twig.symfony.com/doc/1.x/'29 self.base_url = 'https://twig.symfony.com/doc/1.x/'
30 end30 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
31 end37 end
32end38end
lib/docs/scrapers/typescript.rb+6−0
@@ -24,6 +24,12 @@ module Docs · 23 unmodified lines
24 &copy; Microsoft and other contributors<br>24 &copy; Microsoft and other contributors<br>
25 Licensed under the Apache License, Version 2.0.25 Licensed under the Apache License, Version 2.0.
26 HTML26 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
27 end33 end
28end34end
29 35
lib/docs/scrapers/underscore.rb+6−0
@@ -20,5 +20,11 @@ module Docs · 19 unmodified lines
20 &copy; 2009&ndash;2018 Jeremy Ashkenas, DocumentCloud and Investigative Reporters &amp; Editors<br>20 &copy; 2009&ndash;2018 Jeremy Ashkenas, DocumentCloud and Investigative Reporters &amp; Editors<br>
21 Licensed under the MIT License.21 Licensed under the MIT License.
22 HTML22 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
23 end29 end
24end30end
lib/docs/scrapers/vagrant.rb+6−0
@@ -18,5 +18,11 @@ module Docs · 17 unmodified lines
18 &copy; 2010&ndash;2018 Mitchell Hashimoto<br>18 &copy; 2010&ndash;2018 Mitchell Hashimoto<br>
19 Licensed under the MPL 2.0 License.19 Licensed under the MPL 2.0 License.
20 HTML20 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
21 end27 end
22end28end
lib/docs/scrapers/vue.rb+6−0
@@ -32,5 +32,11 @@ module Docs · 31 unmodified lines
32 self.root_path = '/guide/index.html'32 self.root_path = '/guide/index.html'
33 self.initial_paths = %w(/api/index.html)33 self.initial_paths = %w(/api/index.html)
34 end34 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
35 end41 end
36end42end
lib/docs/scrapers/vulkan.rb+6−0
@@ -20,5 +20,11 @@ module Docs · 19 unmodified lines
20 Licensed under the Creative Commons Attribution 4.0 International License.<br>20 Licensed under the Creative Commons Attribution 4.0 International License.<br>
21 Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.21 Vulkan and the Vulkan logo are registered trademarks of the Khronos Group Inc.
22 HTML22 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
23 end29 end
24end30end
lib/docs/scrapers/webpack.rb+4−0
@@ -68,5 +68,9 @@ module Docs · 67 unmodified lines
68 Licensed under the MIT License.68 Licensed under the MIT License.
69 HTML69 HTML
70 end70 end
71
72 def get_latest_version(options, &block)
73 get_npm_version('webpack', options, &block)
74 end
71 end75 end
72end76end
lib/docs/scrapers/yarn.rb+6−0
@@ -20,5 +20,11 @@ module Docs · 19 unmodified lines
20 &copy; 2016&ndash;present Yarn Contributors<br>20 &copy; 2016&ndash;present Yarn Contributors<br>
21 Licensed under the BSD License.21 Licensed under the BSD License.
22 HTML22 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
23 end29 end
24end30end
lib/docs/scrapers/yii.rb+6−0
@@ -34,5 +34,11 @@ module Docs · 33 unmodified lines
34 34
35 options[:container] = '.grid_9'35 options[:container] = '.grid_9'
36 end36 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
37 end43 end
38end44end
lib/tasks/updates.thor+2−2
@@ -58,7 +58,7 @@ class UpdatesCLI < Thor · 57 unmodified lines
58 58
59 private59 private
60 60
61 def check_doc(doc, options)61 def check_doc(doc, opts)
62 # Newer scraper versions always come before older scraper versions62 # Newer scraper versions always come before older scraper versions
63 # Therefore, the first item's release value is the latest scraper version63 # Therefore, the first item's release value is the latest scraper version
64 #64 #
@@ -71,7 +71,7 @@ class UpdatesCLI < Thor · 6 unmodified lines
71 71
72 logger.debug("Checking #{doc.name}")72 logger.debug("Checking #{doc.name}")
73 73
74 instance.get_latest_version(options) do |latest_version|74 instance.get_latest_version(opts) do |latest_version|
75 return {75 return {
76 name: doc.name,76 name: doc.name,
77 scraper_version: scraper_version,77 scraper_version: scraper_version,