Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update all the things #564

Merged
merged 14 commits into from
Feb 12, 2018
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,59 @@ module.exports = {
ecmaVersion: 2017,
sourceType: 'module'
},
extends: 'eslint:recommended',
plugins: [
'prettier',
'ember'
],
extends: [
'prettier',
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true
},
rules: {
}
'prettier/prettier': ['error', {
singleQuote: true
}],
},
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
})
},

// test files
{
files: ['tests/**/*.js'],
excludedFiles: ['tests/dummy/**/*.js'],
env: {
embertest: true
}
}
]
};
7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
.codeclimate.yml
.editorconfig
.ember-cli
.gitignore
.eslintrc.js
.gitignore
.watchmanconfig
.travis.yml
bower.json
ember-cli-build.js
testem.js

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
41 changes: 25 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,53 @@
---
language: node_js
node_js:
- "6"
# 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

cache:
yarn: true

addons:
chrome: stable
code_climate:
repo_token: 32e4df25574ba02aacb75e6d34b9c667044984df279e20a208884d7e9e9d4a8d

cache:
yarn: true

env:
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=ember-1.13
- EMBER_TRY_SCENARIO=ember-lts-2.4
- EMBER_TRY_SCENARIO=ember-lts-2.8
- EMBER_TRY_SCENARIO=ember-2.12
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
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-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-beta
- env: EMBER_TRY_SCENARIO=ember-canary
- env: EMBER_TRY_SCENARIO=ember-beta

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
- yarn global add codeclimate-test-reporter

install:
- yarn install --no-lockfile
- yarn install --no-lockfile --non-interactive

script:
- HEADLESS=true node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup
- yarn 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

after_script:
- codeclimate-test-reporter < coverage/lcov.info
28 changes: 5 additions & 23 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
Copyright 2016 Yahoo Inc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably bring back the original here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure here! Since Yahoo as an entity no longer exists, im not sure that the license still stands? If that's not the case, I'll revert it back to the BSD-3 license.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ended up reverting the license back.

All rights reserved.
The MIT License (MIT)

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Copyright (c) 2018

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

* Neither the name of the Yahoo Inc. nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL YAHOO! INC. BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 3 additions & 1 deletion addon/-private/ember-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export default Base.extend({
let result = _validate(this.get('_evType'), ...arguments);

if (result && typeof result === 'object') {
return result.message ? result.message : this.createErrorMessage(result.type, result.value, result.context);
return result.message
? result.message
: this.createErrorMessage(result.type, result.value, result.context);
}

return result;
Expand Down
60 changes: 28 additions & 32 deletions addon/-private/internal-result-object.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these not needed?

Copy link
Collaborator Author

@offirgolan offirgolan Feb 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. I've looked at some older yahoo OSS and they dont have it. I think just the BSD-3 license was enough.

* Copyright 2016, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
import { and, not, readOnly } from '@ember/object/computed';
import { isNone } from '@ember/utils';
import { makeArray } from '@ember/array';
import EmberObject, { defineProperty, computed, set, get } from '@ember/object';

import Ember from 'ember';
import ValidationError from '../validations/error';
import { isDsModel, isPromise } from '../utils/utils';

const {
get,
set,
isNone,
computed,
canInvoke,
makeArray,
defineProperty
} = Ember;

const {
and,
not,
readOnly
} = computed;

export default Ember.Object.extend({
const { canInvoke } = Ember;

export default EmberObject.extend({
model: null,
isValid: true,
isValidating: false,
Expand All @@ -39,7 +25,11 @@ export default Ember.Object.extend({
init() {
this._super(...arguments);

defineProperty(this, 'attrValue', computed.readOnly(`model.${get(this, 'attribute')}`));
defineProperty(
this,
'attrValue',
readOnly(`model.${get(this, 'attribute')}`)
);

if (this.get('isAsync')) {
this._handlePromise();
Expand Down Expand Up @@ -100,17 +90,23 @@ export default Ember.Object.extend({
return makeArray(get(this, 'warningMessage'));
}),

warning: computed('isWarning', 'type', 'warningMessage', 'attribute', function() {
if (get(this, 'isWarning') && !isNone(get(this, 'warningMessage'))) {
return ValidationError.create({
type: get(this, '_type'),
message: get(this, 'warningMessage'),
attribute: get(this, 'attribute')
});
}
warning: computed(
'isWarning',
'type',
'warningMessage',
'attribute',
function() {
if (get(this, 'isWarning') && !isNone(get(this, 'warningMessage'))) {
return ValidationError.create({
type: get(this, '_type'),
message: get(this, 'warningMessage'),
attribute: get(this, 'attribute')
});
}

return null;
}),
return null;
}
),

warnings: computed('warning', function() {
return makeArray(get(this, 'warning'));
Expand Down
22 changes: 9 additions & 13 deletions addon/-private/options.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import Ember from 'ember';
import EmberObject, { defineProperty, set, get } from '@ember/object';
import { isDescriptor } from 'ember-cp-validations/utils/utils';

const {
get,
set,
defineProperty
} = Ember;

const Options = Ember.Object.extend({
const Options = EmberObject.extend({
model: null,
attribute: null,

Expand All @@ -19,7 +13,7 @@ const Options = Ember.Object.extend({

let options = this.get('__options__');

Object.keys(options).forEach((key) => {
Object.keys(options).forEach(key => {
let value = options[key];

if (isDescriptor(value)) {
Expand All @@ -41,10 +35,12 @@ const Options = Ember.Object.extend({
});
}

return Ember.Object.create(Object.keys(options).reduce((obj, o) => {
obj[o] = get(this, o);
return obj;
}, {}));
return EmberObject.create(
Object.keys(options).reduce((obj, o) => {
obj[o] = get(this, o);
return obj;
}, {})
);
}
});

Expand Down
Loading