1
0

haxe.rb 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. module Docs
  2. class Haxe < UrlScraper
  3. self.name = 'Haxe'
  4. self.type = 'simple'
  5. self.release = '4.1.3'
  6. self.base_url = 'https://api.haxe.org/'
  7. html_filters.push 'haxe/clean_html', 'haxe/entries'
  8. options[:container] = '.span9'
  9. options[:attribution] = <<-HTML
  10. &copy; 2005&ndash;2020 Haxe Foundation<br>
  11. Licensed under a MIT license.
  12. HTML
  13. version do
  14. self.links = {
  15. home: 'https://haxe.org',
  16. code: 'https://github.com/HaxeFoundation/haxe'
  17. }
  18. options[:skip_patterns] = [/\A(?:cpp|cs|flash|java|js|neko|php|python|lua|hl|sys|eval)/i]
  19. end
  20. version 'C++' do
  21. self.base_url = 'https://api.haxe.org/cpp/'
  22. end
  23. version 'C#' do
  24. self.base_url = 'https://api.haxe.org/cs/'
  25. end
  26. version 'Flash' do
  27. self.base_url = 'https://api.haxe.org/flash/'
  28. end
  29. version 'Java' do
  30. self.base_url = 'https://api.haxe.org/java/'
  31. end
  32. version 'JavaScript' do
  33. self.base_url = 'https://api.haxe.org/js/'
  34. end
  35. version 'Neko' do
  36. self.base_url = 'https://api.haxe.org/neko/'
  37. end
  38. version 'PHP' do
  39. self.base_url = 'https://api.haxe.org/php/'
  40. end
  41. version 'Lua' do
  42. self.base_url = 'https://api.haxe.org/lua/'
  43. end
  44. version 'HashLink' do
  45. self.base_url = 'https://api.haxe.org/hl/'
  46. end
  47. version 'Sys' do
  48. self.base_url = 'https://api.haxe.org/sys/'
  49. end
  50. version 'Python' do
  51. self.base_url = 'https://api.haxe.org/python/'
  52. end
  53. version 'Eval' do
  54. self.base_url = 'https://api.haxe.org/eval/'
  55. end
  56. def get_latest_version(opts)
  57. doc = fetch_doc('https://api.haxe.org/', opts)
  58. label = doc.at_css('.container.main-content h1 > small').content
  59. label.sub(/version /, '')
  60. end
  61. end
  62. end