Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/docs/scrapers/haskell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,9 @@ class Haskell < UrlScraper
end

def get_latest_version(opts)
doc = fetch_doc('https://www.haskell.org/ghc/download.html', opts)
links = doc.css('a').to_a
versions = links.map {|link| link.content.scan(/\A([0-9.]+)\Z/)}
versions.find {|version| !version.empty?}[0][0]
tags = get_github_tags('ghc', 'ghc', opts)
tag = tags.find {|t| t['name'].ends_with?('-release') }['name']
tag[/ghc-(.*)-release/, 1]
end

end
Expand Down
3 changes: 1 addition & 2 deletions lib/docs/scrapers/love.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ class Love < UrlScraper
HTML

def get_latest_version(opts)
doc = fetch_doc('https://love2d.org/wiki/Version_History', opts)
doc.at_css('#mw-content-text table a').content
get_github_tags('love2d', 'love', opts).first['name']
end
end
end
4 changes: 1 addition & 3 deletions lib/docs/scrapers/mongoose.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ class Mongoose < UrlScraper
HTML

def get_latest_version(opts)
doc = fetch_doc('https://mongoosejs.com/docs/', opts)
label = doc.at_css('.pure-menu-link').content.strip
label.sub(/Version /, '')
get_github_tags('Automattic', 'mongoose', opts).find {|t| t['name'].starts_with?(/\d/)}['name']
end
end
end
4 changes: 2 additions & 2 deletions lib/docs/scrapers/tensorflow/tensorflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class Tensorflow < UrlScraper
end

def get_latest_version(opts)
doc = fetch_doc(self.base_url, opts)
doc.title[/TensorFlow v([.\d]+)/, 1]
tag = get_github_tags('tensorflow', 'tensorflow', opts).find { |t| !t['name'].include?('-rc') }
tag['name'][1..-1]
end

private
Expand Down
8 changes: 4 additions & 4 deletions lib/docs/scrapers/threejs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ class Threejs < UrlScraper
self.base_url = "https://threejs.org/docs"

def get_latest_version(opts)
get_latest_github_release('mrdoob', 'three.js', opts)[1..]
get_github_tags('mrdoob', 'three.js', opts).first['name'][1..]
end

def initial_paths
paths = []
url = 'https://threejs.org/docs/list.json'
url = 'https://threejs.org/docs/search.json'
response = Request.run(url)
json_data = JSON.parse(response.body)

# Process both API and manual sections
process_documentation(json_data['en'], paths)
process_documentation(json_data, paths)
paths
end

Expand All @@ -78,4 +78,4 @@ def process_documentation(data, paths, prefix = '')
end
end
end
end
end
Loading