History

Merge pull request #1294 from jmerle/fix-update-checks

Fix broken get_latest_version implementations

Simon Legner committed 5 years ago

Commit 18f5c0a2 parents 7976b04 7ca18dd19 files · +28 −40Browse files

Unified · Split

19 files
  1. lib/docs/scrapers/babel.rb +1 −2
  2. lib/docs/scrapers/chef.rb +2 −2
  3. lib/docs/scrapers/codeigniter.rb +2 −3
  4. lib/docs/scrapers/docker.rb +3 −3
  5. lib/docs/scrapers/elixir.rb +1 −1
  6. lib/docs/scrapers/erlang.rb +1 −2
  7. lib/docs/scrapers/fish.rb +1 −2
  8. lib/docs/scrapers/gnu_cobol.rb +5 −3
  9. lib/docs/scrapers/gnuplot.rb +0 −1
  10. lib/docs/scrapers/godot.rb +1 −2
  11. lib/docs/scrapers/influxdata.rb +1 −3
  12. lib/docs/scrapers/moment.rb +1 −2
  13. lib/docs/scrapers/perl.rb +1 −2
  14. lib/docs/scrapers/php.rb +2 −3
  15. lib/docs/scrapers/python.rb +1 −1
  16. lib/docs/scrapers/react_native.rb +2 −2
  17. lib/docs/scrapers/scikit_learn.rb +1 −2
  18. lib/docs/scrapers/statsmodels.rb +1 −2
  19. lib/docs/scrapers/vagrant.rb +1 −2
