influxdata.rb 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. module Docs
  2. class Influxdata < UrlScraper
  3. self.name = 'InfluxData'
  4. self.type = 'simple'
  5. self.release = '1.3'
  6. self.base_url = 'https://docs.influxdata.com/'
  7. self.links = {
  8. home: 'https://www.influxdata.com/',
  9. code: 'https://github.com/influxdata/influxdb'
  10. }
  11. html_filters.push 'influxdata/entries', 'influxdata/clean_html', 'title'
  12. options[:trailing_slash] = true
  13. options[:root_title] = 'InfluxData Documentation'
  14. options[:title] = false
  15. options[:only_patterns] = [/(telegraf|influxdb|chronograf|kapacitor)\/v#{release}/]
  16. options[:skip_patterns] = [/enterprise/]
  17. options[:skip] = [
  18. "influxdb/v#{release}/sample_data/data_download/",
  19. "influxdb/v#{release}/tools/grafana/",
  20. "influxdb/v#{release}/about/",
  21. "influxdb/v#{release}/external_resources/",
  22. "influxdb/v#{release}/administration/security_best_practices/"
  23. ]
  24. options[:replace_paths] = {
  25. "telegraf/v#{release}/introduction/getting-started-telegraf/" => "telegraf/v#{release}/introduction/getting_started/",
  26. "influxdb/v#{release}/write_protocols/line/" => "influxdb/v#{release}/write_protocols/line_protocol_tutorial/",
  27. "influxdb/v#{release}/write_protocols/graphite/" => "influxdb/v#{release}/tools/graphite/",
  28. "influxdb/v#{release}/clients/api/" => "influxdb/v#{release}/tools/api_client_libraries/",
  29. "influxdb/v#{release}/concepts/010_vs_011/" => "influxdb/v#{release}/administration/differences/",
  30. "influxdb/v#{release}/write_protocols/write_syntax/" => "influxdb/v#{release}/write_protocols/line_protocol_reference/",
  31. "influxdb/v#{release}/write_protocols/udp/" => "influxdb/v#{release}/tools/udp/"
  32. }
  33. options[:fix_urls] = ->(url) do
  34. url.sub! %r{/influxdb/v([\d\.]+)/.+/influxdb/v[\d\.]+/}, '/influxdb/v\1/'
  35. url
  36. end
  37. options[:attribution] = <<-HTML
  38. &copy; 2015 InfluxData, Inc.<br>
  39. Licensed under the MIT license.
  40. HTML
  41. def get_latest_version(opts)
  42. doc = fetch_doc('https://docs.influxdata.com/influxdb/', opts)
  43. label = doc.at_css('.navbar--current-product').content.strip
  44. label.scan(/([0-9.]+)/)[0][0]
  45. end
  46. end
  47. end