npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-travis-status

v0.2.0

Published

Retrieve the build status of any Travis CI public repo in an Ember app or addon

Downloads

7

Readme

Ember-travis-status Build Status

This Ember addon provides you with utilities for retrieving the build status of any public Travis CI repo and components to show dynamic content based on the returned status.

Build statuses are cached in the app session to avoid unnecessary API calls.

Contents

Installation

ember install ember-travis-status

Since this addon makes requests to the travis-ci API, make sure to add it to your Content Security Policy:

// config/environment.js
module.exports = function(environment) {
  var ENV = {
    contentSecurityPolicy: {
      "connect-src": "'self' api.travis-ci.org",
      "frame-src": "'self' api.travis-ci.org travis-ci.org",
      "object-src": "'self' travis-ci.org",
      "style-src": "'self' 'unsafe-inline'",
    }
  };
  return ENV;
};

Utilities

All components in this addon call a single utility, which can be used independently: getTravisStatus().

getTravisStatus

getTravisStatus() expects a single param, repo, which is the username/repo-name combo Travis uses to identify repos.

It returns a string of the build status of any public repo. Current values returned are:

  • 'passing' - The latest build is passing
  • 'failing' - The latest build is failing
  • 'error' - The latest build could not complete due to an error
  • 'no build available' - There were no builds returned by the Travis API
  • 'unknown' - There was an issue with the Travis API response or some other error
import getTravisStatus from 'ember-travis-status/utils/get-travis-status';

getTravisStatus('sir-dunxalot/ember-modals'); // 'passing'
// or
getTravisStatus('emberjs/emberjs-build'); // 'passing'
// or
getTravisStatus('sir-dunxalot/some-fake-repo'); // 'no build available'

| | Name | Type | Description | | |---------|-----------------|--------|----------------------------------------------------------------------------------------------------------------------------------------|---| | Method | getTravisStatus | N/A | A utility to get the travis status of the latest build for any public Travis CI repo | | | Param | repo | String | The username/repo-name that identifies the public Travis CI repo | | | Returns | status | String | The latest build status for the repo. Currently supported values are 'passing', 'failing', 'error' (build error), 'no build available' (no builds returned by the Travis API), or 'unknown' | |

Components

Travis Badge

This component displays the common Travis badge for any repo. An example is shown at the top of this README. The SVG badge is loaded inside an HTML <object>.

You may pass the component repo and branch attributes:

{{travis-badge repo='sir-dunxalot/ember-modals'}}
{{!--Or--}}
{{travis-badge repo='sir-dunxalot/ember-modals' branch='develop'}}

Travis Status

This component works in a similar way to the {{travis-badge}} component but will show custom HTML based on the build status retrieved by getTravisStatus().

First, setup up your template and component:

// app-name/components/travis-status.js

import TravisStatusComponent from 'ember-travis-status/components/travis-status';

export default TravisStatusComponent.extend({
  tagName: 'dl',
});
{{!--app-name/templates/components/travis-status.hbs--}}

<dt class="hidden">Build Status for {{repo}}</dt>
<dd>
  <span class="text">{{status}}</span>

  {{#if isPassing}}
    <span class="icon-success"></span>
  {{/if}}

  {{#if isFailing}}
    <span class="icon-error"></span>
  {{/if}}
</dd>

You can see the full list of properties available inside the component here.

Then place the {{travis-status somewhere in your templates:

{{travis-status repo='sir-dunxalot/ember-modals'}}

Development

  • git clone https://github.com/sir-dunxalot/ember-travis-status.git
  • ember s
  • ember test or navigate to the /tests route