node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org ยป

squid-core

SQUID Core

Device agnostic shared code for OSX and IOS.

Package include

  • Configuration files based on environment
  • Unit tests
  • Backbone's Models
  • Backbone's Collections
  • Reflux Actions
  • Reflux Stores
  • Utils:
    • Github API services wrapper
    • Logger class
    • Storage abstraction class

Dependencies

Squid is build on top of cool open source projects such as:

All data are served by the Github API.


Table of Content

Installation

This package is not intended to be used as a stand alone library but you might need to install it for development purpose with the following command:

$ npm install

Github app configuration

The application client ID and his secret are stored into a JSON file called github.json at the project's root. For obvious security reasons this file is not published. See Unit Tests' section for more details about file content.

Basic usage examples

// New Squid Core instance
var SquidCore = require('squid-core')

// Setup instance with custon settings
SquidCore.setup({
    locale:   {
        logger: false
      , github: {
          credentials: {
              client_id:     GITHUB.client_id
            , client_secret: GITHUB.client_secret
          }
        }
    }
  , envName: 'test'
})

SquidCore._VERSION // return '0.4.0'

// Get config value
SquidCore
  .getConfig('github.pagination') // return '50'

// New User model
var username = 'michael'
  , model    = SquidCore.model('user')
  , user     = new model({ name: username })

user.get('name') // return 'michael'

Unit Tests

First you need to add the ./github.json to the package root with the following content:

{
  "client_id":     "xxxx",
  "client_secret": "xxxx"
  "username":      "a-valid-gitub-username",
  "password":      "a-valid-gitub-password",
  "token":         "a-valid-oauth-token-or-false"
}

Then run the following command to perform unit tests:

$ npm test

Roadmap

See the roadmap future developments.

License

Squid is MIT licensed

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.