Skip to content

Commit

Permalink
Merge pull request #34 from chrislopresto/nesting
Browse files Browse the repository at this point in the history
Support nested addon usage
  • Loading branch information
chrislopresto committed Apr 20, 2016
2 parents f049131 + 60fc5a7 commit 4a22d3e
Show file tree
Hide file tree
Showing 18 changed files with 85 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
.travis.yml
bower.json
ember-cli-build.js
testem.json
testem.js
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
language: node_js
node_js:
- "0.12"
- "4"

sudo: false

Expand All @@ -11,6 +11,7 @@ cache:

env:
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=ember-1.13
- EMBER_TRY_SCENARIO=ember-release
- EMBER_TRY_SCENARIO=ember-beta
- EMBER_TRY_SCENARIO=ember-canary
Expand All @@ -21,14 +22,15 @@ matrix:
- 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"
- npm config set spin false
- npm install -g bower
- npm install phantomjs-prebuilt

install:
- npm install -g bower
- npm install
- bower install

script:
- ember try $EMBER_TRY_SCENARIO test
# Usually, it's ok to finish the test scenario without reverting
# to the addon's original dependency state, skipping "cleanup".
- ember try $EMBER_TRY_SCENARIO test --skip-cleanup
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ $FreestyleGuide-color--primary: #ff0000;

* `ember build`

