forked from freeCodeCamp/devdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhaxe.rb
80 lines (62 loc) · 1.77 KB
/
haxe.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
module Docs
class Haxe < UrlScraper
self.name = 'Haxe'
self.type = 'simple'
self.release = '4.1.3'
self.base_url = 'https://api.haxe.org/'
html_filters.push 'haxe/clean_html', 'haxe/entries'
options[:container] = '.span9'
options[:attribution] = <<-HTML
© 2005–2020 Haxe Foundation<br>
Licensed under a MIT license.
HTML
version do
self.links = {
home: 'https://haxe.org',
code: 'https://github.com/HaxeFoundation/haxe'
}
options[:skip_patterns] = [/\A(?:cpp|cs|flash|java|js|neko|php|python|lua|hl|sys|eval)/i]
end
version 'C++' do
self.base_url = 'https://api.haxe.org/cpp/'
end
version 'C#' do
self.base_url = 'https://api.haxe.org/cs/'
end
version 'Flash' do
self.base_url = 'https://api.haxe.org/flash/'
end
version 'Java' do
self.base_url = 'https://api.haxe.org/java/'
end
version 'JavaScript' do
self.base_url = 'https://api.haxe.org/js/'
end
version 'Neko' do
self.base_url = 'https://api.haxe.org/neko/'
end
version 'PHP' do
self.base_url = 'https://api.haxe.org/php/'
end
version 'Lua' do
self.base_url = 'https://api.haxe.org/lua/'
end
version 'HashLink' do
self.base_url = 'https://api.haxe.org/hl/'
end
version 'Sys' do
self.base_url = 'https://api.haxe.org/sys/'
end
version 'Python' do
self.base_url = 'https://api.haxe.org/python/'
end
version 'Eval' do
self.base_url = 'https://api.haxe.org/eval/'
end
def get_latest_version(opts)
doc = fetch_doc('https://api.haxe.org/', opts)
label = doc.at_css('.container.main-content h1 > small').content
label.sub(/version /, '')
end
end
end