Quellcode durchsuchen

Merge pull request #1177 from simon04/fix-get_latest_version

Fix get_latest_version for various scrapers
Simon Legner vor 5 Jahren
Ursprung
Commit
3a3d5d433b

+ 1 - 1
lib/docs/scrapers/ansible.rb

@@ -71,7 +71,7 @@ module Docs
 
     def get_latest_version(opts)
       doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts)
-      doc.at_css('.DocSiteProduct-CurrentVersion').content.strip
+      doc.at_css('.version').content.strip
     end
   end
 end

+ 1 - 1
lib/docs/scrapers/dart.rb

@@ -33,7 +33,7 @@ module Docs
     def get_latest_version(opts)
       doc = fetch_doc('https://api.dartlang.org/', opts)
       label = doc.at_css('footer > span').content.strip
-      label.sub(/Dart /, '')
+      label.sub(/Dart\s*/, '')
     end
   end
 end

+ 6 - 0
lib/docs/scrapers/gnuplot.rb

@@ -37,5 +37,11 @@ module Docs
       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).
     HTML
 
+    def get_latest_version(opts)
+      doc = fetch_doc('http://www.gnuplot.info/download.html', opts)
+      label = doc.at_css('h2').content.strip
+      label.sub(/[^0-9.]*/, '')
+    end
+
   end
 end

+ 1 - 3
lib/docs/scrapers/pandas.rb

@@ -62,9 +62,7 @@ module Docs
     end
 
     def get_latest_version(opts)
-      doc = fetch_doc('http://pandas.pydata.org/pandas-docs/stable/', opts)
-      label = doc.at_css('.body > .section > p').content
-      label.scan(/Version: ([0-9.]+)/)[0][0]
+      get_latest_github_release('pandas-dev', 'pandas', opts)
     end
   end
 end