Skip to content

Commit

Permalink
updates & cleanup
Browse files Browse the repository at this point in the history
* upgrade to latest ember-cli
* remove unused files
* upgrade to some fancy ES2015 syntax
* enable ember-try
  • Loading branch information
stefanpenner committed May 20, 2015
1 parent 82367ac commit 3037b08
Show file tree
Hide file tree
Showing 26 changed files with 134 additions and 49 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ indent_style = space
indent_size = 2

[*.hbs]
insert_final_newline = false
indent_style = space
indent_size = 2

Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
bower_components/
tests/
tmp/
dist/

.bowerrc
.editorconfig
Expand Down
16 changes: 15 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
---
language: node_js
node_js:
- "0.12"

sudo: false

cache:
directories:
- node_modules

env:
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary

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"

Expand All @@ -17,4 +31,4 @@ install:
- bower install

script:
- npm test
- ember try $EMBER_TRY_SCENARIO test
8 changes: 4 additions & 4 deletions addon/components/x-option.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export default Ember.Component.extend({
*
* @override
*/
didInsertElement: function() {
this._super.apply(this, arguments);
didInsertElement() {
this._super(...arguments);

var select = this.nearestOfType(XSelectComponent);
Ember.assert("x-option component declared without enclosing x-select", !!select);
Expand All @@ -63,8 +63,8 @@ export default Ember.Component.extend({
*
* @override
*/
willDestroyElement: function() {
this._super.apply(this, arguments);
willDestroyElement() {
this._super(...arguments);
this.get('select').unregisterOption(this);
}
});
20 changes: 8 additions & 12 deletions addon/components/x-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ export default Ember.Component.extend({
didInsertElement: function() {
this._super.apply(this, arguments);

this.$().on('change', Ember.run.bind(this, function() {
this._contentDidChange();
}));
this.$().on('change', Ember.run.bind(this, this._contentDidChange));
},

/**
Expand All @@ -144,7 +142,7 @@ export default Ember.Component.extend({
*
* @private
*/
_updateValueSingle: function(){
_updateValueSingle() {
var option = this.get('options').find(function(option) {
return option.$().is(':selected');
});
Expand All @@ -161,10 +159,8 @@ export default Ember.Component.extend({
*
* @private
*/
_updateValueMultiple: function() {
var options = this.get('options').filter(function(option) {
return option.$().is(':selected');
});
_updateValueMultiple() {
var options = this.get('options').filter((option) => option.$().is(':selected'));

var newValues = options.mapBy('value');

Expand All @@ -179,8 +175,8 @@ export default Ember.Component.extend({
/**
* @override
*/
willDestroyElement: function() {
this._super.apply(this, arguments);
willDestroyElement() {
this._super(...arguments);

this.$().off('change');
// might be overkill, but make sure options can get gc'd
Expand Down Expand Up @@ -213,14 +209,14 @@ export default Ember.Component.extend({
/**
* @private
*/
registerOption: function(option) {
registerOption(option) {
this.get('options').addObject(option);
},

/**
* @private
*/
unregisterOption: function(option) {
unregisterOption(option) {
this.get('options').removeObject(option);
}
});
3 changes: 1 addition & 2 deletions app/components/x-option.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import XOption from 'emberx-select/components/x-option';
export default XOption;
export { default } from 'emberx-select/components/x-option';
3 changes: 1 addition & 2 deletions app/components/x-select.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
import XSelect from 'emberx-select/components/x-select';
export default XSelect;
export { default } from 'emberx-select/components/x-select';
11 changes: 11 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "emberx-select",
"dependencies": {
<<<<<<< HEAD
"jquery": "^1.11.1",
"ember": "1.10.0",
"ember-data": "1.0.0-beta.15",
Expand All @@ -10,6 +11,16 @@
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2",
"ember-mocha": "~0.5.2"
=======
"ember": "1.12.0",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4",
"ember-resolver": "~0.1.15",
"jquery": "^1.11.1",
"loader.js": "ember-cli/loader.js#3.2.0",
"ember-mocha": "~0.4.0"
>>>>>>> updates & cleanup
},
"devDependencies": {
"chai-jquery": "~2.0.0"
Expand Down
35 changes: 35 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-release',
dependencies: {
'ember': 'components/ember#release'
},
resolutions: {
'ember': 'release'
}
},
{
name: 'ember-beta',
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: {
'ember': 'beta'
}
},
{
name: 'ember-canary',
dependencies: {
'ember': 'components/ember#canary'
},
resolutions: {
'ember': 'canary'
}
}
]
};
18 changes: 18 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"author": "",
"license": "MIT",
"devDependencies": {
<<<<<<< HEAD
"broccoli-asset-rev": "^2.0.0",
"ember-cli": "0.2.0",
"ember-cli-app-version": "0.3.2",
Expand All @@ -31,6 +32,23 @@
"ember-cli-uglify": "1.0.1",
"ember-data": "1.0.0-beta.15",
"ember-export-application-global": "^1.0.2"
=======
"broccoli-asset-rev": "^2.0.2",
"ember-cli": "0.2.5",
"ember-cli-app-version": "0.3.3",
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "^1.0.0",
"ember-cli-htmlbars": "^0.7.6",
"ember-cli-inject-live-reload": "^1.3.0",
"ember-cli-mocha": "0.4.2",
"ember-cli-uglify": "^1.0.1",
"ember-disable-proxy-controllers": "^0.7.0",
"ember-export-application-global": "^1.0.2",
"ember-try": "0.0.4"
},
"dependencies": {
"ember-cli-babel": "^5.0.0"
>>>>>>> updates & cleanup
},
"keywords": [
"ember-addon",
Expand Down
1 change: 1 addition & 0 deletions testem.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"framework": "qunit",
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"launch_in_ci": [
"PhantomJS"
],
Expand Down
5 changes: 2 additions & 3 deletions tests/dummy/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers';
import config from './config/environment';

Ember.MODEL_FACTORY_INJECTIONS = true;
var App;

var App = Ember.Application.extend({
App = Ember.Application.extend({
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix,
Resolver: Resolver
});

Expand Down
Empty file.
4 changes: 1 addition & 3 deletions tests/dummy/app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import Ember from 'ember';


export default Ember.ObjectController.extend({

export default Ember.Controller.extend({
});
Empty file removed tests/dummy/app/helpers/.gitkeep
Empty file.
Empty file removed tests/dummy/app/models/.gitkeep
Empty file.
Empty file removed tests/dummy/app/routes/.gitkeep
Empty file.
12 changes: 8 additions & 4 deletions tests/dummy/app/routes/blockless-multiple.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import Ember from 'ember';
import Folks from 'dummy/mixins/folks';

export default Ember.Route.extend(Folks, {
model: function() {
return Ember.A([this.get('bastion'), this.get('stanley')]);
model() {
return Ember.A([
this.get('bastion'),
this.get('stanley')
]);
},
setupController: function(controller, model) {
this._super.apply(this, arguments);

setupController(controller, model) {
this._super(...arguments);
controller.set('it', model);
controller.set('folks', Ember.A([this.get('charles'), this.get('bastion'), this.get('stanley') ]));
}
Expand Down
12 changes: 8 additions & 4 deletions tests/dummy/app/routes/blockless-single.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ import Ember from 'ember';
import Folks from 'dummy/mixins/folks';

export default Ember.Route.extend(Folks, {
model: function() {
model() {
return this.get('bastion');
},
setupController: function(controller, model) {
this._super.apply(this, arguments);
setupController(controller, model) {
this._super(...arguments);
controller.set('it', model);
controller.set('folks', Ember.A([this.get('bastion'), this.get('stanley'), this.get('charles')]));
controller.set('folks', Ember.A([
this.get('bastion'),
this.get('stanley'),
this.get('charles')
]));
}
});
7 changes: 5 additions & 2 deletions tests/dummy/app/routes/multiple.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ import Folks from 'dummy/mixins/folks';

export default Ember.Route.extend(Folks, {
model: function() {
return Ember.A([this.get('bastion'), this.get('stanley')]);
return Ember.A([
this.get('bastion'),
this.get('stanley')
]);
},
setupController: function(controller, model) {
this._super.apply(this, arguments);
this._super(...arguments);
controller.set('selections', model);
}
});
6 changes: 3 additions & 3 deletions tests/dummy/app/routes/single.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import Ember from 'ember';
import Folks from 'dummy/mixins/folks';

export default Ember.Route.extend(Folks, {
model: function() {
model() {
return this.get('bastion');
},
setupController: function(controller, model) {
this._super.apply(this, arguments);
setupController(controller, model) {
this._super(...arguments);
controller.set('it', model);
}
});
Empty file.
Empty file removed tests/dummy/app/views/.gitkeep
Empty file.
18 changes: 9 additions & 9 deletions tests/dummy/public/crossdomain.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->

<!-- Most restrictive policy: -->
<site-control permitted-cross-domain-policies="none"/>
<!-- Most restrictive policy: -->
<site-control permitted-cross-domain-policies="none"/>

<!-- Least restrictive policy: -->
<!--
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
-->
<!-- Least restrictive policy: -->
<!--
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
-->
</cross-domain-policy>
1 change: 1 addition & 0 deletions tests/dummy/public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# http://www.robotstxt.org
User-agent: *
Disallow:
Empty file removed tests/unit/.gitkeep
Empty file.

0 comments on commit 3037b08

Please sign in to comment.