History

Merge pull request #1438 from MasterEnoc/sinon

Update Sinon version 7 and add version 8 and 9

Simon Legner committed 5 years ago

Commit df9ff442 parents 0d229eb cdc26442 files · +30 −4Browse files

Unified · Split

2 files
  1. lib/docs/filters/sinon/clean_html.rb +6 −0
  2. lib/docs/scrapers/sinon.rb +24 −4
lib/docs/filters/sinon/clean_html.rb+6−0
@@ -20,7 +20,13 @@ module Docs · 19 unmodified lines
20 node['data-language'] = 'javascript'20 node['data-language'] = 'javascript'
21 end21 end
22 22
23 css('#banner-message').remove
24
25 # Removes duplicate title
26 css('#json-p').remove
27
23 doc28 doc
29
24 end30 end
25 end31 end
26 end32 end
lib/docs/scrapers/sinon.rb+24−4
@@ -14,12 +14,31 @@ module Docs · 13 unmodified lines
14 options[:container] = '.content .container'14 options[:container] = '.content .container'
15 15
16 options[:attribution] = <<-HTML16 options[:attribution] = <<-HTML
17 &copy; 2010&ndash;2018 Christian Johansen<br>17 &copy; 2010&ndash;2020 Christian Johansen<br>
18 Licensed under the BSD License.18 Licensed under the BSD License.
19 HTML19 HTML
20 20
21 # Links in page point to '../page' what makes devdocs points to non-existent links
22 options[:fix_urls] = -> (url) do
23 if !(url =~ /releases\/v\d*/)
24 url.gsub!(/.*releases\//, "")
25 end
26
27 url
28 end
29
30 version '9' do
31 self.release = '9.2.2'
32 self.base_url = "https://sinonjs.org/releases/v#{release}/"
33 end
34
35 version '8' do
36 self.release = '8.1.1'
37 self.base_url = "https://sinonjs.org/releases/v#{release}/"
38 end
39
21 version '7' do40 version '7' do
22 self.release = '7.1.1'41 self.release = '7.5.0'
23 self.base_url = "https://sinonjs.org/releases/v#{release}/"42 self.base_url = "https://sinonjs.org/releases/v#{release}/"
24 end43 end
25 44
@@ -54,8 +73,9 @@ module Docs · 28 unmodified lines
54 end73 end
55 74
56 def get_latest_version(opts)75 def get_latest_version(opts)
57 body = fetch('https://sinonjs.org/', opts)76 tags = get_github_tags('sinonjs', 'sinon', opts)
58 body.scan(/\/releases\/v([0-9.]+)/)[0][0]77 tags[0]['name'][1..-1]
59 end78 end
79
60 end80 end
61end81end