Improve get_latest_github_release

pull/986/head
Jasper van Merle 6 years ago
parent 4ce7dbcfd5
commit 7084d9f082

@ -212,7 +212,7 @@ To make life easier, there are a few utility methods that you can use in `get_la
Example: [lib/docs/scrapers/bower.rb](../lib/docs/scrapers/bower.rb)
* `get_latest_github_release(owner, repo, opts)`
Returns the latest GitHub release of the given repository ([format](https://developer.github.com/v3/repos/releases/#get-the-latest-release)).
Returns the tag name of the latest GitHub release of the given repository. If the tag name is preceeded by a "v", the "v" will be removed.
Example: [lib/docs/scrapers/jsdoc.rb](../lib/docs/scrapers/jsdoc.rb)
* `get_github_tags(owner, repo, opts)`

@ -249,7 +249,9 @@ module Docs
end
def get_latest_github_release(owner, repo, opts)
fetch_json("https://api.github.com/repos/#{owner}/#{repo}/releases/latest", opts)
release = fetch_json("https://api.github.com/repos/#{owner}/#{repo}/releases/latest", opts)
tag_name = release['tag_name']
tag_name.start_with?('v') ? tag_name[1..-1] : tag_name
end
def get_github_tags(owner, repo, opts)

@ -21,7 +21,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('Homebrew', 'brew', opts)['name']
get_latest_github_release('Homebrew', 'brew', opts)
end
end
end

@ -19,7 +19,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('jasmine', 'jasmine', opts)['name']
get_latest_github_release('jasmine', 'jasmine', opts)
end
end
end

@ -23,7 +23,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('jsdoc3', 'jsdoc', opts)['tag_name']
get_latest_github_release('jsdoc3', 'jsdoc', opts)
end
end
end

@ -51,7 +51,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('JuliaLang', 'julia', opts)['tag_name'][1..-1]
get_latest_github_release('JuliaLang', 'julia', opts)
end
end
end

@ -35,7 +35,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('knockout', 'knockout', opts)['tag_name'][1..-1]
get_latest_github_release('knockout', 'knockout', opts)
end
end
end

@ -30,7 +30,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('JetBrains', 'kotlin', opts)['tag_name'][1..-1]
get_latest_github_release('JetBrains', 'kotlin', opts)
end
end
end

@ -135,7 +135,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('laravel', 'laravel', opts)['tag_name'][1..-1]
get_latest_github_release('laravel', 'laravel', opts)
end
end
end

@ -66,7 +66,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('matplotlib', 'matplotlib', opts)['tag_name'][1..-1]
get_latest_github_release('matplotlib', 'matplotlib', opts)
end
end
end

@ -21,7 +21,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('sparklemotion', 'nokogiri', opts)['tag_name'][1..-1]
get_latest_github_release('sparklemotion', 'nokogiri', opts)
end
end
end

@ -31,7 +31,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('npm', 'cli', opts)['tag_name'][1..-1]
get_latest_github_release('npm', 'cli', opts)
end
end
end

@ -51,7 +51,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('numpy', 'numpy', opts)['tag_name'][1..-1]
get_latest_github_release('numpy', 'numpy', opts)
end
end
end

@ -20,7 +20,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('OpenTSDB', 'opentsdb', opts)['tag_name'][1..-1]
get_latest_github_release('OpenTSDB', 'opentsdb', opts)
end
end
end

@ -27,7 +27,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('photonstorm', 'phaser', opts)['tag_name'][1..-1]
get_latest_github_release('photonstorm', 'phaser', opts)
end
end
end

@ -19,7 +19,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('pygame', 'pygame', opts)['tag_name']
get_latest_github_release('pygame', 'pygame', opts)
end
end
end

@ -95,7 +95,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('rails', 'rails', opts)['name']
get_latest_github_release('rails', 'rails', opts)
end
end
end

@ -59,7 +59,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('rethinkdb', 'rethinkdb', opts)['tag_name'][1..-1]
get_latest_github_release('rethinkdb', 'rethinkdb', opts)
end
private

@ -25,7 +25,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('sass', 'libsass', opts)['tag_name']
get_latest_github_release('sass', 'libsass', opts)
end
end
end

@ -72,7 +72,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('symfony', 'symfony', opts)['tag_name'][1..-1]
get_latest_github_release('symfony', 'symfony', opts)
end
end
end

@ -57,7 +57,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('tensorflow', 'tensorflow', opts)['tag_name'][1..-1]
get_latest_github_release('tensorflow', 'tensorflow', opts)
end
private

@ -26,7 +26,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('Microsoft', 'TypeScript', opts)['tag_name'][1..-1]
get_latest_github_release('Microsoft', 'TypeScript', opts)
end
end
end

@ -34,7 +34,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('vuejs', 'vue', opts)['tag_name'][1..-1]
get_latest_github_release('vuejs', 'vue', opts)
end
end
end

@ -22,7 +22,7 @@ module Docs
HTML
def get_latest_version(opts)
get_latest_github_release('yarnpkg', 'yarn', opts)['tag_name'][1..-1]
get_latest_github_release('yarnpkg', 'yarn', opts)
end
end
end

@ -36,7 +36,7 @@ module Docs
end
def get_latest_version(opts)
get_latest_github_release('yiisoft', 'yii2', opts)['tag_name']
get_latest_github_release('yiisoft', 'yii2', opts)
end
end
end

Loading…
Cancel
Save