{"action":"created","comment":{"url":"https://api.github.com/repos/badges/shields/pulls/comments/26707812","id":26707812,"diff_hunk":"@@ -2257,26 +2259,121 @@ cache(function(data, match, sendBadge, request) {\n       return;\n     }\n     try {\n-      var unstable = function(ver) {\n-        return /-[0-9A-Za-z.-]+(?:\\+[0-9A-Za-z.-]+)?$/.test(ver);\n-      };\n-      var releases = json[userRepo];\n-      if (releases.length == 0) {\n-        badgeData.text[1] = 'none';\n-        badgeData.colorscheme = 'lightgrey';\n-        sendBadge(format, badgeData);\n-        return;\n+      if (info === 'v') {\n+        var unstable = function(ver) {\n+          return /-[0-9A-Za-z.-]+(?:\\+[0-9A-Za-z.-]+)?$/.test(ver);\n+        };\n+        var releases = json['releases'];\n+        if (releases.length === 0) {\n+          badgeData.text[1] = 'none';\n+          badgeData.colorscheme = 'lightgrey';\n+          sendBadge(format, badgeData);\n+          return;\n+        }\n+        var versions = releases.map(function(version) {\n+          return version.version;\n+        });\n+        var version = latestVersion(versions);\n+        if (unstable(version)) {\n+          badgeData.colorscheme = \"yellow\";\n+        } else {\n+          badgeData.colorscheme = \"blue\";\n+        }\n+        badgeData.text[1] = \"v\" + version;\n+      } else if (info === 'dt') {\n+        var total = json['downloads'];\n+        if (total === 0) {\n+          badgeData.colorscheme = 'red';\n+        } else if (total < 100) {\n+          badgeData.colorscheme = 'yellow';\n+        } else if (total < 1000) {\n+          badgeData.colorscheme = 'yellowgreen';\n+        } else if (total < 10000) {\n+          badgeData.colorscheme = 'green';\n+        } else {\n+          badgeData.colorscheme = 'brightgreen';","path":"server.js","position":67,"original_position":67,"commit_id":"912188c9d21408dcb04a6985196c76c62ca4cd90","original_commit_id":"912188c9d21408dcb04a6985196c76c62ca4cd90","user":{"login":"espadrine","id":100689,"avatar_url":"https://avatars.githubusercontent.com/u/100689?v=3","gravatar_id":"","url":"https://api.github.com/users/espadrine","html_url":"https://github.com/espadrine","followers_url":"https://api.github.com/users/espadrine/followers","following_url":"https://api.github.com/users/espadrine/following{/other_user}","gists_url":"https://api.github.com/users/espadrine/gists{/gist_id}","starred_url":"https://api.github.com/users/espadrine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/espadrine/subscriptions","organizations_url":"https://api.github.com/users/espadrine/orgs","repos_url":"https://api.github.com/users/espadrine/repos","events_url":"https://api.github.com/users/espadrine/events{/privacy}","received_events_url":"https://api.github.com/users/espadrine/received_events","type":"User","site_admin":false},"body":"Oh, that would be great! There isn't at the moment, but you're welcome to do it. All those functions are defined at the bottom, around line 3040.","created_at":"2015-03-18T21:08:22Z","updated_at":"2015-03-18T21:08:22Z","html_url":"https://github.com/badges/shields/pull/375#discussion_r26707812","pull_request_url":"https://api.github.com/repos/badges/shields/pulls/375","_links":{"self":{"href":"https://api.github.com/repos/badges/shields/pulls/comments/26707812"},"html":{"href":"https://github.com/badges/shields/pull/375#discussion_r26707812"},"pull_request":{"href":"https://api.github.com/repos/badges/shields/pulls/375"}}},"pull_request":{"url":"https://api.github.com/repos/badges/shields/pulls/375","id":29890048,"html_url":"https://github.com/badges/shields/pull/375","diff_url":"https://github.com/badges/shields/pull/375.diff","patch_url":"https://github.com/badges/shields/pull/375.patch","issue_url":"https://api.github.com/repos/badges/shields/issues/375","number":375,"state":"open","locked":false,"title":"Improve Puppet Forge badges","user":{"login":"raphink","id":650430,"avatar_url":"https://avatars.githubusercontent.com/u/650430?v=3","gravatar_id":"","url":"https://api.github.com/users/raphink","html_url":"https://github.com/raphink","followers_url":"https://api.github.com/users/raphink/followers","following_url":"https://api.github.com/users/raphink/following{/other_user}","gists_url":"https://api.github.com/users/raphink/gists{/gist_id}","starred_url":"https://api.github.com/users/raphink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphink/subscriptions","organizations_url":"https://api.github.com/users/raphink/orgs","repos_url":"https://api.github.com/users/raphink/repos","events_url":"https://api.github.com/users/raphink/events{/privacy}","received_events_url":"https://api.github.com/users/raphink/received_events","type":"User","site_admin":false},"body":"This PR:\r\n\r\n* Rebases the Puppet Forge code on the v3 API\r\n* Retrieves additional infos from the Forge API:\r\n\r\n  - 'dt': total downloads of a module\r\n  - 'e': endorsement of a module (approved/supported)\r\n  - 'f': feedback score (percentage)\r\n* Add user statistics from the Forge API:\r\n\r\n  - 'rc': user's release count\r\n  - 'mc': user's module count","created_at":"2015-02-24T11:36:56Z","updated_at":"2015-03-18T21:08:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4cf94b16f5e0c891fed4c6c56c724d84d984be16","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/badges/shields/pulls/375/commits","review_comments_url":"https://api.github.com/repos/badges/shields/pulls/375/comments","review_comment_url":"https://api.github.com/repos/badges/shields/pulls/comments{/number}","comments_url":"https://api.github.com/repos/badges/shields/issues/375/comments","statuses_url":"https://api.github.com/repos/badges/shields/statuses/912188c9d21408dcb04a6985196c76c62ca4cd90","head":{"label":"raphink:dev/puppetforge","ref":"dev/puppetforge","sha":"912188c9d21408dcb04a6985196c76c62ca4cd90","user":{"login":"raphink","id":650430,"avatar_url":"https://avatars.githubusercontent.com/u/650430?v=3","gravatar_id":"","url":"https://api.github.com/users/raphink","html_url":"https://github.com/raphink","followers_url":"https://api.github.com/users/raphink/followers","following_url":"https://api.github.com/users/raphink/following{/other_user}","gists_url":"https://api.github.com/users/raphink/gists{/gist_id}","starred_url":"https://api.github.com/users/raphink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphink/subscriptions","organizations_url":"https://api.github.com/users/raphink/orgs","repos_url":"https://api.github.com/users/raphink/repos","events_url":"https://api.github.com/users/raphink/events{/privacy}","received_events_url":"https://api.github.com/users/raphink/received_events","type":"User","site_admin":false},"repo":{"id":31231770,"name":"shields","full_name":"raphink/shields","owner":{"login":"raphink","id":650430,"avatar_url":"https://avatars.githubusercontent.com/u/650430?v=3","gravatar_id":"","url":"https://api.github.com/users/raphink","html_url":"https://github.com/raphink","followers_url":"https://api.github.com/users/raphink/followers","following_url":"https://api.github.com/users/raphink/following{/other_user}","gists_url":"https://api.github.com/users/raphink/gists{/gist_id}","starred_url":"https://api.github.com/users/raphink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphink/subscriptions","organizations_url":"https://api.github.com/users/raphink/orgs","repos_url":"https://api.github.com/users/raphink/repos","events_url":"https://api.github.com/users/raphink/events{/privacy}","received_events_url":"https://api.github.com/users/raphink/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/raphink/shields","description":"Shields badge specification, website and default API server","fork":true,"url":"https://api.github.com/repos/raphink/shields","forks_url":"https://api.github.com/repos/raphink/shields/forks","keys_url":"https://api.github.com/repos/raphink/shields/keys{/key_id}","collaborators_url":"https://api.github.com/repos/raphink/shields/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/raphink/shields/teams","hooks_url":"https://api.github.com/repos/raphink/shields/hooks","issue_events_url":"https://api.github.com/repos/raphink/shields/issues/events{/number}","events_url":"https://api.github.com/repos/raphink/shields/events","assignees_url":"https://api.github.com/repos/raphink/shields/assignees{/user}","branches_url":"https://api.github.com/repos/raphink/shields/branches{/branch}","tags_url":"https://api.github.com/repos/raphink/shields/tags","blobs_url":"https://api.github.com/repos/raphink/shields/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/raphink/shields/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/raphink/shields/git/refs{/sha}","trees_url":"https://api.github.com/repos/raphink/shields/git/trees{/sha}","statuses_url":"https://api.github.com/repos/raphink/shields/statuses/{sha}","languages_url":"https://api.github.com/repos/raphink/shields/languages","stargazers_url":"https://api.github.com/repos/raphink/shields/stargazers","contributors_url":"https://api.github.com/repos/raphink/shields/contributors","subscribers_url":"https://api.github.com/repos/raphink/shields/subscribers","subscription_url":"https://api.github.com/repos/raphink/shields/subscription","commits_url":"https://api.github.com/repos/raphink/shields/commits{/sha}","git_commits_url":"https://api.github.com/repos/raphink/shields/git/commits{/sha}","comments_url":"https://api.github.com/repos/raphink/shields/comments{/number}","issue_comment_url":"https://api.github.com/repos/raphink/shields/issues/comments{/number}","contents_url":"https://api.github.com/repos/raphink/shields/contents/{+path}","compare_url":"https://api.github.com/repos/raphink/shields/compare/{base}...{head}","merges_url":"https://api.github.com/repos/raphink/shields/merges","archive_url":"https://api.github.com/repos/raphink/shields/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/raphink/shields/downloads","issues_url":"https://api.github.com/repos/raphink/shields/issues{/number}","pulls_url":"https://api.github.com/repos/raphink/shields/pulls{/number}","milestones_url":"https://api.github.com/repos/raphink/shields/milestones{/number}","notifications_url":"https://api.github.com/repos/raphink/shields/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/raphink/shields/labels{/name}","releases_url":"https://api.github.com/repos/raphink/shields/releases{/id}","created_at":"2015-02-23T21:52:39Z","updated_at":"2015-02-23T21:52:39Z","pushed_at":"2015-03-09T14:44:03Z","git_url":"git://github.com/raphink/shields.git","ssh_url":"git@github.com:raphink/shields.git","clone_url":"https://github.com/raphink/shields.git","svn_url":"https://github.com/raphink/shields","homepage":"http://shields.io","size":2932,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"badges:master","ref":"master","sha":"6155078bec4cd5d5ee90753f473395c75557fe45","user":{"login":"badges","id":6254238,"avatar_url":"https://avatars.githubusercontent.com/u/6254238?v=3","gravatar_id":"","url":"https://api.github.com/users/badges","html_url":"https://github.com/badges","followers_url":"https://api.github.com/users/badges/followers","following_url":"https://api.github.com/users/badges/following{/other_user}","gists_url":"https://api.github.com/users/badges/gists{/gist_id}","starred_url":"https://api.github.com/users/badges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/badges/subscriptions","organizations_url":"https://api.github.com/users/badges/orgs","repos_url":"https://api.github.com/users/badges/repos","events_url":"https://api.github.com/users/badges/events{/privacy}","received_events_url":"https://api.github.com/users/badges/received_events","type":"Organization","site_admin":false},"repo":{"id":7910045,"name":"shields","full_name":"badges/shields","owner":{"login":"badges","id":6254238,"avatar_url":"https://avatars.githubusercontent.com/u/6254238?v=3","gravatar_id":"","url":"https://api.github.com/users/badges","html_url":"https://github.com/badges","followers_url":"https://api.github.com/users/badges/followers","following_url":"https://api.github.com/users/badges/following{/other_user}","gists_url":"https://api.github.com/users/badges/gists{/gist_id}","starred_url":"https://api.github.com/users/badges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/badges/subscriptions","organizations_url":"https://api.github.com/users/badges/orgs","repos_url":"https://api.github.com/users/badges/repos","events_url":"https://api.github.com/users/badges/events{/privacy}","received_events_url":"https://api.github.com/users/badges/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/badges/shields","description":"Shields badge specification, website and default API server","fork":false,"url":"https://api.github.com/repos/badges/shields","forks_url":"https://api.github.com/repos/badges/shields/forks","keys_url":"https://api.github.com/repos/badges/shields/keys{/key_id}","collaborators_url":"https://api.github.com/repos/badges/shields/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/badges/shields/teams","hooks_url":"https://api.github.com/repos/badges/shields/hooks","issue_events_url":"https://api.github.com/repos/badges/shields/issues/events{/number}","events_url":"https://api.github.com/repos/badges/shields/events","assignees_url":"https://api.github.com/repos/badges/shields/assignees{/user}","branches_url":"https://api.github.com/repos/badges/shields/branches{/branch}","tags_url":"https://api.github.com/repos/badges/shields/tags","blobs_url":"https://api.github.com/repos/badges/shields/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/badges/shields/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/badges/shields/git/refs{/sha}","trees_url":"https://api.github.com/repos/badges/shields/git/trees{/sha}","statuses_url":"https://api.github.com/repos/badges/shields/statuses/{sha}","languages_url":"https://api.github.com/repos/badges/shields/languages","stargazers_url":"https://api.github.com/repos/badges/shields/stargazers","contributors_url":"https://api.github.com/repos/badges/shields/contributors","subscribers_url":"https://api.github.com/repos/badges/shields/subscribers","subscription_url":"https://api.github.com/repos/badges/shields/subscription","commits_url":"https://api.github.com/repos/badges/shields/commits{/sha}","git_commits_url":"https://api.github.com/repos/badges/shields/git/commits{/sha}","comments_url":"https://api.github.com/repos/badges/shields/comments{/number}","issue_comment_url":"https://api.github.com/repos/badges/shields/issues/comments{/number}","contents_url":"https://api.github.com/repos/badges/shields/contents/{+path}","compare_url":"https://api.github.com/repos/badges/shields/compare/{base}...{head}","merges_url":"https://api.github.com/repos/badges/shields/merges","archive_url":"https://api.github.com/repos/badges/shields/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/badges/shields/downloads","issues_url":"https://api.github.com/repos/badges/shields/issues{/number}","pulls_url":"https://api.github.com/repos/badges/shields/pulls{/number}","milestones_url":"https://api.github.com/repos/badges/shields/milestones{/number}","notifications_url":"https://api.github.com/repos/badges/shields/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/badges/shields/labels{/name}","releases_url":"https://api.github.com/repos/badges/shields/releases{/id}","created_at":"2013-01-30T07:41:54Z","updated_at":"2015-03-18T17:56:32Z","pushed_at":"2015-03-05T12:59:00Z","git_url":"git://github.com/badges/shields.git","ssh_url":"git@github.com:badges/shields.git","clone_url":"https://github.com/badges/shields.git","svn_url":"https://github.com/badges/shields","homepage":"http://shields.io","size":6115,"stargazers_count":1392,"watchers_count":1392,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":175,"mirror_url":null,"open_issues_count":64,"forks":175,"open_issues":64,"watchers":1392,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/badges/shields/pulls/375"},"html":{"href":"https://github.com/badges/shields/pull/375"},"issue":{"href":"https://api.github.com/repos/badges/shields/issues/375"},"comments":{"href":"https://api.github.com/repos/badges/shields/issues/375/comments"},"review_comments":{"href":"https://api.github.com/repos/badges/shields/pulls/375/comments"},"review_comment":{"href":"https://api.github.com/repos/badges/shields/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/badges/shields/pulls/375/commits"},"statuses":{"href":"https://api.github.com/repos/badges/shields/statuses/912188c9d21408dcb04a6985196c76c62ca4cd90"}}}}