The default blueprint for ember-cli addons.

npm install ember-git-data@0.1.5


Ember Git Data

Minimal wrapper for git-data.js. For API info, please see git-data.js's docs.


$ ember install ember-git-data


Extend the Ember.Service that comes with this addon, and provide your GitHub access token:

// app/services/github.js
import Ember from 'ember'
import GitHub from 'ember-git-data/services/github'

const {
  inject: { service },
  computed: { readOnly },
} = Ember

// don't forget to extend!
export default GitHub.extend({
  session: service(),
  token: readOnly('session.accessToken'),

You can now create as many Repo objects as you wish. Often, you will want to return the Repo object as part of an Ember.Route's model hook:

// app/routes/index.js
import Ember from 'ember'

const {
  inject: { service },
} = Ember

export default Ember.Route.extend({
  github: service(),

  async model() {
    const g = get(this, 'github')
    const repo = g.repo({
      owner: 'nucleartide',
      repo: 'ember-git-data',
      branch: 'master',

    try {
      const packageJson = async repo.readFile('package.json')
      return { packageJson, repo }
    } catch (err) {
      // ...

  actions: {
    doStuffWithRepo() {
      const { repo } = this.modelFor(this.routeName)
      // ...

The Repo object is now cached while a user is visiting the route, and you can perform any actions you wish. (Also, the async/await syntax should "just work". Open an issue if I'm wrong!)


Why not use Ember Data?

Ember Data is great, and git-data.js could have easily been implemented as Ember Data models/adapters/serializers. I wanted to decouple git-data.js from Ember Data though, and make it usable in non-Ember environments.

Why not extend ember-data-github?

git-data.js focuses solely on GitHub's Git Data API. ember-data-github seems to have a broader focus.