1
0

r.rb 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. module Docs
  2. class R < FileScraper
  3. self.name = 'R'
  4. self.slug = 'r'
  5. self.type = 'simple'
  6. self.release = '4.1.0'
  7. self.links = {
  8. home: 'https://www.r-project.org/',
  9. code: 'https://svn.r-project.org/R/'
  10. }
  11. self.root_path = 'doc/html/packages.html'
  12. html_filters.push 'r/entries', 'r/clean_html'
  13. options[:skip_links] = false
  14. options[:attribution] = <<-HTML
  15. Copyright (&copy;) 1999–2012 R Foundation for Statistical Computing.<br>
  16. Licensed under the <a href="https://www.gnu.org/copyleft/gpl.html">GNU General Public License</a>.
  17. HTML
  18. # Never want those
  19. options[:skip_patterns] = [
  20. /\/DESCRIPTION$/,
  21. /\/NEWS(\.[^\/]*)?$/,
  22. /\/doc\/index\.html$/,
  23. /\/demo$/,
  24. /\.pdf$/
  25. ]
  26. options[:replace_paths] = {
  27. ## We want to fix links like so − but only if the targets don’t exist:
  28. # 'library/MASS/html/cov.mve.html' => 'library/MASS/html/cov.rob.html'
  29. ## Paths for target packages or keywords that do not have their own file
  30. ## are generated in the entries filter from 00Index.html files
  31. }
  32. options[:skip] = %w(
  33. doc/html/packages-head-utf8.html
  34. doc/html/SearchOn.html
  35. doc/html/Search.html
  36. doc/html/UserManuals.html
  37. doc/html/faq.html
  38. doc/manual/R-FAQ.html
  39. doc/manual/R-admin.html
  40. doc/manual/R-exts.html
  41. doc/manual/R-ints.html
  42. doc/manual/R-lang.html
  43. )
  44. def get_latest_version(opts)
  45. body = fetch('https://cran.r-project.org/src/base/NEWS', opts)
  46. body.match(/CHANGES IN R ([\d.]+):/)[1]
  47. end
  48. end
  49. end