1
0

cordova.rb 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. module Docs
  2. class Cordova < UrlScraper
  3. self.name = 'Cordova'
  4. self.type = 'cordova'
  5. self.root_path = 'guide/overview/index.html'
  6. self.links = {
  7. home: 'https://cordova.apache.org/',
  8. code: 'https://github.com/apache/cordova'
  9. }
  10. html_filters.push 'cordova/entries', 'cordova/clean_html'
  11. options[:container] = '.docs'
  12. options[:skip] = %w(index.html)
  13. options[:fix_urls] = ->(url) do
  14. if url.include?('https://cordova.apache.org/docs') && !url.end_with?('.html')
  15. if url.end_with?('/')
  16. url << 'index.html'
  17. else
  18. url << '/index.html'
  19. end
  20. end
  21. end
  22. options[:attribution] = <<-HTML
  23. &copy; 2012, 2013, 2015 The Apache Software Foundation<br>
  24. Licensed under the Apache License 2.0.
  25. HTML
  26. version '9' do
  27. self.release = '9.0.0'
  28. self.base_url = "https://cordova.apache.org/docs/en/#{self.version}.x/"
  29. end
  30. version '8' do
  31. self.release = '8.1.2'
  32. self.base_url = "https://cordova.apache.org/docs/en/#{self.version}.x/"
  33. end
  34. version '7' do
  35. self.release = '7.1.0'
  36. self.base_url = "https://cordova.apache.org/docs/en/#{self.version}.x/"
  37. end
  38. version '6' do
  39. self.release = '6.5.0'
  40. self.base_url = "https://cordova.apache.org/docs/en/#{self.version}.x/"
  41. end
  42. def get_latest_version(opts)
  43. doc = fetch_doc('https://cordova.apache.org/docs/en/latest/', opts)
  44. label = doc.at_css('#versionDropdown').content.strip
  45. version = label.scan(/([0-9.]+)/)[0][0]
  46. version = version[0...-1] if version.end_with?('.')
  47. version
  48. end
  49. end
  50. end