-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix cannot helper * Improve code * Upgrade to ember 3.0 * Migrate tests to new Qunit API * Migrate to new api modules * Remove packaging * Simplify resolver * Refactor code
- Loading branch information
Showing
56 changed files
with
13,846 additions
and
812 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 2017, | ||
sourceType: 'module' | ||
}, | ||
plugins: [ | ||
'ember' | ||
], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:ember/recommended' | ||
], | ||
env: { | ||
browser: true | ||
}, | ||
rules: { | ||
}, | ||
overrides: [ | ||
// node files | ||
{ | ||
files: [ | ||
'index.js', | ||
'testem.js', | ||
'ember-cli-build.js', | ||
'config/**/*.js', | ||
'tests/dummy/config/**/*.js' | ||
], | ||
excludedFiles: [ | ||
'app/**', | ||
'addon/**', | ||
'tests/dummy/app/**' | ||
], | ||
parserOptions: { | ||
sourceType: 'script', | ||
ecmaVersion: 2015 | ||
}, | ||
env: { | ||
browser: false, | ||
node: true | ||
}, | ||
plugins: ['node'], | ||
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, { | ||
// add your custom rules and overrides for node files here | ||
}) | ||
} | ||
] | ||
}; |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,47 @@ | ||
--- | ||
language: node_js | ||
node_js: | ||
- "0.12" | ||
# we recommend testing addons with the same minimum supported node version as Ember CLI | ||
# so that your addon works for all apps | ||
- "4" | ||
|
||
sudo: false | ||
dist: trusty | ||
|
||
addons: | ||
chrome: stable | ||
|
||
cache: | ||
directories: | ||
- node_modules | ||
- $HOME/.npm | ||
|
||
env: | ||
global: | ||
# See https://git.io/vdao3 for details. | ||
- JOBS=1 | ||
matrix: | ||
# we recommend new addons test the current and previous LTS | ||
# as well as latest stable release (bonus points to beta/canary) | ||
- EMBER_TRY_SCENARIO=ember-lts-2.12 | ||
- EMBER_TRY_SCENARIO=ember-lts-2.16 | ||
- EMBER_TRY_SCENARIO=ember-lts-2.18 | ||
- EMBER_TRY_SCENARIO=ember-release | ||
- EMBER_TRY_SCENARIO=ember-beta | ||
- EMBER_TRY_SCENARIO=ember-canary | ||
- EMBER_TRY_SCENARIO=ember-default | ||
|
||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- env: EMBER_TRY_SCENARIO=ember-canary | ||
|
||
before_install: | ||
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH | ||
- "npm config set spin false" | ||
- "npm install -g npm@^2" | ||
|
||
install: | ||
- npm install -g bower | ||
- npm install | ||
- bower install | ||
- npm config set spin false | ||
- npm install -g npm@4 | ||
- npm --version | ||
|
||
script: | ||
- ember try:each | ||
- npm run lint:js | ||
# Usually, it's ok to finish the test scenario without reverting | ||
# to the addon's original dependency state, skipping "cleanup". | ||
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup |
This file contains 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 characters
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import Ember from 'ember'; | ||
import EmberObject from '@ember/object'; | ||
|
||
export default Ember.Object.extend({ | ||
export default EmberObject.extend({ | ||
model: null | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,35 @@ | ||
import Ember from 'ember'; | ||
import Helper from '@ember/component/helper'; | ||
|
||
export default Ember.Helper.extend({ | ||
can: Ember.inject.service(), | ||
import { inject as service } from '@ember/service'; | ||
|
||
compute([name, resource], hash) { | ||
const service = this.get('can'); | ||
const ability = service.build(name, resource, hash); | ||
const { propertyName } = service.parse(name); | ||
export default Helper.extend({ | ||
can: service(), | ||
|
||
if (this._ability) { | ||
this._ability.removeObserver(this._abilityProp, this, 'recompute'); | ||
} | ||
ability: null, | ||
propertyName: null, | ||
|
||
this._ability = ability; | ||
this._abilityProp = propertyName; | ||
compute([name, resource], properties) { | ||
let service = this.get('can'); | ||
let { abilityName, propertyName } = service.parse(name); | ||
let ability = service.build(abilityName, resource, properties); | ||
|
||
ability.addObserver(propertyName, this, 'recompute'); | ||
this._removeAbilityObserver(); | ||
this._addAbilityObserver(ability, propertyName); | ||
|
||
return ability.get(propertyName); | ||
}, | ||
|
||
destroy() { | ||
if (this._ability) { | ||
this._ability.removeObserver(this._abilityProp, this, 'recompute'); | ||
} | ||
return this._super(); | ||
this._removeAbilityObserver(); | ||
return this._super(...arguments); | ||
}, | ||
|
||
_addAbilityObserver(ability, propertyName) { | ||
this.setProperties({ ability, propertyName }); | ||
this.addObserver(`ability.${propertyName}`, this, 'recompute'); | ||
}, | ||
|
||
_removeAbilityObserver() { | ||
this.removeObserver(`ability.${this.get('propertyName')}`, this, 'recompute'); | ||
} | ||
}); |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
import Ember from 'ember'; | ||
import CanHelper from 'ember-can/helpers/can'; | ||
|
||
const { getOwner, typeOf } = Ember; | ||
|
||
export default Ember.Helper.extend({ | ||
helper: Ember.computed(function() { | ||
var helper = getOwner(this).lookup('helper:can'); | ||
|
||
return typeOf(helper) === 'instance' ? helper : helper.create(); | ||
}), | ||
|
||
compute(params, hash) { | ||
return !this.get('helper').compute(params, hash); | ||
export default CanHelper.extend({ | ||
compute() { | ||
return !this._super(...arguments); | ||
} | ||
}); |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
import Ability from './ability'; | ||
import CanMixin from './can-mixin'; | ||
import computed from './computed'; | ||
import CanService from './services/can'; | ||
import Ability from 'ember-can/ability'; | ||
import CanMixin from 'ember-can/mixins/can'; | ||
import computed from 'ember-can/computed'; | ||
import CanService from 'ember-can/services/can'; | ||
|
||
export { | ||
Ability, | ||
CanMixin, | ||
CanService, | ||
computed | ||
}; | ||
export { Ability, CanMixin, CanService, computed }; |
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Resolver from 'ember-resolver'; | ||
|
||
Resolver.reopen({ | ||
// eslint-disable-next-line ember/avoid-leaking-state-in-ember-objects | ||
pluralizedTypes: { | ||
ability: 'abilities' | ||
} | ||
}); | ||
|
||
export function initialize(/* application */) {} | ||
export default { initialize }; |
Oops, something went wrong.