Skip to content
Snippets Groups Projects
Commit 22c38d34 authored by efalcy's avatar efalcy
Browse files

fix fetch of Bokeh latest "real" tags

parent bf9e3d88
Branches
Tags
No related merge requests found
Pipeline #10156 failed with stage
in 36 minutes and 55 seconds
......@@ -35,15 +35,25 @@ class Class_BokehVersion {
try {
return (new Storm_Cache())
->memoize([__CLASS__, __FUNCTION__],
function()
{
$json = Class_WebService_SimpleWebClient::getInstance()
->open_url('https://git.afi-sa.net/api/v4/projects/4/repository/tags?per_page=1&order_by=updated&sort=desc');
$version = json_decode($json, true)[0]['name'];
return $version ? $version : $this->current();
});
[$this, 'fetchLatest']);
} catch(Exception $e) {
return $this->current();
}
}
public function fetchLatest() {
$json = Class_WebService_SimpleWebClient::getInstance()
->open_url('https://git.afi-sa.net/api/v4/projects/4/repository/tags?per_page=5&order_by=updated&sort=desc');
$versions = array_filter(json_decode($json, true),
function($version)
{
return preg_match('/^[0-9]+\.[0-9]+\.[0-9]+$/',
$version['name']);
});
$version = current($versions)['name'];
return $version ? $version : $this->current();
}
}
\ No newline at end of file
......@@ -33,8 +33,8 @@ class BokehVersionTest extends ModelTestCase {
$this->_mock_http = $this->mock()
->whenCalled('open_url')
->with('https://git.afi-sa.net/api/v4/projects/4/repository/tags?per_page=1&order_by=updated&sort=desc')
->answers('[{"name":"' . $this->_next_version . '"}]');
->with('https://git.afi-sa.net/api/v4/projects/4/repository/tags?per_page=5&order_by=updated&sort=desc')
->answers('[{"name":"patin-2.3.4"}, {"name":"8.0.12-coufin"}, {"name":"' . $this->_next_version . '"}, {"name":"7.0.12"}]');
Class_WebService_SimpleWebClient::setInstance($this->_mock_http);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment