groovy.rb 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. module Docs
  2. class Groovy < UrlScraper
  3. self.type = 'groovy'
  4. self.root_path = 'overview-summary.html'
  5. self.links = {
  6. home: 'https://groovy-lang.org/',
  7. code: 'https://github.com/apache/groovy'
  8. }
  9. html_filters.push 'groovy/clean_html', 'groovy/entries'
  10. options[:skip] = %w(
  11. index-all.html
  12. deprecated-list.html
  13. help-doc.html
  14. )
  15. options[:skip_patterns] = [
  16. /\Aindex.html/
  17. ]
  18. options[:attribution] = <<-HTML
  19. &copy; 2003-2022 The Apache Software Foundation<br>
  20. Licensed under the Apache license.
  21. HTML
  22. version '4.0' do
  23. self.release = '4.0.0'
  24. self.base_url = "https://docs.groovy-lang.org/#{self.release}/html/gapi/"
  25. end
  26. version '3.0' do
  27. self.release = '3.0.9'
  28. self.base_url = "https://docs.groovy-lang.org/#{self.release}/html/gapi/"
  29. end
  30. version '2.5' do
  31. self.release = '2.5.14'
  32. self.base_url = "https://docs.groovy-lang.org/#{self.release}/html/gapi/"
  33. end
  34. version '2.4' do
  35. self.release = '2.4.21'
  36. self.base_url = "https://docs.groovy-lang.org/#{self.release}/html/gapi/"
  37. end
  38. def get_latest_version(opts)
  39. doc = fetch_doc('https://groovy.apache.org/download.html', opts)
  40. doc.at_css('#big-download-button').content.split(' ').last
  41. end
  42. end
  43. end