History

reactivex: implement get_latest_version

Jasper van Merle committed 7 years ago

Commit c88ae2c1 parent 3e1e65e4 files · +9 −-1Browse files

Unified · Split

4 files
  1. lib/docs/core/doc.rb +6 −0
  2. lib/docs/scrapers/reactivex.rb +5 −1
  3. public/icons/docs/reactivex/16.png +0 −0
  4. public/icons/docs/reactivex/16@2x.png +0 −0
lib/docs/core/doc.rb+6−0
@@ -262,5 +262,11 @@ module Docs · 261 unmodified lines
262262 json = fetch_json("https://api.github.com/repos/#{owner}/#{repo}/contents/#{path}", opts)
263263 Base64.decode64(json['content'])
264264 end
265+
266+ def get_latest_github_commit_date(owner, repo, opts)
267+ commits = fetch_json("https://api.github.com/repos/#{owner}/#{repo}/commits", opts)
268+ timestamp = commits[0]['commit']['author']['date']
269+ Date.iso8601(timestamp).to_time.to_i
270+ end
265271 end
266272 end
lib/docs/scrapers/reactivex.rb+5−1
@@ -1,7 +1,7 @@
11 module Docs
22 class Reactivex < UrlScraper
3− self.type = 'reactivex'
43 self.name = 'ReactiveX'
4+ self.type = 'reactivex'
55 self.base_url = 'http://reactivex.io/'
66 self.root_path = 'intro.html'
77 self.links = {
@@ -19,5 +19,9 @@ module Docs · 11 unmodified lines
1919 &copy; ReactiveX contributors<br>
2020 Licensed under the Apache License 2.0.
2121 HTML
22+
23+ def get_latest_version(opts)
24+ get_latest_github_commit_date('ReactiveX', 'reactivex.github.io', opts)
25+ end
2226 end
2327 end
public/icons/docs/reactivex/16.pngrenamed from public/icons/docs/reactivex/logo.png+0−0

File renamed without changes.

public/icons/docs/reactivex/16@2x.pngrenamed from public/icons/docs/reactivex/logo@2x.png+0−0

File renamed without changes.