1
0

scala.rb 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. module Docs
  2. class Scala < FileScraper
  3. self.name = 'Scala'
  4. self.type = 'scala'
  5. self.links = {
  6. home: 'https://www.scala-lang.org/',
  7. code: 'https://github.com/scala/scala'
  8. }
  9. options[:attribution] = <<-HTML
  10. &copy; 2002-2022 EPFL, with contributions from Lightbend.<br>
  11. Licensed under the Apache License, Version 2.0.
  12. HTML
  13. # For Scala 3, there is no official download link for the documentation
  14. # (see https://contributors.scala-lang.org/t/5537).
  15. #
  16. # We currently need to build the docs ourselves. To do so:
  17. # 1. Make sure that Scala 3 and sbt are installed
  18. # (https://www.scala-lang.org/download/scala3.html)
  19. # 2. Clone the Scala 3 (Dotty) repository (https://github.com/lampepfl/dotty)
  20. # 3. From the Dotty folder, run this command in the terminal:
  21. # $ sbt scaladoc/generateScalaDocumentation
  22. # 4. Extract scaladoc/output/scala3/api/ into docs/scala~3.1
  23. version '3.1' do
  24. self.release = '3.1.1'
  25. self.base_url = 'https://scala-lang.org/api/3.1.1/'
  26. self.root_path = 'index.html'
  27. options[:skip_patterns] = [
  28. # Ignore class names with include “#”, which cause issues with the scraper
  29. /%23/,
  30. # Ignore local links to the Java documentation created by a Scaladoc bug
  31. /java\/lang/,
  32. ]
  33. html_filters.push 'scala/entries_v3', 'scala/clean_html_v3'
  34. end
  35. # https://downloads.lightbend.com/scala/2.13.0/scala-docs-2.13.0.zip
  36. # Extract api/scala-library into docs/scala~2.13_library
  37. version '2.13 Library' do
  38. self.release = '2.13.0'
  39. self.base_url = 'https://www.scala-lang.org/api/2.13.0/'
  40. self.root_path = 'index.html'
  41. options[:container] = '#content-container'
  42. html_filters.push 'scala/entries_v2', 'scala/clean_html_v2'
  43. end
  44. # https://downloads.lightbend.com/scala/2.13.0/scala-docs-2.13.0.zip
  45. # Extract api/scala-reflect into docs/scala~2.13_reflection
  46. version '2.13 Reflection' do
  47. self.release = '2.13.0'
  48. self.base_url = 'https://www.scala-lang.org/api/2.13.0/scala-reflect/'
  49. self.root_path = 'index.html'
  50. options[:container] = '#content-container'
  51. html_filters.push 'scala/entries_v2', 'scala/clean_html_v2'
  52. end
  53. # https://downloads.lightbend.com/scala/2.12.9/scala-docs-2.12.9.zip
  54. # Extract api/scala-library into docs/scala~2.12_library
  55. version '2.12 Library' do
  56. self.release = '2.12.9'
  57. self.base_url = 'https://www.scala-lang.org/api/2.12.9/'
  58. self.root_path = 'index.html'
  59. options[:container] = '#content-container'
  60. html_filters.push 'scala/entries_v2', 'scala/clean_html_v2'
  61. end
  62. # https://downloads.lightbend.com/scala/2.12.9/scala-docs-2.12.9.zip
  63. # Extract api/scala-reflect into docs/scala~2.12_reflection
  64. version '2.12 Reflection' do
  65. self.release = '2.12.9'
  66. self.base_url = 'https://www.scala-lang.org/api/2.12.9/scala-reflect/'
  67. self.root_path = 'index.html'
  68. options[:container] = '#content-container'
  69. html_filters.push 'scala/entries_v2', 'scala/clean_html_v2'
  70. end
  71. def get_latest_version(opts)
  72. doc = fetch_doc('https://www.scala-lang.org/api/3.x/', opts)
  73. doc.at_css('.projectVersion').content
  74. end
  75. end
  76. end