History

Fix get_latest_version for various scrapers

Simon Legner committed 6 years ago

Commit b1a14341 parent 40df5214 files · +9 −5Browse files

Unified · Split

4 files
  1. lib/docs/scrapers/ansible.rb +1 −1
  2. lib/docs/scrapers/dart.rb +1 −1
  3. lib/docs/scrapers/gnuplot.rb +6 −0
  4. lib/docs/scrapers/pandas.rb +1 −3
lib/docs/scrapers/ansible.rb+1−1
@@ -71,7 +71,7 @@ module Docs · 70 unmodified lines
71 71
72 def get_latest_version(opts)72 def get_latest_version(opts)
73 doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts)73 doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts)
74 doc.at_css('.DocSiteProduct-CurrentVersion').content.strip74 doc.at_css('.version').content.strip
75 end75 end
76 end76 end
77end77end
lib/docs/scrapers/dart.rb+1−1
@@ -33,7 +33,7 @@ module Docs · 32 unmodified lines
33 def get_latest_version(opts)33 def get_latest_version(opts)
34 doc = fetch_doc('https://api.dartlang.org/', opts)34 doc = fetch_doc('https://api.dartlang.org/', opts)
35 label = doc.at_css('footer > span').content.strip35 label = doc.at_css('footer > span').content.strip
36 label.sub(/Dart /, '')36 label.sub(/Dart\s*/, '')
37 end37 end
38 end38 end
39end39end
lib/docs/scrapers/gnuplot.rb+6−0
@@ -37,5 +37,11 @@ module Docs · 36 unmodified lines
37 Distributed under the <a href="https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright">gnuplot license</a> (rights to distribute modified versions are withheld).37 Distributed under the <a href="https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright">gnuplot license</a> (rights to distribute modified versions are withheld).
38 HTML38 HTML
39 39
40 def get_latest_version(opts)
41 doc = fetch_doc('http://www.gnuplot.info/download.html', opts)
42 label = doc.at_css('h2').content.strip
43 label.sub(/[^0-9.]*/, '')
44 end
45
40 end46 end
41end47end
lib/docs/scrapers/pandas.rb+1−3
@@ -62,9 +62,7 @@ module Docs · 61 unmodified lines
62 end62 end
63 63
64 def get_latest_version(opts)64 def get_latest_version(opts)
65 doc = fetch_doc('http://pandas.pydata.org/pandas-docs/stable/', opts)65 get_latest_github_release('pandas-dev', 'pandas', opts)
66 label = doc.at_css('.body > .section > p').content
67 label.scan(/Version: ([0-9.]+)/)[0][0]
68 end66 end
69 end67 end
70end68end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t