Skip to content

Commit

Permalink
Changed name from sl-ember-model to sl-ember-store. Updated the blue …
Browse files Browse the repository at this point in the history
…print to change the generator from slmodel to model. Updated the readme to fix some bad docs
  • Loading branch information
Matthew Marcum committed Dec 2, 2014
1 parent b26640c commit 39cb9cf
Show file tree
Hide file tree
Showing 33 changed files with 110 additions and 107 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# sl-ember-model Changelog
# sl-ember-store Changelog

### 0.2.0

* [#10](https://github.com/softlayer/sl-ember-model/pull/10) Tweak README format
* [#11](https://github.com/softlayer/sl-ember-model/pull/11) Add additional details to upgrade information
* [#12](https://github.com/softlayer/sl-ember-model/pull/12) Close #9 Fixed failing test: application controller is not generated until initial route is visited
* [#13](https://github.com/softlayer/sl-ember-model/pull/13) Feature/app controller injection test
* [#16](https://github.com/softlayer/sl-ember-model/pull/16) Upgrade to ember-cli-0.1.3
* [#10](https://github.com/softlayer/sl-ember-store/pull/10) Tweak README format
* [#11](https://github.com/softlayer/sl-ember-store/pull/11) Add additional details to upgrade information
* [#12](https://github.com/softlayer/sl-ember-store/pull/12) Close #9 Fixed failing test: application controller is not generated until initial route is visited
* [#13](https://github.com/softlayer/sl-ember-store/pull/13) Feature/app controller injection test
* [#16](https://github.com/softlayer/sl-ember-store/pull/16) Upgrade to ember-cli-0.1.3

### 0.1.0

Expand Down
4 changes: 2 additions & 2 deletions CLA-CORPORATE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#### International Business machines, Inc.
##### Software Grant and Corporate Contributor License Agreement ("Agreement")

http://www.github.com/softlayer/sl-ember-model
http://www.github.com/softlayer/sl-ember-store


Thank you for your interest in IBM’s sl-ember-model project (“the Project").
Thank you for your interest in IBM’s sl-ember-store project (“the Project").
In order to clarify the intellectual property license granted with Contributions
from any person or entity, IBM must have a Contributor License Agreement (CLA)
on file that has been signed by each Contributor, indicating agreement to the
Expand Down
4 changes: 2 additions & 2 deletions CLA-INDIVIDUAL.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#### International Business Machines, Inc. (IBM)
##### Individual Contributor License Agreement ("Agreement")

http://www.github.com/softlayer/sl-ember-model
http://www.github.com/softlayer/sl-ember-store

Thank you for your interest in the sl-ember-model project ("the Project").
Thank you for your interest in the sl-ember-store project ("the Project").

In order to clarify the intellectual property license granted with Contributions
from any person or entity, IBM must have a Contributor License Agreement ("CLA")
Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ There are many ways to contribute to the project, including fixing issues or imp

# Questions

This is the issue tracker for `sl-ember-model`. The community uses this site to collect and track bugs and discussions of
new features. If you are having difficulties using `sl-ember-model` or have a question about usage please ask a question
on Stack Overflow: http://stackoverflow.com/questions/ask?tags=sl-ember-model
This is the issue tracker for `sl-ember-store`. The community uses this site to collect and track bugs and discussions of
new features. If you are having difficulties using `sl-ember-store` or have a question about usage please ask a question
on Stack Overflow: http://stackoverflow.com/questions/ask?tags=sl-ember-store

# Issues

Expand All @@ -21,10 +21,10 @@ Think you've found a bug or have a new feature to suggest? Let us know!
3. Provide a demo that specifically shows the problem. This demo should be fully operational with the exception of the
bug you want to demonstrate. The more pared down, the better. Issues with demos are prioritized.

4. Your issue will be verified. The provided demo will be tested for correctness. The sl-ember-model team will work with
4. Your issue will be verified. The provided demo will be tested for correctness. The sl-ember-store team will work with
you until your issue can be verified.

5. Keep up to date with feedback from the sl-ember-model team on your ticket. Your ticket may be closed if it becomes
5. Keep up to date with feedback from the sl-ember-store team on your ticket. Your ticket may be closed if it becomes
stale.

6. If possible, submit a Pull Request with a failing test. Better yet, take
Expand All @@ -51,7 +51,7 @@ more work to do than time to do it. If you can write some code then that will sp
# Pull Requests

## Contributer License Agreement
Contributions to the sl-ember-model project require the submission of a contributer license agreement. Individual
Contributions to the sl-ember-store project require the submission of a contributer license agreement. Individual
contributers should review and complete the [Individual CLA](CLA-INDIVIDUAL.md). Contributions made on behalf of a
company/employer will necessitate the completion of the [Corporate CLA](CLA-CORPORATE.md).

Expand Down
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Ember CLI version: **0.1.3**

NPM package name: **sl-ember-model**
NPM package name: **sl-ember-store**

License: [MIT](LICENSE.md)

Expand All @@ -11,14 +11,14 @@ License: [MIT](LICENSE.md)

---

# What sl-ember-model is
# What sl-ember-store is

A library for managing model data in your Ember.js applications. It is designed to be agnostic to the underlying
persistence mechanism, so it works just as well with JSON APIs over HTTP as it does with streaming WebSockets or local storage.

This library **does not** support relationships or manage data state such as how Ember Data does.

What this library **DOES** do is allow you to work with models that do not have to be pre-defined. Having a dependency on [sl-ember-modelize](https://github.com/softlayer/sl-ember-modelize), this libary is able to dynamically set data returned from an endpoint onto the correct model objects without having any knowledge of the data it will be receiving.
What this library **DOES** do is allow you to work with models that do not have to be pre-defined. Having a dependency on [sl-ember-storeize](https://github.com/softlayer/sl-ember-storeize), this libary is able to dynamically set data returned from an endpoint onto the correct model objects without having any knowledge of the data it will be receiving.

---

Expand All @@ -44,25 +44,25 @@ For more information on using ember-cli, visit [http://www.ember-cli.com/](http:
## Install this addon as a Node module

```
npm install --save-dev sl-ember-model
npm install --save-dev sl-ember-store
```

## Instantiating the Store

In *sl-ember-model*, the store is responsible for managing the lifecycle of your models. Every time you need a model or a collection of models, you'll ask the store for it.
In *sl-ember-store*, the store is responsible for managing the lifecycle of your models. Every time you need a model or a collection of models, you'll ask the store for it.

To create a store, you don't need to do anything. Just by loading the *sl-ember-model* library all of the routes and
controllers in your application will get a new store property. This property is an instance of *sl-ember-model/Store* that will be shared across all of the routes and controllers in your app.
To create a store, you don't need to do anything. Just by loading the *sl-ember-store* library all of the routes and
controllers in your application will get a new store property. This property is an instance of *sl-ember-store/Store* that will be shared across all of the routes and controllers in your app.


## Defining Your Models

### Using the generator

To add a model to your project, simple do `ember g slmodel <modelname>`. You can also specify the url and/or the
To add a model to your project, simple do `ember g model <modelname>`. You can also specify the url and/or the
adapter by appending the options:

ember g slmodel <modelname> url:<url> adapter:<adapter>
ember g model <modelname> url:<url> adapter:<adapter>

More on these options later.

Expand All @@ -75,13 +75,13 @@ First create a new model in your */models* folder:
Add inside that file:

```javascript
import SlModel from 'sl-ember-model';
import Model from 'sl-ember-store/model';

var Foo = SlModel.extend({ });
var Foo = Model.extend({ });
```

## Using Adapters:
Sl-Ember-Model has two adapters out of the box: ajax and localstorage. You can specify your adapter in your model by reopening it's class:
sl-ember-store has two adapters out of the box: ajax and localstorage. You can specify your adapter in your model by reopening it's class:

```javascript
Foo.reopenClass({
Expand All @@ -91,7 +91,7 @@ Foo.reopenClass({

Models have `ajax` specified as default, so you don't need to do this unless you want to use a different adapter.

SL-Ember-Model adapters always return [Ember Promise Proxies](http://emberjs.com/api/classes/Ember.PromiseProxyMixin.html).
sl-ember-store adapters always return [Ember Promise Proxies](http://emberjs.com/api/classes/Ember.PromiseProxyMixin.html).
If you request a single object then you will get an `Ember.ObjectProxy` with the promise proxy mixin applied. Requests for
Multiple records will return an `Ember.ArrayProxy` with the promise proxiy mixin applied.

Expand Down Expand Up @@ -153,7 +153,7 @@ The `localstorage` adapter works in much the same way as the ajax adapter. It r
with the promise proxy mixin applied. In the case of errors the promise will get rejected with an error object
similar to the `ic-ajax` error object, minus the `jqXHR` key and object.

#### If you installed *sl-ember-model* as an Ember CLI Addon
#### If you installed *sl-ember-store* as an Ember CLI Addon

The localStorage adapter is initialized by default with your project's namespace.

Expand All @@ -164,15 +164,15 @@ If you want to change the default namespace then you will want to create an init
Now edit the file that was generated in `app/initializers/localstorage-initializer.js` and define the `namespace` value.

```javascript
module SlModel from 'sl-ember-model';
import LocalstorageAdapter from 'sl-ember-store/adapters/localstorage';

export default {
name: 'sl-ember-model-localstorage',
name: 'sl-ember-store-localstorage',

after: 'sl-ember-model',
after: 'sl-ember-store',

initialize: function( container ) {
var localStorageAdapter = SlModel.LocalstorageAdapter;
var localStorageAdapter = LocalstorageAdapter;

localStorageAdapter.reopenClass({
namespace: '<namespace>'
Expand All @@ -183,7 +183,7 @@ export default {
};
```

#### If you are manually importing *sl-ember-model*
#### If you are manually importing *sl-ember-store*

You will want to create an initializer:

Expand Down Expand Up @@ -293,9 +293,9 @@ application's initializers folder:

```javascript
export default {
name: 'sl-ember-model-hooks',
name: 'sl-ember-store-hooks',

after: 'sl-ember-model',
after: 'sl-ember-store',

initialize: function( container ) {
container.lookup( 'store:main' ).registerPostQueryHook(
Expand Down Expand Up @@ -328,7 +328,7 @@ Employs [Semantic Versioning 2.0.0](http://semver.org/)
---

# Copyright and License
sl-ember-model and its source files are Copyright © 2014 [SoftLayer Technologies, Inc.](http://www.softlayer.com/) The software is [MIT Licensed](LICENSE.md)
sl-ember-store and its source files are Copyright © 2014 [SoftLayer Technologies, Inc.](http://www.softlayer.com/) The software is [MIT Licensed](LICENSE.md)

---

Expand Down
6 changes: 3 additions & 3 deletions addon/adapters/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default Adapter.extend({
return icAjax.request( queryObj )
.then( function ajaxAdapterDeleteFinally( response ) {
this.runPostQueryHooks( response );
}.bind( this ) , 'sl-ember-model.ajaxAdapter:deleteRecord' );
}.bind( this ) , 'sl-ember-store.ajaxAdapter:deleteRecord' );
},

/**
Expand Down Expand Up @@ -145,7 +145,7 @@ export default Adapter.extend({
// run the modelize mixin to map keys to models
this.runPostQueryHooks( modelized );
return modelized;
}.bind( this ), null, 'sl-ember-model:save - then' )
}.bind( this ), null, 'sl-ember-store:save - then' )

.catch( function ajaxAdapterSaveCatch( jqxhr ) {
var errorData = {
Expand All @@ -157,7 +157,7 @@ export default Adapter.extend({

return errorData;

}.bind( this ), 'sl-ember-model:save - catch' );
}.bind( this ), 'sl-ember-store:save - catch' );

return promise;
}
Expand Down
10 changes: 5 additions & 5 deletions addon/adapters/localstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ var LocalStorageAdapter = Adapter.extend({

resolve( finalResult );

}.bind( this ), 'sl-ember-model.localstorageAdapter:find - Promise' )
}.bind( this ), 'sl-ember-store.localstorageAdapter:find - Promise' )

.then( function lsAdapterFindThen( response ) {
this.runPostQueryHooks( response );
return response;
}.bind( this ), 'sl-ember-model.localstorageAdapter:find - then' );
}.bind( this ), 'sl-ember-store.localstorageAdapter:find - then' );

//set the promise on the promiseProxy
results.set( 'promise', promise );
Expand Down Expand Up @@ -150,7 +150,7 @@ var LocalStorageAdapter = Adapter.extend({
.then( function lsAdapterDeleteFinally( response ) {
this.runPostQueryHooks( response );
return response;
}.bind( this ) , 'sl-ember-model.localstorageAdapter:deleteRecord - always' );
}.bind( this ) , 'sl-ember-store.localstorageAdapter:deleteRecord - always' );

return promise;
},
Expand Down Expand Up @@ -196,7 +196,7 @@ var LocalStorageAdapter = Adapter.extend({
.then( function lsAdapterSaveFinally( response ) {
this.runPostQueryHooks( response );
return response;
}.bind( this ) , 'sl-ember-model.localstorageAdapter:saveRecord - always' );
}.bind( this ) , 'sl-ember-store.localstorageAdapter:saveRecord - always' );

return promise;
},
Expand Down Expand Up @@ -318,7 +318,7 @@ var LocalStorageAdapter = Adapter.extend({
});

LocalStorageAdapter.reopenClass({
namespace: 'sl-ember-model'
namespace: 'sl-ember-store'
});

export default LocalStorageAdapter;
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import LocalstorageAdapter from '../adapters/localstorage';
*/

/*
* Register sl-ember-model objects to consuming application
* Register sl-ember-store objects to consuming application
*
* @function sl-ember-model
* @function sl-ember-store
* @param {Ember.ContainerView} container
* @param {Ember.Application} application
* @returns {void}
Expand All @@ -28,4 +28,4 @@ export default function( container, application ) {
application.inject( 'controller', 'store', 'store:main' );
application.inject( 'route', 'store', 'store:main' );
application.inject( 'adapter', 'store', 'store:main' );
}
}
6 changes: 3 additions & 3 deletions addon/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var Model = Ember.ObjectProxy.extend({
.then( function( response ) {
this.set( 'content', response );
return this;
}.bind( this ), null, 'sl-ember-model.model:save' );
}.bind( this ), null, 'sl-ember-store.model:save' );
},

/**
Expand All @@ -51,7 +51,7 @@ var Model = Ember.ObjectProxy.extend({
return this.container.lookup( 'adapter:'+this.constructor.adapter ).deleteRecord( endpoint, this.get( 'id' ) )
.then( function() {
Ember.run( this, 'destroy' );
}.bind( this ), null, 'sl-ember-model.model:deleteRecord' );
}.bind( this ), null, 'sl-ember-store.model:deleteRecord' );
}
});

Expand Down Expand Up @@ -122,7 +122,7 @@ Model.reopenClass({
* @param {string} endpoint - The endpoint, leave blank or null for default
* @param {string} action - The action, leave blank or null for default
* @param {object} data - The data to be serialized
* @param {sl-ember-model/store} store - The app's store, use to store metadata
* @param {sl-ember-store/store} store - The app's store, use to store metadata
* @throws {Ember.assert}
* @returns {Ember.Object} The serialized data
*/
Expand Down
8 changes: 0 additions & 8 deletions app/initializers/sl-ember-model.js

This file was deleted.

8 changes: 8 additions & 0 deletions app/initializers/sl-ember-store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import initializer from 'sl-ember-store/initializers/sl-ember-store';

export default {

name: 'sl-ember-store',

initialize: initializer
};
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module SlEmberModelLocalstorageAdapter from 'sl-ember-model/adapters/localstorage';
module SlEmberModelLocalstorageAdapter from 'sl-ember-store/adapters/localstorage';

export default {
name: 'sl-ember-model-localstorage',
after: 'sl-ember-model',
name: 'sl-ember-store-localstorage',
after: 'sl-ember-store',

initialize: function( container ) {
var localStorageAdapter = SlEmberModelLocalstorageAdapter.extend();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SlEmberModel from 'sl-ember-model/model';
import SlEmberModel from 'sl-ember-store/model';

var <%= classifiedModuleName %> = SlEmberModel.extend({

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test } from 'ember-qunit';
import moduleForSlEmberModel from '../../helpers/module-for-sl-ember-model';
import moduleForSlEmberModel from '../../helpers/module-for-sl-ember-store';

moduleForSlEmberModel('<%= dasherizedModuleName %>', '<%= classifiedModuleName %>', {

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "sl-ember-model",
"name": "sl-ember-store",
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "^1.11.1",
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
'use strict';

module.exports = {
name: 'sl-ember-model'
name: 'sl-ember-store'
};
Loading

0 comments on commit 39cb9cf

Please sign in to comment.