lib/docs/scrapers/babel.rb+1−2
@@ -24,8 +24,7 @@ module Docs · 23 unmodified lines
24 end24 end
25 25
26 def get_latest_version(opts)26 def get_latest_version(opts)
27 doc = fetch_doc('https://babeljs.io/docs/en/', opts)27 get_latest_github_release('babel', 'babel', opts)
28 doc.at_css('a[href="/versions"] > h3').content
29 end28 end
30 end29 end
31end30end
lib/docs/scrapers/chef.rb+2−2
@@ -49,8 +49,8 @@ module Docs · 48 unmodified lines
49 end49 end
50 50
51 def get_latest_version(opts)51 def get_latest_version(opts)
52 doc = fetch_doc('https://downloads.chef.io/chef', opts)52 doc = fetch_doc('https://downloads.chef.io/products/infra', opts)
53 doc.at_css('h1.product-heading > span').content.strip53 doc.at_css('#versions > option').content.strip
54 end54 end
55 end55 end
56end56end
lib/docs/scrapers/codeigniter.rb+2−3
@@ -40,9 +40,8 @@ module Docs · 39 unmodified lines
40 end40 end
41 41
42 def get_latest_version(opts)42 def get_latest_version(opts)
43 doc = fetch_doc('https://codeigniter.com/user_guide/changelog.html', opts)43 tags = get_github_tags('codeigniter4', 'codeigniter4', opts)
44 header = doc.at_css('#change-log h2')44 tags[0]['name'][1..-1]
45 header.content.scan(/([0-9.]+)/)[0][0]
46 end45 end
47 end46 end
48end47end
lib/docs/scrapers/docker.rb+3−3
@@ -260,9 +260,9 @@ module Docs · 259 unmodified lines
260 end260 end
261 261
262 def get_latest_version(opts)262 def get_latest_version(opts)
263 doc = fetch_doc('https://docs.docker.com/', opts)263 doc = fetch_doc('https://docs.docker.com/engine/release-notes/', opts)
264 label = doc.at_css('.nav-container button.dropdown-toggle').content.strip264 latest_version = doc.at_css('.content > section > h1[id^="version-"]').content.strip
265 label.scan(/([0-9.]+)/)[0][0]265 latest_version.rpartition(' ')[-1]
266 end266 end
267 end267 end
268end268end
lib/docs/scrapers/elixir.rb+1−1
@@ -126,7 +126,7 @@ module Docs · 125 unmodified lines
126 126
127 def get_latest_version(opts)127 def get_latest_version(opts)
128 doc = fetch_doc('https://hexdocs.pm/elixir/api-reference.html', opts)128 doc = fetch_doc('https://hexdocs.pm/elixir/api-reference.html', opts)
129 doc.at_css('h2.sidebar-projectVersion').content.strip[1..-1]129 doc.at_css('.sidebar-projectVersion').content.strip[1..-1]
130 end130 end
131 end131 end
132end132end
lib/docs/scrapers/erlang.rb+1−2
@@ -57,8 +57,7 @@ module Docs · 56 unmodified lines
57 end57 end
58 58
59 def get_latest_version(opts)59 def get_latest_version(opts)
60 doc = fetch_doc('https://www.erlang.org/downloads', opts)60 get_latest_github_release('erlang', 'otp', opts)[4..-1]
61 doc.at_css('.col-lg-3 > ul > li').content.strip.sub(/OTP /, '')
62 end61 end
63 end62 end
64end63end
lib/docs/scrapers/fish.rb+1−2
@@ -54,8 +54,7 @@ module Docs · 53 unmodified lines
54 end54 end
55 55
56 def get_latest_version(opts)56 def get_latest_version(opts)
57 doc = fetch_doc('http://fishshell.com/docs/current/index.html', opts)57 get_latest_github_release('fish-shell', 'fish-shell', opts)
58 doc.at_css('#toc-index').content.scan(/([0-9.]+)/)[0][0]
59 end58 end
60 end59 end
61end60end
lib/docs/scrapers/gnu_cobol.rb+5−3
@@ -18,9 +18,11 @@ module Docs · 17 unmodified lines
18 HTML18 HTML
19 19
20 def get_latest_version(opts)20 def get_latest_version(opts)
21 doc = fetch_doc('https://open-cobol.sourceforge.io/HTML/gnucobpg.html', opts)21 fetch_doc('https://sourceforge.net/projects/gnucobol/files/gnucobol/', opts)
22 title = doc.at_css('h1').content22 .css('#files_list > tbody > tr')
23 title.scan(/([0-9.]+)/)[0][0]23 .map { |file| file['title'] }
24 .sort_by { |version| version.to_f }
25 .last
24 end26 end
25 end27 end
26end28end
lib/docs/scrapers/gnuplot.rb+0−1
@@ -42,6 +42,5 @@ module Docs · 41 unmodified lines
42 label = doc.at_css('h2').content.strip42 label = doc.at_css('h2').content.strip
43 label.sub(/[^0-9.]*/, '')43 label.sub(/[^0-9.]*/, '')
44 end44 end
45
46 end45 end
47end46end
lib/docs/scrapers/godot.rb+1−2
@@ -44,8 +44,7 @@ module Docs · 43 unmodified lines
44 end44 end
45 45
46 def get_latest_version(opts)46 def get_latest_version(opts)
47 doc = fetch_doc('https://docs.godotengine.org/', opts)47 get_latest_github_release('godotengine', 'godot', opts).split('-')[0]
48 doc.at_css('.version').content.strip
49 end48 end
50 end49 end
51end50end
lib/docs/scrapers/influxdata.rb+1−3
@@ -48,9 +48,7 @@ module Docs · 47 unmodified lines
48 HTML48 HTML
49 49
50 def get_latest_version(opts)50 def get_latest_version(opts)
51 doc = fetch_doc('https://docs.influxdata.com/influxdb/', opts)51 get_latest_github_release('influxdata', 'influxdb', opts)
52 label = doc.at_css('.navbar--current-product').content.strip
53 label.scan(/([0-9.]+)/)[0][0]
54 end52 end
55 end53 end
56end54end
lib/docs/scrapers/moment.rb+1−2
@@ -24,8 +24,7 @@ module Docs · 23 unmodified lines
24 HTML24 HTML
25 25
26 def get_latest_version(opts)26 def get_latest_version(opts)
27 doc = fetch_doc('http://momentjs.com/', opts)27 get_github_tags('moment', 'moment', opts)[0]['name']
28 doc.at_css('.hero-title > h1 > span').content
29 end28 end
30 end29 end
31end30end
lib/docs/scrapers/perl.rb+1−2
@@ -46,8 +46,7 @@ module Docs · 45 unmodified lines
46 46
47 def get_latest_version(opts)47 def get_latest_version(opts)
48 doc = fetch_doc('https://perldoc.perl.org/', opts)48 doc = fetch_doc('https://perldoc.perl.org/', opts)
49 header = doc.at_css('h2.h1').content49 doc.at_css('#dropdownlink-stable').content
50 header.scan(/Perl ([0-9.]+)/)[0][0]
51 end50 end
52 end51 end
53end52end
lib/docs/scrapers/php.rb+2−3
@@ -68,9 +68,8 @@ module Docs · 67 unmodified lines
68 HTML68 HTML
69 69
70 def get_latest_version(opts)70 def get_latest_version(opts)
71 doc = fetch_doc('https://secure.php.net/manual/en/doc.changelog.php', opts)71 doc = fetch_doc('https://www.php.net/supported-versions.php', opts)
72 label = doc.at_css('tbody.gen-changelog > tr > td').content72 doc.at_css('table > tbody > .stable:last-of-type > td > a').content.strip
73 label.split(',').last.strip
74 end73 end
75 end74 end
76end75end
lib/docs/scrapers/python.rb+1−1
@@ -68,7 +68,7 @@ module Docs · 67 unmodified lines
68 68
69 def get_latest_version(opts)69 def get_latest_version(opts)
70 doc = fetch_doc('https://docs.python.org/', opts)70 doc = fetch_doc('https://docs.python.org/', opts)
71 doc.at_css('.version_switcher_placeholder').content71 doc.at_css('title').content.split(' ')[0]
72 end72 end
73 end73 end
74end74end
lib/docs/scrapers/react_native.rb+2−2
@@ -32,8 +32,8 @@ module Docs · 31 unmodified lines
32 HTML32 HTML
33 33
34 def get_latest_version(opts)34 def get_latest_version(opts)
35 doc = fetch_doc('https://facebook.github.io/react-native/docs/getting-started.html', opts)35 doc = fetch_doc('https://reactnative.dev/docs/getting-started', opts)
36 doc.at_css('header > a > h3').content36 doc.at_css('meta[name="docsearch:version"]')['content']
37 end37 end
38 end38 end
39end39end
lib/docs/scrapers/scikit_learn.rb+1−2
@@ -26,8 +26,7 @@ module Docs · 25 unmodified lines
26 HTML26 HTML
27 27
28 def get_latest_version(opts)28 def get_latest_version(opts)
29 doc = fetch_doc('https://scikit-learn.org/stable/documentation.html', opts)29 get_latest_github_release('scikit-learn', 'scikit-learn', opts)
30 doc.at_css('.body h1').content.scan(/([0-9.]+)/)[0][0]
31 end30 end
32 end31 end
33end32end
lib/docs/scrapers/statsmodels.rb+1−2
@@ -22,8 +22,7 @@ module Docs · 21 unmodified lines
22 HTML22 HTML
23 23
24 def get_latest_version(opts)24 def get_latest_version(opts)
25 doc = fetch_doc('http://www.statsmodels.org/stable/', opts)25 get_latest_github_release('statsmodels', 'statsmodels', opts)
26 doc.at_css('.sphinxsidebarwrapper h3 + p > b').content[1..-1]
27 end26 end
28 end27 end
29end28end
lib/docs/scrapers/vagrant.rb+1−2
@@ -20,8 +20,7 @@ module Docs · 19 unmodified lines
20 HTML20 HTML
21 21
22 def get_latest_version(opts)22 def get_latest_version(opts)
23 contents = get_github_file_contents('hashicorp', 'vagrant', 'website/config.rb', opts)23 get_github_tags('hashicorp', 'vagrant', opts)[0]['name'][1..-1]
24 contents.scan(/version\s+=\s+"([0-9.]+)"/)[0][0]
25 end24 end
26 end25 end
27end26end