Skip to content

Commit

Permalink
Merge pull request #70 from snewcomer/master
Browse files Browse the repository at this point in the history
Updates to 3.0
  • Loading branch information
begedin authored Jun 21, 2018
2 parents 299d6c9 + 162633a commit 8123bbc
Show file tree
Hide file tree
Showing 49 changed files with 6,999 additions and 781 deletions.
4 changes: 0 additions & 4 deletions .bowerrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/blueprints/*/files/**/*.js
41 changes: 39 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,47 @@ module.exports = {
ecmaVersion: 2017,
sourceType: 'module'
},
extends: 'eslint:recommended',
plugins: [
'ember'
],
extends: [
'eslint:recommended',
'plugin:ember/recommended'
],
env: {
browser: true
},
rules: {
}
},
overrides: [
// node files
{
files: [
'ember-cli-build.js',
'index.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'tests/dummy/config/**/*.js'
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'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
})
}
]
};
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
/coverage/*
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
32 changes: 0 additions & 32 deletions .jshintrc

This file was deleted.

7 changes: 6 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
.bowerrc
.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
40 changes: 25 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
---
language: node_js
node_js:
# we recommend testing addons with the same minimum supported node version as Ember CLI
# so that your addon works for all apps
- "6"

sudo: false
dist: trusty

addons:
chrome: stable

cache:
directories:
- $HOME/.npm
yarn: true

env:
# we recommend testing LTS's and latest stable release (bonus points to beta/canary)
- EMBER_TRY_SCENARIO=ember-lts-2.4
- EMBER_TRY_SCENARIO=ember-lts-2.8
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
- EMBER_TRY_SCENARIO=ember-default
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:
- npm config set spin false
- npm install -g phantomjs-prebuilt
- phantomjs --version
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

install:
- npm install

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

script:
- 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 test --skip-cleanup
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO --skip-cleanup
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@



\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
6 changes: 3 additions & 3 deletions README-route-meta.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default Ember.Route.extend(RouteMetaMixin,{
},

setMetaTags: function (model) {
var metaTags = {
let metaTags = {
'name': {
'description' : model.get('description'),
'keywords' : model.get('name')
Expand Down Expand Up @@ -150,7 +150,7 @@ export default Ember.Controller.extend({
// which by default does not trigger a full route transition
// so we need to notify the mixin to reset the meta tags
eraObserver: Ember.observer('era', function() {
// This action will cause the mixin to recompute the
// This action will cause the mixin to recompute the
// meta tags for the current route
this.send('resetMeta');
}),
Expand Down Expand Up @@ -215,7 +215,7 @@ content-value is equal to 'Ice-T'.
<meta property='og:name' content='Ice-T'>
<meta property='twitter:name' content='Ice-T'>
```
#### resetMeta
RouteMetaMixin routes respond to the `resetMeta` action. This will
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ember-cli-meta-tags [![Build Status](https://travis-ci.org/ronco/ember-cli-meta-tags.svg?branch=master)](https://travis-ci.org/ronco/ember-cli-meta-tags)[![Ember Observer Score](https://emberobserver.com/badges/ember-cli-meta-tags.svg)](https://emberobserver.com/addons/ember-cli-meta-tags)
# ember-cli-meta-tags [![Build Status](https://travis-ci.org/ronco/ember-cli-meta-tags.svg?branch=master)](https://travis-ci.org/ronco/ember-cli-meta-tags)[![Ember Observer Score](https://emberobserver.com/badges/ember-cli-meta-tags.svg)](https://emberobserver.com/addons/ember-cli-meta-tags)

An [Ember CLI](http://www.ember-cli.com/) add-on to easily set tags
(`link`, `meta`, `script`, `noscript`, etc.) in the document head.
Expand Down Expand Up @@ -124,7 +124,7 @@ export default Ember.Route.extend({
},

setHeadTags: function(model) {
var headTags = [{
let headTags = [{
type: 'meta',
tagId: 'meta-description-tag',
attrs: {
Expand Down
50 changes: 27 additions & 23 deletions addon/components/head-tag.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import Ember from 'ember';
import { reads } from '@ember/object/computed';
import Component from '@ember/component';
import layout from '../templates/components/head-tag';

export default Ember.Component.extend({
export default Component.extend({
layout: layout,

_setTagName: Ember.on('init', function() {
init() {
this._super(...arguments);
this.set('tagName', this.get('headTag.type'));
}),
},

// expected head tag attributes
attributeBindings: [
'href',
'target',
'charset',
'crossorigin',
'dir',
'hreflang',
'media',
'rel',
Expand All @@ -30,24 +33,25 @@ export default Ember.Component.extend({
'property',
'itemprop'
],
href: Ember.computed.reads('headTag.attrs.href'),
target: Ember.computed.reads('headTag.attrs.target'),
charset: Ember.computed.reads('headTag.attrs.charset'),
crossorigin: Ember.computed.reads('headTag.attrs.crossorigin'),
hreflang: Ember.computed.reads('headTag.attrs.hreflang'),
media: Ember.computed.reads('headTag.attrs.media'),
rel: Ember.computed.reads('headTag.attrs.rel'),
rev: Ember.computed.reads('headTag.attrs.rev'),
sizes: Ember.computed.reads('headTag.attrs.sizes'),
type: Ember.computed.reads('headTag.attrs.type'),
content: Ember.computed.reads('headTag.attrs.content'),
'http-equiv': Ember.computed.reads('headTag.attrs.http-equiv'),
name: Ember.computed.reads('headTag.attrs.name'),
scheme: Ember.computed.reads('headTag.attrs.scheme'),
async: Ember.computed.reads('headTag.attrs.async'),
defer: Ember.computed.reads('headTag.attrs.defer'),
src: Ember.computed.reads('headTag.attrs.src'),
property: Ember.computed.reads('headTag.attrs.property'),
itemprop: Ember.computed.reads('headTag.attrs.itemprop')
href: reads('headTag.attrs.href'),
target: reads('headTag.attrs.target'),
charset: reads('headTag.attrs.charset'),
crossorigin: reads('headTag.attrs.crossorigin'),
dir: reads('headTag.attrs.dir'),
hreflang: reads('headTag.attrs.hreflang'),
media: reads('headTag.attrs.media'),
rel: reads('headTag.attrs.rel'),
rev: reads('headTag.attrs.rev'),
sizes: reads('headTag.attrs.sizes'),
type: reads('headTag.attrs.type'),
content: reads('headTag.attrs.content'),
'http-equiv': reads('headTag.attrs.http-equiv'),
name: reads('headTag.attrs.name'),
scheme: reads('headTag.attrs.scheme'),
async: reads('headTag.attrs.async'),
defer: reads('headTag.attrs.defer'),
src: reads('headTag.attrs.src'),
property: reads('headTag.attrs.property'),
itemprop: reads('headTag.attrs.itemprop')

});
7 changes: 4 additions & 3 deletions addon/components/head-tags.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Ember from 'ember';
import { A } from '@ember/array';
import Component from '@ember/component';
import layout from '../templates/components/head-tags';

export default Ember.Component.extend({
export default Component.extend({
tagName: '',
headTags: Ember.A([]),
headTags: A([]),
layout: layout
});
21 changes: 11 additions & 10 deletions addon/mixins/route-meta.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import Ember from 'ember';
import { next } from '@ember/runloop';
import { inject as service } from '@ember/service';
import Mixin from '@ember/object/mixin';
import { A } from '@ember/array';
// Route mixin for setting head meta tags on transition into/out of route

// @example How to set meta tags on a route
Expand All @@ -8,12 +11,10 @@ import Ember from 'ember';
// meta_property_name1: meta_value1
// meta_property_name2: meta_value2

const keys = Object.keys || Ember.keys;

export function metaToHeadTags(meta) {
let metaTypes = keys(meta);
let metaTypes = Object.keys(meta);
return metaTypes.reduce(function(headTags, meta_type) {
return headTags.pushObjects(keys(meta[meta_type]).map(function(key) {
return headTags.pushObjects(Object.keys(meta[meta_type]).map(function(key) {
return {
tagId: `${meta_type}:${key}`,
type: 'meta',
Expand All @@ -23,15 +24,15 @@ export function metaToHeadTags(meta) {
}
};
}));
}, Ember.A([]));
}, A([]));
}

export default Ember.Mixin.create({
headTagsService: Ember.inject.service('head-tags'),
export default Mixin.create({
headTagsService: service('head-tags'),

// convert legacy meta tags to headTags
headTags() {
var meta = this.get('meta');
let meta = this.get('meta');
if (typeof meta === 'function') {
meta = meta.apply(this);
} else if (typeof meta !== 'object') {
Expand All @@ -44,7 +45,7 @@ export default Ember.Mixin.create({
actions: {
resetMeta() {
let service = this.get('headTagsService');
Ember.run.next(service, 'collectHeadTags');
next(service, 'collectHeadTags');
}
}

Expand Down
Loading

0 comments on commit 8123bbc

Please sign in to comment.