For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).
For more information on using ember-cli, visit [http://ember-cli.com/](http://ember-cli.com/).
1 change: 1 addition & 0 deletions addon/components/freestyle-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default Ember.Component.extend({

emberFreestyle: inject.service(),
showLabels: computed.and('emberFreestyle.notFocused', 'emberFreestyle.showLabels'),
hasLabels: computed.and('showLabels', 'title'),
showVariantList: computed.not('emberFreestyle.focus'),

defaultKey: 'all',
Expand Down
2 changes: 1 addition & 1 deletion addon/components/freestyle-palette-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default Ember.Component.extend({
tagName: '',
// color - passed in
paletteStyle: computed('color', function() {
const color = this.get('color');
let color = this.get('color');
return htmlSafe(`background-color: ${color.base};`);
})
});
2 changes: 1 addition & 1 deletion addon/components/freestyle-palette.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import layout from '../templates/components/freestyle-palette';

const { computed, inject } = Ember;
const { computed } = Ember;

export default Ember.Component.extend({
tagName: '',
Expand Down
1 change: 1 addition & 0 deletions addon/components/freestyle-section.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default Ember.Component.extend({
}),

showName: computed.and('emberFreestyle.notFocused', 'name'),
hasName: computed.and('showName', 'name'),

willRender() {
this._super(...arguments);
Expand Down
4 changes: 4 additions & 0 deletions addon/components/freestyle-usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ let FreestyleUsage = Ember.Component.extend({
return this.get('highlightJsTheme') || this.get('defaultTheme');
}),

hasLabels: computed.and('showLabels', 'title'),
hasNotes: computed.and('showNotes', 'slug'),
hasCode: computed.and('showCode', 'slug'),

actions: {
setFocus() {
this.set('emberFreestyle.focus', this.get('slug'));
Expand Down
2 changes: 1 addition & 1 deletion addon/templates/components/freestyle-collection.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#if (and title showLabels)}}
{{#if hasLabels}}
<div class="FreestyleCollection-title">
{{title}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion addon/templates/components/freestyle-section.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if show}}
{{#if (and name showName)}}
{{#if hasName}}
<div class="FreestyleSection-name">
{{name}}
</div>
Expand Down
6 changes: 3 additions & 3 deletions addon/templates/components/freestyle-usage.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{#if showUsage}}
{{#if (and title showLabels)}}
{{#if hasLabels}}
<div class="FreestyleUsage-title">
{{title}}
<span class="FreestyleUsage-focusCta" onclick={{action 'setFocus'}}>
Expand All @@ -11,15 +11,15 @@
<div class="FreestyleUsage-rendered">
{{yield}}
</div>
{{#if (and slug showNotes)}}
{{#if hasNotes}}
<div class="FreestyleUsage-notes">
{{freestyle-notes name=snippetNotesJs theme=computedTheme}}
</div>
<div class="FreestyleUsage-notes">
{{freestyle-notes name=snippetNotesHbs theme=computedTheme}}
</div>
{{/if}}
{{#if (and slug showCode)}}
{{#if hasCode}}
<div class="FreestyleUsage-usage">
<div class="FreestyleUsage-snippet FreestyleUsage-snippet--{{computedTheme}}">
{{freestyle-snippet name=snippetUsage title=usageTitle}}
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "ember-freestyle",
"dependencies": {
"ember": "~2.3.1",
"ember-cli-shims": "0.1.0",
"ember": "~2.5.0",
"ember-cli-shims": "0.1.1",
"ember-cli-test-loader": "0.2.2",
"ember-qunit-notifications": "0.1.0",
"normalize.css": "3.0.3",
Expand Down
11 changes: 11 additions & 0 deletions config/ember-try.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ module.exports = {
dependencies: { }
}
},
{
name: 'ember-1.13',
bower: {
dependencies: {
'ember': '~1.13.0'
},
resolutions: {
'ember': '~1.13.0'
}
}
},
{
name: 'ember-release',
bower: {
Expand Down
1 change: 1 addition & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*jshint node:true*/
/* global require, module */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

Expand Down
26 changes: 10 additions & 16 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* jshint node: true */
'use strict';
var jsonModule = require('broccoli-json-module');
var mergeTrees = require('broccoli-merge-trees');
var stew = require('broccoli-stew');

Expand Down Expand Up @@ -68,23 +67,18 @@ module.exports = {

var target = app || parentAddon;
if (target.import) {
this.importFreestyleBowerDependencies(target);
target.import(target.bowerDirectory + '/remarkable/dist/remarkable.js');
target.import(target.bowerDirectory + '/highlightjs/highlight.pack.js');
target.import('vendor/ember-remarkable/shim.js', {
type: 'vendor',
exports: { 'remarkable': ['default'] }
});
target.import('vendor/ember-remarkable/highlightjs-shim.js', {
type: 'vendor',
exports: { 'hljs': ['default'] }
});
}

this.app.import(app.bowerDirectory + '/remarkable/dist/remarkable.js');
this.app.import(app.bowerDirectory + '/highlightjs/highlight.pack.js');
this.app.import('vendor/ember-remarkable/shim.js', {
type: 'vendor',
exports: { 'remarkable': ['default'] }
});
this.app.import('vendor/ember-remarkable/highlightjs-shim.js', {
type: 'vendor',
exports: { 'hljs': ['default'] }
});
},

importFreestyleBowerDependencies: function(target) {
target.import(target.bowerDirectory + '/remarkable/dist/remarkable.js');
},

isDevelopingAddon: function() {
Expand Down
33 changes: 15 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,49 +18,46 @@
"author": "",
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "^2.2.0",
"ember-ajax": "0.7.1",
"ember-cli": "2.3.0",
"broccoli-asset-rev": "^2.4.2",
"ember-ajax": "^2.0.1",
"ember-cli": "2.6.0-beta.1",
"ember-cli-app-version": "^1.0.0",
"ember-cli-autoprefixer": "0.5.0",
"ember-cli-autoprefixer": "0.6.0",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-github-pages": "0.0.6",
"ember-cli-github-pages": "0.0.8",
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-qunit": "^1.2.1",
"ember-cli-inject-live-reload": "^1.4.0",
"ember-cli-jshint": "^1.0.0",
"ember-cli-qunit": "^1.4.0",
"ember-cli-release": "0.2.8",
"ember-cli-sass": "5.3.1",
"ember-cli-sri": "^2.0.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-disable-prototype-extensions": "^1.1.0",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.4",
"ember-export-application-global": "^1.0.5",
"ember-load-initializers": "^0.5.1",
"ember-normalize": "0.0.9",
"ember-load-initializers": "^0.5.0",
"ember-resolver": "^2.0.3",
"ember-suave": "2.0.1",
"ember-truth-helpers": "1.2.0",
"ember-try": "~0.1.2",
"loader.js": "^4.0.0"
"loader.js": "^4.0.1"
},
"keywords": [
"ember-addon"
],
"dependencies": {
"broccoli-flatiron": "0.0.0",
"broccoli-funnel": "^1.0.1",
"broccoli-json-module": "0.0.1",
"broccoli-merge-trees": "^1.1.1",
"broccoli-stew": "^1.2.0",
"broccoli-unwatched-tree": "^0.1.1",
"broccoli-writer": "^0.1.1",
"ember-cli-babel": "^5.1.6",
"ember-cli-htmlbars": "^1.0.1",
"ember-cli-htmlbars": "^1.0.3",
"ember-remarkable": "chrislopresto/ember-remarkable#highlightjs-css-compatibility",
"ember-truth-helpers": "1.2.0",
"es6-promise": "^3.0.2",
"es6-promise": "^3.1.2",
"glob": "^6.0.4",
"highlight.js": "^9.1.0"
"highlight.js": "^9.3.0"
},
"ember-addon": {
"configPath": "tests/dummy/config"
Expand Down
13 changes: 13 additions & 0 deletions testem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*jshint node:true*/
module.exports = {
"framework": "qunit",
"test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"launch_in_ci": [
"PhantomJS"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
};
18 changes: 10 additions & 8 deletions tests/helpers/module-for-acceptance.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
// jscs:disable
import { module } from 'qunit';
import Ember from 'ember';
import startApp from '../helpers/start-app';
import destroyApp from '../helpers/destroy-app';

const { RSVP: { Promise } } = Ember;

export default function(name, options = {}) {
module(name, {
beforeEach() {
this.application = startApp();

if (options.beforeEach) {
options.beforeEach.apply(this, arguments);
// jscs:disable
return options.beforeEach.apply(this, arguments);
// jscs:enable
}
},

afterEach() {
destroyApp(this.application);

if (options.afterEach) {
options.afterEach.apply(this, arguments);
}
// jscs:disable
let afterEach = options.afterEach && options.afterEach.apply(this, arguments);
// jscs:enable
return Promise.resolve(afterEach).then(() => destroyApp(this.application));
}
});
}
// jscs:enable

0 comments on commit 4a22d3e

Please sign in to comment.