1
0

haxe.rb 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. module Docs
  2. class Haxe < UrlScraper
  3. self.name = 'Haxe'
  4. self.type = 'simple'
  5. self.release = '3.4.7'
  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;2018 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)/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. def get_latest_version(opts)
  54. doc = fetch_doc('https://api.haxe.org/', opts)
  55. label = doc.at_css('.container.main-content h1 > small').content
  56. label.sub(/version /, '')
  57. end
  58. end
  59. end