cypress.rb 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # frozen_string_literal: true
  2. module Docs
  3. class Cypress < UrlScraper
  4. self.name = 'Cypress'
  5. self.type = 'cypress'
  6. self.release = '5.6.0'
  7. self.base_url = 'https://docs.cypress.io'
  8. self.root_path = '/api/api/table-of-contents.html'
  9. self.links = {
  10. home: 'https://www.cypress.io/',
  11. code: 'https://github.com/cypress-io/cypress',
  12. }
  13. html_filters.push 'cypress/entries', 'cypress/clean_html'
  14. options[:container] = '#content'
  15. options[:max_image_size] = 300_000
  16. options[:include_default_entry] = true
  17. options[:skip_patterns] = [
  18. /examples\//,
  19. /guides/
  20. ]
  21. options[:skip_link] = ->(link) {
  22. href = link.attr(:href)
  23. href.nil? ? true : EntriesFilter::SECTIONS.none? { |section| href.match?("/#{section}/") }
  24. }
  25. options[:attribution] = <<-HTML
  26. &copy; 2020 Cypress.io<br>
  27. Licensed under the MIT License.
  28. HTML
  29. def get_latest_version(opts)
  30. get_latest_github_release('cypress-io', 'cypress', opts)
  31. end
  32. end
  33. end