-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[hhvm] #1499 - update hhvm service #1508
Changes from 4 commits
0451dc1
c7e065a
d915f0c
473b6a3
403ed79
d515421
2e417aa
ea79b22
fcf8421
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1300,12 +1300,9 @@ cache(function(data, match, sendBadge, request) { | |
var user = match[1]; // eg, `symfony/symfony`. | ||
var branch = match[2];// eg, `/2.4.0.0`. | ||
var format = match[3]; | ||
var apiUrl = 'http://hhvm.h4cc.de/badge/' + user + '.json'; | ||
if (branch) { | ||
// Remove the leading slash. | ||
apiUrl += '?branch=' + branch.slice(1); | ||
} | ||
var apiUrl = 'https://php-eye.com/api/v1/package/'+user+'.json'; | ||
var badgeData = getBadgeData('hhvm', data); | ||
branch = branch || 'dev-master'; | ||
request(apiUrl, function dealWithData(err, res, buffer) { | ||
if (err != null) { | ||
badgeData.text[1] = 'inaccessible'; | ||
|
@@ -1314,18 +1311,33 @@ cache(function(data, match, sendBadge, request) { | |
} | ||
try { | ||
var data = JSON.parse(buffer); | ||
var status = data.hhvm_status; | ||
if (status === 'not_tested') { | ||
badgeData.colorscheme = 'red'; | ||
badgeData.text[1] = 'not tested'; | ||
} else if (status === 'partial') { | ||
badgeData.colorscheme = 'yellow'; | ||
badgeData.text[1] = 'partially tested'; | ||
} else if (status === 'tested') { | ||
badgeData.colorscheme = 'brightgreen'; | ||
badgeData.text[1] = 'tested'; | ||
} else { | ||
badgeData.text[1] = 'maybe untested'; | ||
var verInfo = {}; | ||
for (var i = 0, count = data.versions.length; i < count; i++) { | ||
verInfo = data.versions[i]; | ||
if (verInfo.name == branch) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you use a strict comparison here please (triple equals) |
||
switch (verInfo.travis.hhvm) { | ||
case 0: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This switch statement would be easier to read if the cases were indented by a block (sorry to leave feedback on indenting :( this should really be picked up by a linting rule!) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will do (I copy/pasted a switch statement from elsewhere in the code) |
||
// unknown/no config file | ||
badgeData.text[1] = 'maybe untested'; | ||
break; | ||
case 1: | ||
// not tested | ||
badgeData.colorscheme = 'red'; | ||
badgeData.text[1] = 'not tested'; | ||
break; | ||
case 2: | ||
// allowed failure | ||
badgeData.colorscheme = 'yellow'; | ||
badgeData.text[1] = 'partially tested'; | ||
break; | ||
case 3: | ||
// tested` | ||
badgeData.colorscheme = 'brightgreen'; | ||
badgeData.text[1] = 'tested'; | ||
break; | ||
} | ||
break; | ||
} | ||
} | ||
sendBadge(format, badgeData); | ||
} catch(e) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the variable declarations to use the ES6 style
let
andconst
as applicable while you're working on this code.