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
7171
7272 def get_latest_version(opts)
7373 doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts)
74− doc.at_css('.DocSiteProduct-CurrentVersion').content.strip
74+ doc.at_css('.version').content.strip
7575 end
7676 end
7777 end
lib/docs/scrapers/dart.rb+1−1
@@ -33,7 +33,7 @@ module Docs · 32 unmodified lines
3333 def get_latest_version(opts)
3434 doc = fetch_doc('https://api.dartlang.org/', opts)
3535 label = doc.at_css('footer > span').content.strip
36− label.sub(/Dart /, '')
36+ label.sub(/Dart\s*/, '')
3737 end
3838 end
3939 end
lib/docs/scrapers/gnuplot.rb+6−0
@@ -37,5 +37,11 @@ module Docs · 36 unmodified lines
3737 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).
3838 HTML
3939
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+
4046 end
4147 end
lib/docs/scrapers/pandas.rb+1−3
@@ -62,9 +62,7 @@ module Docs · 61 unmodified lines
6262 end
6363
6464 def get_latest_version(opts)
65− doc = fetch_doc('http://pandas.pydata.org/pandas-docs/stable/', opts)
66− label = doc.at_css('.body > .section > p').content
67− label.scan(/Version: ([0-9.]+)/)[0][0]
65+ get_latest_github_release('pandas-dev', 'pandas', opts)
6866 end
6967 end
7068 end

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