[devdocsgjs/main: 1402/1867] Update Sinon version 7 and add version 8 and 9




commit cdc2644f816a82324e32d048e23e63b8c086769f
Author: MasterEnoc <brianhernandez222 hotmail com>
Date:   Mon Dec 21 13:13:26 2020 -0600

    Update Sinon version 7 and add version 8 and 9

 lib/docs/filters/sinon/clean_html.rb |  6 ++++++
 lib/docs/scrapers/sinon.rb           | 28 ++++++++++++++++++++++++----
 2 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/lib/docs/filters/sinon/clean_html.rb b/lib/docs/filters/sinon/clean_html.rb
index 0c301206..b7ea8e55 100644
--- a/lib/docs/filters/sinon/clean_html.rb
+++ b/lib/docs/filters/sinon/clean_html.rb
@@ -20,7 +20,13 @@ module Docs
           node['data-language'] = 'javascript'
         end
 
+        css('#banner-message').remove
+
+        # Removes duplicate title
+        css('#json-p').remove
+
         doc
+
       end
     end
   end
diff --git a/lib/docs/scrapers/sinon.rb b/lib/docs/scrapers/sinon.rb
index 632348dc..1d06c582 100644
--- a/lib/docs/scrapers/sinon.rb
+++ b/lib/docs/scrapers/sinon.rb
@@ -14,12 +14,31 @@ module Docs
     options[:container] = '.content .container'
 
     options[:attribution] = <<-HTML
-      &copy; 2010&ndash;2018 Christian Johansen<br>
+      &copy; 2010&ndash;2020 Christian Johansen<br>
       Licensed under the BSD License.
     HTML
 
+    # Links in page point to '../page' what makes devdocs points to non-existent links
+    options[:fix_urls] = -> (url) do
+      if !(url =~ /releases\/v\d*/)
+        url.gsub!(/.*releases\//, "")
+      end
+
+      url
+    end
+
+    version '9' do
+      self.release = '9.2.2'
+      self.base_url = "https://sinonjs.org/releases/v#{release}/";
+    end
+
+    version '8' do
+      self.release = '8.1.1'
+      self.base_url = "https://sinonjs.org/releases/v#{release}/";
+    end
+
     version '7' do
-      self.release = '7.1.1'
+      self.release = '7.5.0'
       self.base_url = "https://sinonjs.org/releases/v#{release}/";
     end
 
@@ -54,8 +73,9 @@ module Docs
     end
 
     def get_latest_version(opts)
-      body = fetch('https://sinonjs.org/', opts)
-      body.scan(/\/releases\/v([0-9.]+)/)[0][0]
+      tags = get_github_tags('sinonjs', 'sinon', opts)
+      tags[0]['name'][1..-1]
     end
+
   end
 end


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]