Last active
March 31, 2020 18:18
-
-
Save petehamilton/5494590 to your computer and use it in GitHub Desktop.
Revisions
-
petehamilton revised this gist
Mar 7, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ $background-pending-color: #47bbb3; $title-color: rgba(255, 255, 255, 1); $label-color: rgba(255, 255, 255, 0.7); .widget.widget-circle-ci-list{ background-color: $background-color; padding: 0px; -
petehamilton revised this gist
Aug 30, 2013 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,3 +17,5 @@ OR `dashing install 5494590` Then copy the CircleCI logo below into your assets folder  There is also another version for displaying one tile per project which you can see [here](https://gist.github.com/petehamilton/5494978) -
petehamilton revised this gist
Aug 30, 2013 . 3 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,6 @@ Then: OR `dashing install 5494590` Then copy the CircleCI logo below into your assets folder  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ <h1 class="title" data-bind="title"></h1> <img class="background" src="/assets/logo-circle-ci.png"> <ul class="items list-nostyle"> <li class="item" data-foreach-item="items" data-bind-class="item.widget_class"> LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
Peter Hamilton revised this gist
May 21, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,7 @@ - Get a Circle API Token from your [Account Dashboard](https://circleci.com/account/api) and set it in your environment as `CIRCLE_CI_AUTH_TOKEN` - Add the `httparty` to your Gemfile and run `bundle install` Then: 1. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` -
Peter Hamilton revised this gist
May 21, 2013 . 1 changed file with 3 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,10 +4,9 @@ ## Usage - Get a Circle API Token from your [Account Dashboard](https://circleci.com/account/api) and set it in your environment as `CIRCLE_CI_AUTH_TOKEN` - Add the `httparty` to your Gemfile and run `bundle install` Then: 1. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` 2. Copy the `circle_ci_list.rb` file into the `jobs` folder -
Peter Hamilton revised this gist
May 21, 2013 . 2 changed files with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,9 @@ Get a Circle API Token from your [Account Dashboard](https://circleci.com/account/api) and set it in your environment as `CIRCLE_CI_AUTH_TOKEN` Add the `httparty` to your Gemfile and run `bundle install` 1. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` 2. Copy the `circle_ci_list.rb` file into the `jobs` folder This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ require 'httparty' require 'digest/md5' projects = [ { user: 'MY_GITHUB_USER_OR_ORG', repo: 'XXX', branch: 'master' }, { user: 'MY_GITHUB_USER_OR_ORG', repo: 'YYY', branch: 'dev' }, ] @@ -36,6 +36,6 @@ def update_builds(project, auth_token) end SCHEDULER.every '10s', :first_in => 0 do items = projects.map{ |p| update_builds(p, ENV['CIRCLE_CI_AUTH_TOKEN']) } send_event('circle-ci-list', { items: items }) end -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,6 @@ Get a Circle API Token from your [Account Dashboard](https://circleci.com/accoun OR `dashing install 5494590` Then copy the [CircleCI Logo](https://f.cloud.github.com/assets/510845/448516/6e8d2842-b249-11e2-91b6-9a2ffcd08bb0.png into `assets/images`) into your assets folder  -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 2 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,17 +6,11 @@ Get a Circle API Token from your [Account Dashboard](https://circleci.com/account/api) and set it in your environment as `CIRCLE_CI_AUTH_TOKEN` 1. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` 2. Copy the `circle_ci_list.rb` file into the `jobs` folder OR `dashing install 5494590` Then copy the [CircleCI Logo](https://f.cloud.github.com/assets/510845/448516/6e8d2842-b249-11e2-91b6-9a2ffcd08bb0.png into `assets/images`)  -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,6 @@ $background-pending-color: #47bbb3; $title-color: rgba(255, 255, 255, 1); $label-color: rgba(255, 255, 255, 0.7); .widget.widget-circle-ci_list{ -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 92 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,92 @@ $value-color: #FFF; $background-color: #444; $background-error-color: #A31F1F; $background-passed-color: #8fb347; $background-pending-color: #47bbb3; $title-color: rgba(255, 255, 255, 1); $label-color: rgba(255, 255, 255, 0.7); $moreinfo-color: rgba(255, 255, 255, 0.7); .widget.widget-circle-ci_list{ background-color: $background-color; padding: 0px; vertical-align: top; img.background { width: 100% !important; position: absolute; left: 0; top: 30px; opacity: 0.05; } .title { color: $title-color; } ol, ul { margin: 0px; text-align: left; color: $label-color; } ol { list-style-position: inside; } li { margin-bottom: 5px; } .list-nostyle { } .items{ list-style: none; li { margin-top: 5px; &.failed { background-color: $background-error-color; } &.pending { background-color: $background-pending-color; } &.passed { background-color: $background-passed-color; } .label { display: block; color: $label-color; font-size: 20px; word-wrap: break-word; &.repo { float: left; text-align: left; padding: 5px 0px 5px 10px; } &.branch { float: left; text-align: left; padding-top: 10px; font-size: 14px; padding: 11px 0px 5px 5px; } } .avatar { float: right; text-align: right; width: 40px; } } } } -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,6 @@ OR FINALLY Copy the [CircleCI Logo](https://f.cloud.github.com/assets/510845/448516/6e8d2842-b249-11e2-91b6-9a2ffcd08bb0.png into `assets/images`)  -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ## Description [Dashing](http://shopify.github.io/dashing/) widget to show the status of builds from CircleCI. Also shows the avatar of the person who is running/breaking/passing the current build. ## Usage -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 11 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,15 +4,19 @@ ## Usage Get a Circle API Token from your [Account Dashboard](https://circleci.com/account/api) and set it in your environment as `CIRCLE_CI_AUTH_TOKEN` THEN 1. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` 2. Copy the `circle_ci_list.rb` file into the `jobs` folder OR 1. `dashing install 5494590` FINALLY Copy the CircleCI image from https://f.cloud.github.com/assets/510845/448516/6e8d2842-b249-11e2-91b6-9a2ffcd08bb0.png into `assets/images`  -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,7 @@ 4. Copy the CircleCI image from https://f.cloud.github.com/assets/510845/448516/6e8d2842-b249-11e2-91b6-9a2ffcd08bb0.png into `assets/images` OR 1. Get a Circle API Token from your [Account Dashboard](https://circleci.com/account/api) and set it in your environment as `CIRCLE_CI_AUTH_TOKEN` 2. `dashing install 5494590` 3. Copy the CircleCI image from https://f.cloud.github.com/assets/510845/448516/6e8d2842-b249-11e2-91b6-9a2ffcd08bb0.png into `assets/images` -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 10 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,17 @@ ## Description [Dashing](http://shopify.github.io/dashing/) widget to show the status of builds from CircleCI ## Usage 1. Get a Circle API Token from your [Account Dashboard](https://circleci.com/account/api) and set it in your environment as `CIRCLE_CI_AUTH_TOKEN` 2. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` 3. Copy the `circle_ci_list.rb` file into the `jobs` folder 4. Copy the CircleCI image from https://f.cloud.github.com/assets/510845/448516/6e8d2842-b249-11e2-91b6-9a2ffcd08bb0.png into `assets/images` OR 1. Get a Circle API Token from your [Account Dashboard](https://circleci.com/account/api) and set it in your environment as `CIRCLE_CI_AUTH_TOKEN` 2. `dashing install 5494590` 3. Copy the CircleCI image from https://f.cloud.github.com/assets/510845/448516/6e8d2842-b249-11e2-91b6-9a2ffcd08bb0.png into `assets/images`  -
Peter Hamilton renamed this gist
May 1, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,4 +5,9 @@ 1. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` 2. Copy the `circle_ci_list.rb` file into the `jobs` folder OR ``` dashing install 5494590 ```  -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ # CircleCI Build Statuses ## Usage 1. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` 2. Copy the `circle_ci_list.rb` file into the `jobs` folder  -
Peter Hamilton revised this gist
May 1, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,3 +2,7 @@  ## Usage 1. Copy the below coffee/scss/html files into a widget folder named `circle_ci_list` 2. Copy the `circle_ci_list.rb` file into the `jobs` folder -
Pete Hamilton revised this gist
May 1, 2013 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +0,0 @@ -
Peter Hamilton created this gist
May 1, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ # CircleCI Build Statuses  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ class Dashing.CircleCiList extends Dashing.Widget This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ require 'httparty' require 'digest/md5' PROJECTS = [ { user: 'MY_GITHUB_USER_OR_ORG', repo: 'XXX', branch: 'master' }, { user: 'MY_GITHUB_USER_OR_ORG', repo: 'YYY', branch: 'dev' }, ] def translate_status_to_class(status) statuses = { 'success' => 'passed', 'fixed' => 'passed', 'running' => 'pending', 'failed' => 'failed' } statuses[status] || 'pending' end def update_builds(project, auth_token) api_url = 'https://circleci.com/api/v1/project/%s/%s/tree/%s?circle-token=%s' api_url = api_url % [project[:user], project[:repo], project[:branch], auth_token] api_response = HTTParty.get(api_url, :headers => { "Accept" => "application/json" } ) api_json = JSON.parse(api_response.body) return {} if api_json.empty? latest_build = api_json.select{ |build| build['status'] != 'queued' }.first email_hash = Digest::MD5.hexdigest(latest_build['committer_email']) data = { repo: "#{project[:repo]}", branch: "#{latest_build['branch']}", widget_class: "#{translate_status_to_class(latest_build['status'])}", avatar_url: "http://www.gravatar.com/avatar/#{email_hash}" } return data end SCHEDULER.every '10s', :first_in => 0 do items = PROJECTS.map{ |p| update_builds(p, ENV['CIRCLE_CI_AUTH_TOKEN']) } send_event('circle-ci-list', { items: items }) end This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ f This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ <h1 class="title" data-bind="title"></h1> <img class="background" src="/assets/circle-ci-logo.png"> <ul class="items list-nostyle"> <li class="item" data-foreach-item="items" data-bind-class="item.widget_class"> <span class="label repo" data-bind="item.repo"></span> <span class="label branch" data-bind="item.branch"></span> <img class="avatar" data-bind-src="item.avatar_url" /> <div class="clearfix" /> </li> </ul>