redis.rb 909 B

1234567891011121314151617181920212223242526272829
  1. module Docs
  2. class Redis < UrlScraper
  3. self.type = 'redis'
  4. self.release = '5.0.0'
  5. self.base_url = 'https://redis.io/commands'
  6. self.links = {
  7. home: 'https://redis.io/',
  8. code: 'https://github.com/antirez/redis'
  9. }
  10. html_filters.push 'redis/entries', 'redis/clean_html', 'title'
  11. options[:container] = ->(filter) { filter.root_page? ? '#commands' : '.text' }
  12. options[:title] = false
  13. options[:root_title] = 'Redis'
  14. options[:follow_links] = ->(filter) { filter.root_page? }
  15. options[:attribution] = <<-HTML
  16. &copy; 2009&ndash;2018 Salvatore Sanfilippo<br>
  17. Licensed under the Creative Commons Attribution-ShareAlike License 4.0.
  18. HTML
  19. def get_latest_version(opts)
  20. body = fetch('http://download.redis.io/redis-stable/00-RELEASENOTES', opts)
  21. body = body.lines[1..-1].join
  22. body.scan(/Redis ([0-9.]+)/)[0][0]
  23. end
  24. end
  25. end