├── blueprints ├── template │ ├── files │ │ └── __root__ │ │ │ └── __path__ │ │ │ └── __name__.hbs │ └── index.js ├── helper-addon │ ├── index.js │ └── files │ │ └── __root__ │ │ └── __path__ │ │ └── __name__.js ├── component │ ├── files │ │ └── __root__ │ │ │ ├── __templatepath__ │ │ │ └── __templatename__.hbs │ │ │ └── __path__ │ │ │ └── __name__.coffee │ └── index.js ├── initializer-addon │ ├── index.js │ └── files │ │ └── __root__ │ │ └── __path__ │ │ └── __name__.js ├── route │ ├── files │ │ └── __root__ │ │ │ ├── __templatepath__ │ │ │ └── __templatename__.hbs │ │ │ └── __path__ │ │ │ └── __name__.coffee │ └── index.js ├── util │ ├── files │ │ └── __root__ │ │ │ └── utils │ │ │ └── __name__.coffee │ └── index.js ├── mixin │ ├── index.js │ └── files │ │ └── __root__ │ │ └── mixins │ │ └── __name__.coffee ├── view │ ├── index.js │ └── files │ │ └── __root__ │ │ └── __path__ │ │ └── __name__.coffee ├── addon-import │ ├── files │ │ └── __root__ │ │ │ └── __path__ │ │ │ └── __name__.js │ └── index.js ├── controller │ ├── index.js │ └── files │ │ └── __root__ │ │ └── __path__ │ │ └── __name__.coffee ├── initializer │ ├── index.js │ └── files │ │ └── __root__ │ │ └── initializers │ │ └── __name__.coffee ├── service │ ├── index.js │ └── files │ │ └── __root__ │ │ └── __path__ │ │ └── __name__.coffee ├── component-addon │ ├── files │ │ └── __root__ │ │ │ └── __path__ │ │ │ └── __name__.js │ └── index.js ├── route-addon │ ├── files │ │ └── __root__ │ │ │ ├── __path__ │ │ │ └── __name__.js │ │ │ └── __templatepath__ │ │ │ └── __templatename__.js │ └── index.js ├── route-test │ ├── index.js │ └── qunit-files │ │ └── tests │ │ └── unit │ │ └── __path__ │ │ └── __test__.coffee ├── transform │ ├── index.js │ └── files │ │ └── __root__ │ │ └── __path__ │ │ └── __name__.coffee ├── util-test │ ├── index.js │ └── qunit-files │ │ └── tests │ │ └── unit │ │ └── utils │ │ └── __name__-test.coffee ├── view-test │ ├── index.js │ └── files │ │ └── tests │ │ └── unit │ │ └── __path__ │ │ └── __test__.coffee ├── serializer │ ├── index.js │ └── files │ │ └── __root__ │ │ └── __path__ │ │ └── __name__.coffee ├── service-test │ ├── index.js │ └── qunit-files │ │ └── tests │ │ └── unit │ │ └── services │ │ └── __name__-test.coffee ├── test-helper │ ├── index.js │ └── files │ │ └── tests │ │ └── helpers │ │ └── __name__.coffee ├── controller-test │ ├── index.js │ └── files │ │ └── tests │ │ └── unit │ │ └── __path__ │ │ └── __test__.coffee ├── serializer-test │ ├── index.js │ └── qunit-files │ │ └── tests │ │ └── unit │ │ └── __path__ │ │ └── __test__.coffee ├── transform-test │ ├── index.js │ └── qunit-files │ │ └── tests │ │ └── unit │ │ └── __path__ │ │ └── __test__.coffee ├── adapter │ ├── files │ │ └── __root__ │ │ │ └── __path__ │ │ │ └── __name__.coffee │ └── index.js ├── model │ ├── files │ │ └── __root__ │ │ │ └── __path__ │ │ │ └── __name__.coffee │ └── index.js ├── helper │ ├── files │ │ └── __root__ │ │ │ └── helpers │ │ │ └── __name__.coffee │ └── index.js ├── component-test │ ├── files │ │ └── tests │ │ │ └── __testType__ │ │ │ └── __path__ │ │ │ └── __test__.coffee │ └── index.js ├── mixin-test │ ├── index.js │ └── files │ │ └── tests │ │ └── unit │ │ └── mixins │ │ └── __name__-test.coffee ├── model-test │ ├── index.js │ └── files │ │ └── tests │ │ └── unit │ │ └── __path__ │ │ └── __test__.coffee ├── helper-test │ ├── index.js │ └── files │ │ └── tests │ │ └── unit │ │ └── helpers │ │ └── __name__-test.coffee ├── adapter-test │ ├── index.js │ └── files │ │ └── tests │ │ └── unit │ │ └── __path__ │ │ └── __test__.coffee ├── initializer-test │ ├── index.js │ └── files │ │ └── tests │ │ └── unit │ │ └── initializers │ │ └── __name__-test.coffee ├── acceptance-test │ ├── index.js │ └── files │ │ └── tests │ │ └── acceptance │ │ └── __name__-test.coffee └── resource │ └── index.js ├── .watchmanconfig ├── tests ├── dummy │ ├── app │ │ ├── styles │ │ │ └── app.css │ │ ├── templates │ │ │ ├── index.hbs │ │ │ └── application.hbs │ │ ├── resolver.js │ │ ├── routes │ │ │ └── index.coffee │ │ ├── router.coffee │ │ ├── app.coffee │ │ └── index.html │ ├── public │ │ ├── robots.txt │ │ └── crossdomain.xml │ └── config │ │ └── environment.js ├── test-helper.js ├── helpers │ ├── destroy-app.js │ ├── resolver.js │ ├── start-app.js │ └── module-for-acceptance.js ├── acceptance │ └── index-test.js ├── .jshintrc └── index.html ├── .bowerrc ├── scripts ├── install.sh ├── run-tests.sh └── before-install.sh ├── config ├── environment.js └── ember-try.js ├── bower.json ├── testem.js ├── .npmignore ├── .ember-cli ├── .gitignore ├── node-tests ├── helpers │ └── expect-coffee.js ├── expect-coffee-test.js └── blueprints │ ├── template-test.js │ ├── addon-import-test.js │ ├── helper-addon-test.js │ ├── component-addon-test.js │ ├── initializer-addon-test.js │ ├── test-helper-test.js │ ├── route-addon-test.js │ ├── controller-test.js │ ├── acceptance-test-test.js │ ├── helper-test.js │ ├── initializer-test.js │ ├── component-test.js │ ├── adapter-test.js │ ├── model-test.js │ ├── resource-test.js │ ├── view-test.js │ ├── service-test.js │ ├── transform-test.js │ ├── serializer-test.js │ ├── util-test.js │ ├── route-test.js │ └── mixin-test.js ├── ember-cli-build.js ├── .travis.yml ├── .jshintrc ├── .editorconfig ├── lib ├── coffee-preprocessor.js ├── utilities │ ├── ancestral-blueprint.js │ └── string.js └── coffee-linter.js ├── LICENSE.md ├── index.js ├── package.json ├── README.md └── CHANGELOG.md /blueprints/template/files/__root__/__path__/__name__.hbs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp", "dist"] 3 | } 4 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | } 4 | -------------------------------------------------------------------------------- /blueprints/helper-addon/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../addon-import'); 2 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/index.hbs: -------------------------------------------------------------------------------- 1 |
{{model}}
2 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "analytics": false 4 | } 5 | -------------------------------------------------------------------------------- /blueprints/component/files/__root__/__templatepath__/__templatename__.hbs: -------------------------------------------------------------------------------- 1 | {{yield}} 2 | -------------------------------------------------------------------------------- /blueprints/initializer-addon/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('../addon-import'); 2 | -------------------------------------------------------------------------------- /blueprints/route/files/__root__/__templatepath__/__templatename__.hbs: -------------------------------------------------------------------------------- 1 | {{outlet}} 2 | -------------------------------------------------------------------------------- /blueprints/util/files/__root__/utils/__name__.coffee: -------------------------------------------------------------------------------- 1 | export default () -> 2 | true 3 | -------------------------------------------------------------------------------- /tests/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /blueprints/mixin/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | description: 'Generates a mixin.' 3 | }; 4 | -------------------------------------------------------------------------------- /blueprints/util/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/util'); 2 | -------------------------------------------------------------------------------- /blueprints/view/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/view'); 2 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 |

Welcome to Ember

2 | 3 | {{outlet}} 4 | -------------------------------------------------------------------------------- /blueprints/addon-import/files/__root__/__path__/__name__.js: -------------------------------------------------------------------------------- 1 | export { default } from '<%= modulePath %>'; 2 | -------------------------------------------------------------------------------- /blueprints/controller/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | description: 'Generates a controller.' 3 | }; 4 | -------------------------------------------------------------------------------- /blueprints/initializer/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | description: 'Generates an initializer.' 3 | }; 4 | -------------------------------------------------------------------------------- /blueprints/service/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/service'); 2 | -------------------------------------------------------------------------------- /tests/dummy/app/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember-resolver'; 2 | 3 | export default Resolver; 4 | -------------------------------------------------------------------------------- /blueprints/component-addon/files/__root__/__path__/__name__.js: -------------------------------------------------------------------------------- 1 | export { default } from '<%= modulePath %>'; 2 | -------------------------------------------------------------------------------- /blueprints/route-addon/files/__root__/__path__/__name__.js: -------------------------------------------------------------------------------- 1 | export { default } from '<%= routeModulePath %>'; 2 | -------------------------------------------------------------------------------- /blueprints/route-test/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/route-test'); 2 | -------------------------------------------------------------------------------- /blueprints/template/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/template'); 2 | -------------------------------------------------------------------------------- /blueprints/transform/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/transform'); 2 | -------------------------------------------------------------------------------- /blueprints/util-test/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/util-test'); 2 | -------------------------------------------------------------------------------- /blueprints/view-test/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/view-test'); 2 | -------------------------------------------------------------------------------- /blueprints/route-addon/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/route-addon'); 2 | -------------------------------------------------------------------------------- /blueprints/serializer/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | description: 'Generates an ember-data serializer.' 3 | }; 4 | -------------------------------------------------------------------------------- /blueprints/service-test/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/service-test'); 2 | -------------------------------------------------------------------------------- /blueprints/test-helper/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/test-helper'); 2 | -------------------------------------------------------------------------------- /blueprints/controller-test/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | description: 'Generates a controller unit test.' 3 | }; 4 | -------------------------------------------------------------------------------- /blueprints/serializer-test/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/serializer-test'); 2 | -------------------------------------------------------------------------------- /blueprints/transform-test/index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('ember-cli-legacy-blueprints/blueprints/transform-test'); 2 | -------------------------------------------------------------------------------- /blueprints/initializer-addon/files/__root__/__path__/__name__.js: -------------------------------------------------------------------------------- 1 | export { default, initialize } from '<%= modulePath %>'; 2 | -------------------------------------------------------------------------------- /blueprints/mixin/files/__root__/mixins/__name__.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | 3 | export default Ember.Mixin.create() 4 | -------------------------------------------------------------------------------- /blueprints/route-addon/files/__root__/__templatepath__/__templatename__.js: -------------------------------------------------------------------------------- 1 | export { default } from '<%= templateModulePath %>'; 2 | -------------------------------------------------------------------------------- /blueprints/route/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | 3 | export default Ember.Route.extend() 4 | -------------------------------------------------------------------------------- /blueprints/view/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | 3 | export default Ember.View.extend() 4 | -------------------------------------------------------------------------------- /blueprints/adapter/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | <%= importStatement %> 2 | 3 | export default <%= baseClass %>.extend() 4 | -------------------------------------------------------------------------------- /blueprints/helper-addon/files/__root__/__path__/__name__.js: -------------------------------------------------------------------------------- 1 | export { default, <%= camelizedModuleName %> } from '<%= modulePath %>'; 2 | -------------------------------------------------------------------------------- /blueprints/service/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | 3 | export default Ember.Service.extend() 4 | -------------------------------------------------------------------------------- /scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | npm install 5 | 6 | if [ "$EMBER_TRY_SCENARIO" ]; then 7 | bower install 8 | fi 9 | -------------------------------------------------------------------------------- /blueprints/controller/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | 3 | export default Ember.Controller.extend() 4 | -------------------------------------------------------------------------------- /blueprints/serializer/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | import DS from 'ember-data' 2 | 3 | export default DS.RESTSerializer.extend() 4 | -------------------------------------------------------------------------------- /blueprints/model/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | import DS from 'ember-data' 2 | 3 | export default DS.Model.extend { 4 | <%= attrs %> 5 | } 6 | -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | 'use strict'; 3 | 4 | module.exports = function(/* environment, appConfig */) { 5 | return { }; 6 | }; 7 | -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { 3 | setResolver 4 | } from 'ember-qunit'; 5 | 6 | setResolver(resolver); 7 | -------------------------------------------------------------------------------- /tests/helpers/destroy-app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default function destroyApp(application) { 4 | Ember.run(application, 'destroy'); 5 | } 6 | -------------------------------------------------------------------------------- /blueprints/component/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | <%= importTemplate %> 3 | export default Ember.Component.extend(<%=contents%>) 4 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/index.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | 3 | IndexController = Ember.Route.extend 4 | model: -> 5 | 'Howdy' 6 | 7 | export default IndexController 8 | -------------------------------------------------------------------------------- /scripts/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [ "$EMBER_TRY_SCENARIO" ]; then 5 | ember try $EMBER_TRY_SCENARIO test 6 | fi 7 | 8 | if [ "$NODE_TESTS" = "true" ]; then 9 | npm run nodetest 10 | fi 11 | -------------------------------------------------------------------------------- /tests/dummy/app/router.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | import config from './config/environment' 3 | 4 | Router = Ember.Router.extend 5 | location: config.locationType 6 | 7 | Router.map -> 8 | 9 | export default Router 10 | -------------------------------------------------------------------------------- /blueprints/test-helper/files/tests/helpers/__name__.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | 3 | <%= camelizedModuleName %> = (app) -> 4 | 5 | export default Ember.Test.registerAsyncHelper('<%= camelizedModuleName %>', <%= camelizedModuleName %>) 6 | -------------------------------------------------------------------------------- /blueprints/transform/files/__root__/__path__/__name__.coffee: -------------------------------------------------------------------------------- 1 | import DS from 'ember-data' 2 | 3 | export default DS.Transform.extend 4 | deserialize: (serialized) -> 5 | serialized 6 | 7 | serialize: (deserialized) -> 8 | deserialized 9 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-cli-coffeescript", 3 | "dependencies": { 4 | "ember": "~2.4.1", 5 | "ember-cli-shims": "0.1.0", 6 | "ember-cli-test-loader": "0.2.2", 7 | "ember-qunit-notifications": "0.1.0" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /blueprints/helper/files/__root__/helpers/__name__.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | 3 | # This function receives the params `params, hash` 4 | export <%= camelizedModuleName %> = (params) -> 5 | return params 6 | 7 | export default Ember.Helper.helper <%= camelizedModuleName %> 8 | -------------------------------------------------------------------------------- /scripts/before-install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | npm config set spin false 5 | 6 | if [ "$EMBER_TRY_SCENARIO" ]; then 7 | npm install -g bower 8 | bower --version 9 | npm install phantomjs-prebuilt 10 | node_modules/phantomjs-prebuilt/bin/phantomjs --version 11 | fi 12 | -------------------------------------------------------------------------------- /blueprints/initializer/files/__root__/initializers/__name__.coffee: -------------------------------------------------------------------------------- 1 | # Takes two parameters: container and application 2 | export initialize = () -> 3 | # application.register 'route', 'foo', 'service:foo' 4 | 5 | export default { 6 | name: '<%= dasherizedModuleName %>' 7 | initialize: initialize 8 | } 9 | -------------------------------------------------------------------------------- /testem.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = { 3 | "framework": "qunit", 4 | "test_page": "tests/index.html?hidepassed", 5 | "disable_watching": true, 6 | "launch_in_ci": [ 7 | "PhantomJS" 8 | ], 9 | "launch_in_dev": [ 10 | "PhantomJS", 11 | "Chrome" 12 | ] 13 | }; 14 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /bower_components 2 | /config/ember-try.js 3 | /dist 4 | /node-tests 5 | /scripts 6 | /tests 7 | /tmp 8 | **/.gitkeep 9 | .bowerrc 10 | .editorconfig 11 | .ember-cli 12 | .gitignore 13 | .jshintrc 14 | .watchmanconfig 15 | .travis.yml 16 | bower.json 17 | ember-cli-build.js 18 | testem.js 19 | -------------------------------------------------------------------------------- /blueprints/view-test/files/tests/unit/__path__/__test__.coffee: -------------------------------------------------------------------------------- 1 | import { moduleFor, test } from 'ember-qunit' 2 | 3 | moduleFor 'view:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>' 4 | 5 | # Replace this with your real tests. 6 | test 'it exists', (assert) -> 7 | view = @subject() 8 | assert.ok view 9 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from '../../resolver'; 2 | import config from '../../config/environment'; 3 | 4 | const resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log 17 | testem.log 18 | -------------------------------------------------------------------------------- /blueprints/component-test/files/tests/__testType__/__path__/__test__.coffee: -------------------------------------------------------------------------------- 1 | import { test, moduleForComponent } from 'ember-qunit'<%= testImports %> 2 | 3 | moduleForComponent '<%= componentPathName %>', '<%= friendlyTestDescription %>', { 4 | <%= testOptions %> 5 | } 6 | 7 | test 'it renders', (assert) -> 8 | <%= testContent %> 9 | -------------------------------------------------------------------------------- /node-tests/helpers/expect-coffee.js: -------------------------------------------------------------------------------- 1 | var coffeescript = require('coffee-script'); 2 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 3 | 4 | module.exports = function(file) { 5 | var compileFunc = function() { 6 | coffeescript.compile(file.content); 7 | } 8 | 9 | expect(compileFunc).to.not.throw(Error); 10 | } 11 | -------------------------------------------------------------------------------- /blueprints/mixin-test/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates a mixin unit test.', 5 | 6 | locals: function() { 7 | var blueprint = ancestralBlueprint('mixin-test', this.project); 8 | return blueprint.locals.apply(blueprint, arguments); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /blueprints/model-test/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates a model unit test.', 5 | 6 | locals: function() { 7 | var blueprint = ancestralBlueprint('model-test', this.project); 8 | return blueprint.locals.apply(blueprint, arguments); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /blueprints/helper-test/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates a helper unit test.', 5 | 6 | locals: function() { 7 | var blueprint = ancestralBlueprint('helper-test', this.project); 8 | return blueprint.locals.apply(blueprint, arguments); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /blueprints/util-test/qunit-files/tests/unit/utils/__name__-test.coffee: -------------------------------------------------------------------------------- 1 | import <%= camelizedModuleName %> from '../../../utils/<%= dasherizedModuleName %>' 2 | import { module, test } from 'qunit' 3 | 4 | module '<%= friendlyTestName %>' 5 | 6 | # Replace this with your real tests. 7 | test 'it works', (assert) -> 8 | result = <%= camelizedModuleName %>() 9 | assert.ok result 10 | -------------------------------------------------------------------------------- /blueprints/adapter-test/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates an ember-data adapter unit test.', 5 | 6 | locals: function() { 7 | var blueprint = ancestralBlueprint('adapter-test', this.project); 8 | return blueprint.locals.apply(blueprint, arguments); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /blueprints/helper/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates a helper function.', 5 | 6 | normalizeEntityName: function() { 7 | var blueprint = ancestralBlueprint('helper', this.project); 8 | return blueprint.normalizeEntityName.apply(blueprint, arguments); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /blueprints/initializer-test/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates an initializer unit test.', 5 | 6 | locals: function() { 7 | var blueprint = ancestralBlueprint('initializer-test', this.project); 8 | return blueprint.locals.apply(blueprint, arguments); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /blueprints/route-test/qunit-files/tests/unit/__path__/__test__.coffee: -------------------------------------------------------------------------------- 1 | import { moduleFor, test } from 'ember-qunit' 2 | 3 | moduleFor 'route:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { 4 | # Specify the other units that are required for this test. 5 | # needs: ['controller:foo'] 6 | } 7 | 8 | test 'it exists', (assert) -> 9 | route = @subject() 10 | assert.ok route 11 | -------------------------------------------------------------------------------- /blueprints/helper-test/files/tests/unit/helpers/__name__-test.coffee: -------------------------------------------------------------------------------- 1 | import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>' 2 | import { module, test } from 'qunit' 3 | 4 | module '<%= friendlyTestName %>' 5 | 6 | # Replace this with your real tests. 7 | test 'it works', (assert) -> 8 | result = <%= camelizedModuleName %> 42 9 | assert.ok result 10 | -------------------------------------------------------------------------------- /tests/acceptance/index-test.js: -------------------------------------------------------------------------------- 1 | import { test } from 'qunit'; 2 | import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; 3 | 4 | moduleForAcceptance('Acceptance | index'); 5 | 6 | test('visiting /', function(assert) { 7 | visit('/'); 8 | 9 | andThen(() => { 10 | assert.equal(currentURL(), '/'); 11 | assert.equal(find('.test-result').text(), 'Howdy'); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /blueprints/controller-test/files/tests/unit/__path__/__test__.coffee: -------------------------------------------------------------------------------- 1 | import { moduleFor, test } from 'ember-qunit' 2 | 3 | moduleFor 'controller:<%= dasherizedModuleName %>', { 4 | # Specify the other units that are required for this test. 5 | # needs: ['controller:foo'] 6 | } 7 | 8 | # Replace this with your real tests. 9 | test 'it exists', (assert) -> 10 | controller = @subject() 11 | assert.ok controller 12 | -------------------------------------------------------------------------------- /blueprints/acceptance-test/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates an acceptance test for a feature.', 5 | locals: function() { 6 | var blueprint = ancestralBlueprint('acceptance-test', this.project); 7 | blueprint.project = this.project; 8 | return blueprint.locals.apply(blueprint, arguments); 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /blueprints/adapter-test/files/tests/unit/__path__/__test__.coffee: -------------------------------------------------------------------------------- 1 | import { moduleFor, test } from 'ember-qunit' 2 | 3 | moduleFor 'adapter:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { 4 | # Specify the other units that are required for this test. 5 | # needs: ['serializer:foo'] 6 | } 7 | 8 | # Replace this with your real tests. 9 | test 'it exists', (assert) -> 10 | adapter = @subject() 11 | assert.ok adapter 12 | -------------------------------------------------------------------------------- /blueprints/model-test/files/tests/unit/__path__/__test__.coffee: -------------------------------------------------------------------------------- 1 | import { moduleForModel, test } from 'ember-qunit' 2 | 3 | moduleForModel '<%= dasherizedModuleName %>', '<%= friendlyDescription %>', { 4 | # Specify the other units that are required for this test. 5 | <%= typeof needs !== 'undefined' ? needs : '' %> 6 | } 7 | 8 | test 'it exists', (assert) -> 9 | model = @subject() 10 | # store = @store() 11 | assert.ok !!model 12 | -------------------------------------------------------------------------------- /blueprints/service-test/qunit-files/tests/unit/services/__name__-test.coffee: -------------------------------------------------------------------------------- 1 | import { moduleFor, test } from 'ember-qunit' 2 | 3 | moduleFor 'service:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { 4 | # Specify the other units that are required for this test. 5 | # needs: ['service:foo'] 6 | } 7 | 8 | # Replace this with your real tests. 9 | test 'it exists', (assert) -> 10 | service = @subject() 11 | assert.ok service 12 | -------------------------------------------------------------------------------- /blueprints/transform-test/qunit-files/tests/unit/__path__/__test__.coffee: -------------------------------------------------------------------------------- 1 | import { moduleFor, test } from 'ember-qunit' 2 | 3 | moduleFor 'transform:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { 4 | # Specify the other units that are required for this test. 5 | # needs: ['serializer:foo'] 6 | } 7 | 8 | # Replace this with your real tests. 9 | test 'it exists', (assert) -> 10 | transform = @subject() 11 | assert.ok transform 12 | -------------------------------------------------------------------------------- /tests/dummy/app/app.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | import Resolver from './resolver' 3 | import loadInitializers from 'ember-load-initializers' 4 | import config from './config/environment' 5 | 6 | App = null 7 | 8 | Ember.MODEL_FACTORY_INJECTIONS = true 9 | 10 | App = Ember.Application.extend 11 | modulePrefix: config.modulePrefix 12 | podModulePrefix: config.podModulePrefix 13 | Resolver: Resolver 14 | 15 | loadInitializers App, config.modulePrefix 16 | 17 | export default App 18 | -------------------------------------------------------------------------------- /blueprints/mixin-test/files/tests/unit/mixins/__name__-test.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | import <%= classifiedModuleName %>Mixin from '../../../mixins/<%= dasherizedModuleName %>' 3 | import { module, test } from 'qunit' 4 | 5 | module '<%= friendlyTestName %>' 6 | 7 | # Replace this with your real tests. 8 | test 'it works', (assert) -> 9 | <%= classifiedModuleName %>Object = Ember.Object.extend <%= classifiedModuleName %>Mixin 10 | subject = <%= classifiedModuleName %>Object.create() 11 | assert.ok subject 12 | -------------------------------------------------------------------------------- /blueprints/serializer-test/qunit-files/tests/unit/__path__/__test__.coffee: -------------------------------------------------------------------------------- 1 | import { moduleForModel, test } from 'ember-qunit' 2 | 3 | moduleForModel '<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', 4 | # Specify the other units that are required for this test. 5 | needs: ['serializer:<%= dasherizedModuleName %>'] 6 | 7 | # Replace this with your real tests. 8 | test 'it serializes records', (assert) -> 9 | record = @subject() 10 | 11 | serializedRecord = record.serialize() 12 | 13 | assert.ok serializedRecord 14 | -------------------------------------------------------------------------------- /blueprints/adapter/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates an ember-data adapter.', 5 | 6 | availableOptions: [ 7 | { name: 'base-class', type: String } 8 | ], 9 | locals: function() { 10 | var blueprint = ancestralBlueprint('adapter', this.project); 11 | var locals = blueprint.locals.apply(blueprint, arguments); 12 | locals.importStatement = locals.importStatement.replace(/;$/, ''); 13 | return locals; 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /blueprints/addon-import/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates an import wrapper', 5 | 6 | fileMapTokens: function() { 7 | var blueprint = ancestralBlueprint('addon-import', this.project); 8 | return blueprint.fileMapTokens.apply(blueprint, arguments); 9 | }, 10 | 11 | locals: function() { 12 | var blueprint = ancestralBlueprint('addon-import', this.project); 13 | return blueprint.locals.apply(blueprint, arguments); 14 | } 15 | }; 16 | -------------------------------------------------------------------------------- /tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Application from '../../app'; 3 | import config from '../../config/environment'; 4 | 5 | export default function startApp(attrs) { 6 | let application; 7 | 8 | let attributes = Ember.merge({}, config.APP); 9 | attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; 10 | 11 | Ember.run(() => { 12 | application = Application.create(attributes); 13 | application.setupForTesting(); 14 | application.injectTestHelpers(); 15 | }); 16 | 17 | return application; 18 | } 19 | -------------------------------------------------------------------------------- /ember-cli-build.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | /* global require, module */ 3 | var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 4 | 5 | module.exports = function(defaults) { 6 | var app = new EmberAddon(defaults, { 7 | // Add options here 8 | }); 9 | 10 | /* 11 | This build file specifies the options for the dummy test app of this 12 | addon, located in `/tests/dummy` 13 | This build file does *not* influence how the addon or the app using it 14 | behave. You most likely want to be modifying `./index.js` or app's build file 15 | */ 16 | 17 | return app.toTree(); 18 | }; 19 | -------------------------------------------------------------------------------- /tests/helpers/module-for-acceptance.js: -------------------------------------------------------------------------------- 1 | import { module } from 'qunit'; 2 | import startApp from '../helpers/start-app'; 3 | import destroyApp from '../helpers/destroy-app'; 4 | 5 | export default function(name, options = {}) { 6 | module(name, { 7 | beforeEach() { 8 | this.application = startApp(); 9 | 10 | if (options.beforeEach) { 11 | options.beforeEach.apply(this, arguments); 12 | } 13 | }, 14 | 15 | afterEach() { 16 | if (options.afterEach) { 17 | options.afterEach.apply(this, arguments); 18 | } 19 | 20 | destroyApp(this.application); 21 | } 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | - "4" 5 | 6 | sudo: false 7 | 8 | cache: 9 | directories: 10 | - $HOME/.npm 11 | - $HOME/.cache # includes bowers cache 12 | 13 | env: 14 | - EMBER_TRY_SCENARIO=default 15 | - EMBER_TRY_SCENARIO=ember-1-13 16 | - EMBER_TRY_SCENARIO=ember-release 17 | - EMBER_TRY_SCENARIO=ember-beta 18 | - EMBER_TRY_SCENARIO=ember-canary 19 | - NODE_TESTS=true 20 | 21 | matrix: 22 | fast_finish: true 23 | allow_failures: 24 | - env: EMBER_TRY_SCENARIO=ember-canary 25 | 26 | before_install: ./scripts/before-install.sh 27 | install: ./scripts/install.sh 28 | script: ./scripts/run-tests.sh 29 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "-Promise" 6 | ], 7 | "browser": true, 8 | "boss": true, 9 | "curly": true, 10 | "debug": false, 11 | "devel": true, 12 | "eqeqeq": true, 13 | "evil": true, 14 | "forin": false, 15 | "immed": false, 16 | "laxbreak": false, 17 | "newcap": true, 18 | "noarg": true, 19 | "noempty": false, 20 | "nonew": false, 21 | "nomen": false, 22 | "onevar": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": false, 29 | "eqnull": true, 30 | "esnext": true, 31 | "unused": true 32 | } 33 | -------------------------------------------------------------------------------- /tests/dummy/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /node-tests/expect-coffee-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 4 | var expectCoffee = require('./helpers/expect-coffee'); 5 | 6 | describe('Unit: expect-coffee', function() { 7 | it('throws on invalid coffee-script', function() { 8 | var testFunc = function() { 9 | expectCoffee({ content: 'var x = 1;' }); 10 | } 11 | 12 | expect(testFunc).to.throw(Error); 13 | }); 14 | 15 | it('does not throw on valid coffee-script', function() { 16 | var testFunc = function() { 17 | expectCoffee({ content: 'x = 1' }); 18 | } 19 | 20 | expect(testFunc).to.not.throw(Error); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.js] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.hbs] 21 | insert_final_newline = false 22 | indent_style = space 23 | indent_size = 2 24 | 25 | [*.css] 26 | indent_style = space 27 | indent_size = 2 28 | 29 | [*.html] 30 | indent_style = space 31 | indent_size = 2 32 | 33 | [*.{diff,md}] 34 | trim_trailing_whitespace = false 35 | -------------------------------------------------------------------------------- /blueprints/initializer-test/files/tests/unit/initializers/__name__-test.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>' 3 | import { module, test } from 'qunit' 4 | 5 | application = null 6 | registry = null 7 | 8 | module '<%= friendlyTestName %>', 9 | beforeEach: -> 10 | Ember.run -> 11 | application = Ember.Application.create() 12 | registry = application.registry 13 | application.deferReadiness() 14 | 15 | # Replace this with your real tests. 16 | test 'it works', (assert) -> 17 | initialize registry, application 18 | 19 | # you would normally confirm the results of the initializer here 20 | assert.ok true 21 | -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | 12 | 13 | 14 | 15 | {{content-for "head-footer"}} 16 | 17 | 18 | {{content-for "body"}} 19 | 20 | 21 | 22 | 23 | {{content-for "body-footer"}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /blueprints/acceptance-test/files/tests/acceptance/__name__-test.coffee: -------------------------------------------------------------------------------- 1 | import Ember from 'ember' 2 | import { module, test } from 'qunit' 3 | import startApp from '<%= testFolderRoot %>/tests/helpers/start-app' 4 | 5 | module 'Acceptance: <%= classifiedModuleName %>', 6 | beforeEach: -> 7 | @application = startApp() 8 | ### 9 | Don't return anything, because QUnit looks for a .then 10 | that is present on Ember.Application, but is deprecated. 11 | ### 12 | return 13 | 14 | afterEach: -> 15 | Ember.run @application, 'destroy' 16 | 17 | test 'visiting /<%= dasherizedModuleName %>', (assert) -> 18 | visit '/<%= dasherizedModuleName %>' 19 | 20 | andThen -> 21 | assert.equal currentURL(), '/<%= dasherizedModuleName %>' 22 | -------------------------------------------------------------------------------- /node-tests/blueprints/template-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | 10 | describe('Acceptance: ember generate and destroy template', function() { 11 | setupTestHooks(this); 12 | 13 | it('template foo', function() { 14 | var args = ['template', 'foo']; 15 | 16 | return emberNew() 17 | .then(() => emberGenerateDestroy(args, (file) => { 18 | expect(file('app/templates/foo.hbs')).to.exist; 19 | })); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /blueprints/component-addon/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates a component. Name must contain a hyphen.', 5 | 6 | fileMapTokens: function() { 7 | var blueprint = ancestralBlueprint('component-addon', this.project); 8 | return blueprint.fileMapTokens.apply(blueprint, arguments); 9 | }, 10 | 11 | normalizeEntityName: function() { 12 | var blueprint = ancestralBlueprint('component-addon', this.project); 13 | return blueprint.normalizeEntityName.apply(blueprint, arguments); 14 | }, 15 | 16 | locals: function() { 17 | var blueprint = ancestralBlueprint('component-addon', this.project); 18 | return blueprint.locals.apply(blueprint, arguments); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /lib/coffee-preprocessor.js: -------------------------------------------------------------------------------- 1 | var coffee = require('broccoli-coffee'); 2 | var coffeelintTree = require('./coffee-linter'); 3 | var fs = require('fs'); 4 | 5 | function CoffeePreprocessor(options) { 6 | this.name = 'ember-cli-coffeescript'; 7 | this.options = options || {}; 8 | } 9 | 10 | CoffeePreprocessor.prototype.ext = coffee.prototype.extensions; 11 | 12 | CoffeePreprocessor.prototype.toTree = function(tree, inputPath, outputPath) { 13 | 14 | if(this.options.lint || (this.options.lint !== false && fs.existsSync("./coffeelint.json"))){ 15 | tree = coffeelintTree(tree, this.options.lint); 16 | } 17 | 18 | var options = { 19 | bare: true, 20 | srcDir: inputPath, 21 | destDir: outputPath 22 | }; 23 | return coffee(tree, options); 24 | }; 25 | 26 | module.exports = CoffeePreprocessor; 27 | -------------------------------------------------------------------------------- /lib/utilities/ancestral-blueprint.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var Blueprint = require('ember-cli/lib/models/blueprint'); 4 | var path = require('path'); 5 | var coffeeScriptPath = path.resolve(__dirname, '../..', 'blueprints'); 6 | 7 | /** 8 | Find the non-coffeescript version of the blueprint to bootstrap off 9 | */ 10 | module.exports = function(dasherizedName, project) { 11 | var projectPaths = project ? project.blueprintLookupPaths() : []; 12 | 13 | projectPaths = projectPaths.filter(function(p) { 14 | return p !== coffeeScriptPath; 15 | }); 16 | 17 | projectPaths = projectPaths.concat(legacyBlueprintsPath()); 18 | 19 | return Blueprint.lookup(dasherizedName, { 20 | paths: projectPaths 21 | }); 22 | }; 23 | 24 | function legacyBlueprintsPath() { 25 | return path.join( 26 | path.dirname( 27 | require.resolve('ember-cli-legacy-blueprints') 28 | ), 29 | 'blueprints' 30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /node-tests/blueprints/addon-import-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy addon-import', function() { 12 | setupTestHooks(this); 13 | 14 | it('addon-import foo', function() { 15 | var args = ['addon-import', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var importFile = file('app/addon-imports/foo.js'); 20 | 21 | expect(importFile) 22 | .to.contain("export { default } from 'my-app/addon-imports/foo';"); 23 | })); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /node-tests/blueprints/helper-addon-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy helper-addon', function() { 12 | setupTestHooks(this); 13 | 14 | it('helper-addon foo-bar', function() { 15 | var args = ['helper-addon', 'foo-bar']; 16 | 17 | return emberNew({target: 'addon'}) 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var helperFile = file('app/helpers/foo-bar.js'); 20 | 21 | expect(helperFile) 22 | .to.contain("export { default, fooBar } from 'my-addon/helpers/foo-bar';"); 23 | })); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /node-tests/blueprints/component-addon-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy component-addon', function() { 12 | setupTestHooks(this); 13 | 14 | it('component-addon foo-bar', function() { 15 | var args = ['component-addon', 'foo-bar']; 16 | 17 | return emberNew({target: 'addon'}) 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var componentFile = file('app/components/foo-bar.js'); 20 | 21 | expect(componentFile) 22 | .to.contain("export { default } from 'my-addon/components/foo-bar';"); 23 | })); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /node-tests/blueprints/initializer-addon-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy initializer-addon', function() { 12 | setupTestHooks(this); 13 | 14 | it('initializer-addon foo-bar', function() { 15 | var args = ['initializer-addon', 'foo-bar']; 16 | 17 | return emberNew({ target: 'addon' }) 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var initializerFile = file('app/initializers/foo-bar.js'); 20 | 21 | expect(initializerFile) 22 | .to.contain("export { default, initialize } from 'my-addon/initializers/foo-bar';"); 23 | })); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /tests/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "location", 6 | "setTimeout", 7 | "$", 8 | "-Promise", 9 | "define", 10 | "console", 11 | "visit", 12 | "exists", 13 | "fillIn", 14 | "click", 15 | "keyEvent", 16 | "triggerEvent", 17 | "find", 18 | "findWithAssert", 19 | "wait", 20 | "DS", 21 | "andThen", 22 | "currentURL", 23 | "currentPath", 24 | "currentRouteName" 25 | ], 26 | "node": false, 27 | "browser": false, 28 | "boss": true, 29 | "curly": true, 30 | "debug": false, 31 | "devel": false, 32 | "eqeqeq": true, 33 | "evil": true, 34 | "forin": false, 35 | "immed": false, 36 | "laxbreak": false, 37 | "newcap": true, 38 | "noarg": true, 39 | "noempty": false, 40 | "nonew": false, 41 | "nomen": false, 42 | "onevar": false, 43 | "plusplus": false, 44 | "regexp": false, 45 | "undef": true, 46 | "sub": true, 47 | "strict": false, 48 | "white": false, 49 | "eqnull": true, 50 | "esnext": true, 51 | "unused": true 52 | } 53 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 4 | 5 | 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: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | 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. 10 | -------------------------------------------------------------------------------- /node-tests/blueprints/test-helper-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy test-helper', function() { 12 | setupTestHooks(this); 13 | 14 | it('test-helper foo', function() { 15 | var args = ['test-helper', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var testHelperFile = file('tests/helpers/foo.coffee'); 20 | 21 | expect(testHelperFile) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain('foo = (app) ->') 24 | .to.contain("export default Ember.Test.registerAsyncHelper('foo', foo)"); 25 | 26 | expectCoffee(testHelperFile); 27 | })); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /node-tests/blueprints/route-addon-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy route-addon', function() { 12 | setupTestHooks(this); 13 | 14 | it('route-addon foo', function() { 15 | var args = ['route-addon', 'foo']; 16 | 17 | return emberNew({ target: 'addon' }) 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var routeFile = file('app/routes/foo.js'); 20 | 21 | expect(routeFile) 22 | .to.contain("export { default } from 'my-addon/routes/foo';"); 23 | 24 | var templateFile = file('app/templates/foo.js'); 25 | 26 | expect(templateFile) 27 | .to.contain("export { default } from 'my-addon/templates/foo';"); 28 | })); 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy Tests 7 | 8 | 9 | 10 | {{content-for "head"}} 11 | {{content-for "test-head"}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for "head-footer"}} 18 | {{content-for "test-head-footer"}} 19 | 20 | 21 | {{content-for "body"}} 22 | {{content-for "test-body"}} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | {{content-for "body-footer"}} 32 | {{content-for "test-body-footer"}} 33 | 34 | 35 | -------------------------------------------------------------------------------- /config/ember-try.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = { 3 | scenarios: [ 4 | { 5 | name: 'default', 6 | bower: { 7 | dependencies: { } 8 | } 9 | }, 10 | { 11 | name: 'ember-1-13', 12 | bower: { 13 | dependencies: { 14 | 'ember': '~1.13.0' 15 | }, 16 | resolutions: { 17 | 'ember': '~1.13.0' 18 | } 19 | } 20 | }, 21 | { 22 | name: 'ember-release', 23 | bower: { 24 | dependencies: { 25 | 'ember': 'components/ember#release' 26 | }, 27 | resolutions: { 28 | 'ember': 'release' 29 | } 30 | } 31 | }, 32 | { 33 | name: 'ember-beta', 34 | bower: { 35 | dependencies: { 36 | 'ember': 'components/ember#beta' 37 | }, 38 | resolutions: { 39 | 'ember': 'beta' 40 | } 41 | } 42 | }, 43 | { 44 | name: 'ember-canary', 45 | bower: { 46 | dependencies: { 47 | 'ember': 'components/ember#canary' 48 | }, 49 | resolutions: { 50 | 'ember': 'canary' 51 | } 52 | } 53 | } 54 | ] 55 | }; 56 | -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 3 | module.exports = function(environment) { 4 | var ENV = { 5 | modulePrefix: 'dummy', 6 | environment: environment, 7 | baseURL: '/', 8 | locationType: 'auto', 9 | EmberENV: { 10 | FEATURES: { 11 | // Here you can enable experimental features on an ember canary build 12 | // e.g. 'with-controller': true 13 | } 14 | }, 15 | 16 | APP: { 17 | // Here you can pass flags/options to your application instance 18 | // when it is created 19 | } 20 | }; 21 | 22 | if (environment === 'development') { 23 | // ENV.APP.LOG_RESOLVER = true; 24 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 25 | // ENV.APP.LOG_TRANSITIONS = true; 26 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 27 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 28 | } 29 | 30 | if (environment === 'test') { 31 | // Testem prefers this... 32 | ENV.baseURL = '/'; 33 | ENV.locationType = 'none'; 34 | 35 | // keep test console output quieter 36 | ENV.APP.LOG_ACTIVE_GENERATION = false; 37 | ENV.APP.LOG_VIEW_LOOKUPS = false; 38 | 39 | ENV.APP.rootElement = '#ember-testing'; 40 | } 41 | 42 | if (environment === 'production') { 43 | 44 | } 45 | 46 | return ENV; 47 | }; 48 | -------------------------------------------------------------------------------- /node-tests/blueprints/controller-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy controller', function() { 12 | setupTestHooks(this); 13 | 14 | it('controller foo', function() { 15 | var args = ['controller', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var controllerFile = file('app/controllers/foo.coffee'); 20 | 21 | expect(controllerFile) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain('export default Ember.Controller.extend()'); 24 | 25 | expectCoffee(controllerFile); 26 | 27 | var controllerTestFile = file('tests/unit/controllers/foo-test.coffee'); 28 | 29 | expect(controllerTestFile) 30 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 31 | .to.contain("moduleFor 'controller:foo'"); 32 | 33 | expectCoffee(controllerTestFile); 34 | })); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | var path = require('path'); 4 | var chalk = require('chalk'); 5 | var defaults = require('lodash.defaults'); 6 | 7 | var VersionChecker = require('ember-cli-version-checker'); 8 | 9 | var CoffeePreprocessor = require('./lib/coffee-preprocessor'); 10 | 11 | module.exports = { 12 | name: 'Ember CLI Coffeescript Addon', 13 | 14 | shouldSetupRegistryInIncluded: function() { 15 | var checker = new VersionChecker(this); 16 | 17 | return !checker.for('ember-cli', 'npm').isAbove('0.2.0'); 18 | }, 19 | 20 | getConfig: function() { 21 | var brocfileConfig = {}; 22 | var coffeeOptions = defaults(this.project.config(process.env.EMBER_ENV).coffeeOptions || {}, 23 | brocfileConfig, { 24 | blueprints: true 25 | }); 26 | 27 | return coffeeOptions; 28 | }, 29 | 30 | blueprintsPath: function() { 31 | if (this.getConfig().blueprints) { 32 | return path.join(__dirname, 'blueprints'); 33 | } 34 | }, 35 | 36 | setupPreprocessorRegistry: function(type, registry) { 37 | var plugin = new CoffeePreprocessor(this.getConfig()); 38 | 39 | registry.add('js', plugin); 40 | }, 41 | 42 | included: function(app) { 43 | this.app = app; 44 | 45 | if (this.shouldSetupRegistryInIncluded()) { 46 | this.setupPreprocessorRegistry('parent', app.registry); 47 | } 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /node-tests/blueprints/acceptance-test-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy acceptance-test', function() { 12 | setupTestHooks(this); 13 | 14 | it('acceptance-test foo', function() { 15 | var args = ['acceptance-test', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var acceptanceFile = file('tests/acceptance/foo-test.coffee'); 20 | 21 | expect(acceptanceFile) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain("import { module, test } from 'qunit'") 24 | .to.contain("import startApp from 'my-app/tests/helpers/start-app'") 25 | .to.contain("module 'Acceptance: Foo',") 26 | .to.contain("test 'visiting /foo', (assert) ->") 27 | .to.contain("visit '/foo'") 28 | .to.contain("andThen ->") 29 | .to.contain("assert.equal currentURL(), '/foo'"); 30 | 31 | expectCoffee(acceptanceFile); 32 | })); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /blueprints/component/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | module.exports = { 4 | description: 'Generates a component. Name must contain a hyphen.', 5 | 6 | availableOptions: [ 7 | { 8 | name: 'path', 9 | type: String, 10 | default: 'components', 11 | aliases: [ 12 | { 'no-path': '' } 13 | ] 14 | } 15 | ], 16 | 17 | fileMapTokens: function() { 18 | var blueprint = ancestralBlueprint('component', this.project); 19 | return blueprint.fileMapTokens.apply(blueprint, arguments); 20 | }, 21 | 22 | normalizeEntityName: function() { 23 | var blueprint = ancestralBlueprint('component', this.project); 24 | return blueprint.normalizeEntityName.apply(blueprint, arguments); 25 | }, 26 | 27 | locals: function() { 28 | var blueprint = ancestralBlueprint('component', this.project); 29 | var locals = blueprint.locals.apply(blueprint, arguments); 30 | 31 | // This is here to work around this bug in ember-cli: 32 | // https://github.com/ember-cli/ember-cli/issues/4001 33 | if (!this.project) { 34 | return locals; 35 | } 36 | 37 | var newContents = ''; 38 | if (locals.contents) { 39 | newContents = locals.contents + '\n'; 40 | } 41 | 42 | locals.contents = newContents; 43 | locals.importTemplate = locals.importTemplate.replace(/;/, ''); 44 | 45 | return locals; 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /node-tests/blueprints/helper-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy helper', function() { 12 | setupTestHooks(this); 13 | 14 | it('helper foo-bar', function() { 15 | var args = ['helper', 'foo-bar']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var helperFile = file('app/helpers/foo-bar.coffee'); 20 | 21 | expect(helperFile) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain('export fooBar = (params) ->') 24 | .to.contain('export default Ember.Helper.helper fooBar'); 25 | 26 | expectCoffee(helperFile); 27 | 28 | var helperTestFile = file('tests/unit/helpers/foo-bar-test.coffee'); 29 | 30 | expect(helperTestFile) 31 | .to.contain("import { fooBar } from 'my-app/helpers/foo-bar'") 32 | .to.contain("module 'Unit | Helper | foo bar'") 33 | .to.contain("result = fooBar 42"); 34 | 35 | expectCoffee(helperTestFile); 36 | })); 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /node-tests/blueprints/initializer-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy initializer', function() { 12 | setupTestHooks(this); 13 | 14 | it('initializer foo-bar', function() { 15 | var args = ['initializer', 'foo-bar']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var initializerFile = file('app/initializers/foo-bar.coffee'); 20 | 21 | expect(file('app/initializers/foo-bar.coffee')) 22 | .to.contain('export initialize = () ->') 23 | .to.contain('export default {') 24 | .to.contain("name: 'foo-bar'") 25 | .to.contain("initialize: initialize"); 26 | 27 | expectCoffee(initializerFile); 28 | 29 | var initializerTestFile = file('tests/unit/initializers/foo-bar-test.coffee'); 30 | 31 | expect(initializerTestFile) 32 | .to.contain("import Ember from 'ember'") 33 | .to.contain("import { initialize } from 'my-app/initializers/foo-bar'") 34 | .to.contain("import { module, test } from 'qunit'") 35 | .to.contain("module 'Unit | Initializer | foo bar'"); 36 | 37 | expectCoffee(initializerTestFile); 38 | })); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /node-tests/blueprints/component-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy component', function() { 12 | setupTestHooks(this); 13 | 14 | it('component x-foo', function() { 15 | var args = ['component', 'x-foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var componentFile = file('app/components/x-foo.coffee'); 20 | 21 | expect(componentFile) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain('export default Ember.Component.extend()') 24 | .to.not.contain('layout'); 25 | 26 | expectCoffee(componentFile); 27 | 28 | expect(file('app/templates/components/x-foo.hbs')) 29 | .to.contain('{{yield}}'); 30 | 31 | var componentTestFile = file('tests/integration/components/x-foo-test.coffee'); 32 | 33 | expect(componentTestFile) 34 | .to.contain("import { test, moduleForComponent } from 'ember-qunit'") 35 | .to.contain("import hbs from 'htmlbars-inline-precompile'") 36 | .to.contain("moduleForComponent 'x-foo', 'Integration | Component | x foo'") 37 | .to.contain('integration: true') 38 | .to.contain('{{x-foo}}') 39 | .to.contain('{{#x-foo}}'); 40 | 41 | expectCoffee(componentTestFile); 42 | })); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /node-tests/blueprints/adapter-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy adapter', function() { 12 | setupTestHooks(this); 13 | 14 | it('adapter foo', function() { 15 | var args = ['adapter', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var adapterFile = file('app/adapters/foo.coffee'); 20 | 21 | expect(adapterFile) 22 | .to.contain("import ApplicationAdapter from './application'") 23 | .to.contain('export default ApplicationAdapter.extend()'); 24 | 25 | expectCoffee(adapterFile); 26 | 27 | var adapterTestFile = file('tests/unit/adapters/foo-test.coffee'); 28 | 29 | expect(adapterTestFile) 30 | .to.contain("moduleFor 'adapter:foo'") 31 | 32 | expectCoffee(adapterTestFile); 33 | })); 34 | }); 35 | 36 | it('adapter-test foo', function() { 37 | var args = ['adapter-test', 'foo']; 38 | 39 | return emberNew() 40 | .then(() => emberGenerateDestroy(args, (file) => { 41 | var adapterTestFile = file('tests/unit/adapters/foo-test.coffee'); 42 | 43 | expect(adapterTestFile) 44 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 45 | .to.contain("moduleFor 'adapter:foo'") 46 | 47 | expectCoffee(adapterTestFile); 48 | })); 49 | }); 50 | }); 51 | -------------------------------------------------------------------------------- /node-tests/blueprints/model-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy model', function() { 12 | setupTestHooks(this); 13 | 14 | it('model foo', function() { 15 | var args = ['model', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var modelFile = file('app/models/foo.coffee'); 20 | 21 | expect(modelFile) 22 | .to.contain("import DS from 'ember-data'") 23 | .to.contain('export default DS.Model.extend {'); 24 | 25 | expectCoffee(modelFile); 26 | 27 | var modelTestFile = file('tests/unit/models/foo-test.coffee'); 28 | 29 | expect(modelTestFile) 30 | .to.contain("import { moduleForModel, test } from 'ember-qunit'") 31 | .to.contain("moduleForModel 'foo', 'Unit | Model | foo', {") 32 | .to.contain("needs: []"); 33 | 34 | expectCoffee(modelTestFile); 35 | })); 36 | }); 37 | 38 | it('model-test foo', function() { 39 | var args = ['model-test', 'foo']; 40 | 41 | return emberNew() 42 | .then(() => emberGenerateDestroy(args, (file) => { 43 | var modelTestFile = file('tests/unit/models/foo-test.coffee'); 44 | 45 | expect(modelTestFile) 46 | .to.contain("moduleForModel 'foo'"); 47 | 48 | expectCoffee(modelTestFile); 49 | })); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /node-tests/blueprints/resource-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var chai = require('ember-cli-blueprint-test-helpers/chai'); 9 | var expect = chai.expect; 10 | var file = chai.file; 11 | 12 | describe('Acceptance: ember generate and destroy resource', function() { 13 | setupTestHooks(this); 14 | 15 | it.skip('resource foo', function() { 16 | var args = ['resource', 'foo']; 17 | 18 | return emberNew() 19 | .then(() => emberGenerateDestroy(args, (_file) => { 20 | expect(_file('app/routes/foo.coffee')) 21 | .to.contain("import Ember from 'ember'") 22 | .to.contain('FooRoute = Ember.Route.extend()') 23 | .to.contain("export default FooRoute"); 24 | 25 | expect(_file('app/templates/foo.hbs')) 26 | .to.contain('{{outlet}}'); 27 | 28 | expect(_file('tests/unit/routes/foo-test.coffee')) 29 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 30 | .to.contain("moduleFor 'route:foo'"); 31 | 32 | expect(_file('app/models/foo.coffee')) 33 | .to.contain("import DS from 'ember-data'") 34 | .to.contain('Foo = DS.Model.extend {') 35 | .to.contain("export default Foo"); 36 | 37 | expect(_file('tests/unit/models/foo-test.coffee')) 38 | .to.contain("moduleForModel 'foo'"); 39 | 40 | expect(file('app/router.coffee')) 41 | .to.contain("@route 'foo'"); 42 | })) 43 | .then(() => expect(file('app/router.coffee')) 44 | .to.not.contain("@route 'foo'")); 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /node-tests/blueprints/view-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy view', function() { 12 | setupTestHooks(this); 13 | 14 | it('view foo', function() { 15 | var args = ['view', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var viewFile = file('app/views/foo.coffee'); 20 | 21 | expect(viewFile) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain('export default Ember.View.extend()'); 24 | 25 | expectCoffee(viewFile); 26 | 27 | var viewTestFile = file('tests/unit/views/foo-test.coffee'); 28 | 29 | expect(viewTestFile) 30 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 31 | .to.contain("moduleFor 'view:foo', 'Unit | View | foo'"); 32 | 33 | expectCoffee(viewTestFile); 34 | })); 35 | }); 36 | 37 | it('view-test foo', function() { 38 | var args = ['view-test', 'foo']; 39 | 40 | return emberNew() 41 | .then(() => emberGenerateDestroy(args, (file) => { 42 | var testFile = file('tests/unit/views/foo-test.coffee'); 43 | 44 | expect(testFile) 45 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 46 | .to.contain("moduleFor 'view:foo', 'Unit | View | foo'"); 47 | 48 | expectCoffee(testFile); 49 | })); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /node-tests/blueprints/service-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy service', function() { 12 | setupTestHooks(this); 13 | 14 | it('service foo', function() { 15 | var args = ['service', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var serviceFile = file('app/services/foo.coffee'); 20 | 21 | expect(serviceFile) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain('export default Ember.Service.extend()'); 24 | 25 | expectCoffee(serviceFile); 26 | 27 | var serviceTestFile = file('tests/unit/services/foo-test.coffee'); 28 | 29 | expect(serviceTestFile) 30 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 31 | .to.contain("moduleFor 'service:foo', 'Unit | Service | foo', {"); 32 | 33 | expectCoffee(serviceTestFile); 34 | })); 35 | }); 36 | 37 | it('service-test foo', function() { 38 | var args = ['service-test', 'foo']; 39 | 40 | return emberNew() 41 | .then(() => emberGenerateDestroy(args, (file) => { 42 | var serviceTestFile = file('tests/unit/services/foo-test.coffee'); 43 | 44 | expect(serviceTestFile) 45 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 46 | .to.contain("moduleFor 'service:foo', 'Unit | Service | foo', {"); 47 | 48 | expectCoffee(serviceTestFile); 49 | })); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /node-tests/blueprints/transform-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy transform', function() { 12 | setupTestHooks(this); 13 | 14 | it('transform foo', function() { 15 | var args = ['transform', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var transformFile = file('app/transforms/foo.coffee'); 20 | 21 | expect(transformFile) 22 | .to.contain("import DS from 'ember-data'") 23 | .to.contain('export default DS.Transform.extend'); 24 | 25 | expectCoffee(transformFile); 26 | 27 | var transformTestFile = file('tests/unit/transforms/foo-test.coffee'); 28 | 29 | expect(transformTestFile) 30 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 31 | .to.contain("moduleFor 'transform:foo', 'Unit | Transform | foo', {"); 32 | 33 | expectCoffee(transformTestFile); 34 | })); 35 | }); 36 | 37 | it('transform-test foo', function() { 38 | var args = ['transform-test', 'foo']; 39 | 40 | return emberNew() 41 | .then(() => emberGenerateDestroy(args, (file) => { 42 | var testFile = file('tests/unit/transforms/foo-test.coffee'); 43 | 44 | expect(testFile) 45 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 46 | .to.contain("moduleFor 'transform:foo', 'Unit | Transform | foo', {"); 47 | 48 | expectCoffee(testFile); 49 | })); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /node-tests/blueprints/serializer-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy serializer', function() { 12 | setupTestHooks(this); 13 | 14 | it('serializer foo', function() { 15 | var args = ['serializer', 'foo']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var serializerFile = file('app/serializers/foo.coffee'); 20 | 21 | expect(serializerFile) 22 | .to.contain("import DS from 'ember-data'") 23 | .to.contain('export default DS.RESTSerializer.extend()'); 24 | 25 | expectCoffee(serializerFile); 26 | 27 | var serializerTestFile = file('tests/unit/serializers/foo-test.coffee'); 28 | 29 | expect(serializerTestFile) 30 | .to.contain("import { moduleForModel, test } from 'ember-qunit'") 31 | .to.contain("moduleForModel 'foo', 'Unit | Serializer | foo',") 32 | .to.contain("needs: ['serializer:foo']"); 33 | 34 | expectCoffee(serializerTestFile); 35 | })); 36 | }); 37 | 38 | it('serializer-test foo', function() { 39 | var args = ['serializer-test', 'foo']; 40 | 41 | return emberNew() 42 | .then(() => emberGenerateDestroy(args, (file) => { 43 | var testFile = file('tests/unit/serializers/foo-test.coffee'); 44 | 45 | expect(testFile) 46 | .to.contain("import { moduleForModel, test } from 'ember-qunit'") 47 | .to.contain("moduleForModel 'foo', 'Unit | Serializer | foo',") 48 | .to.contain("needs: ['serializer:foo']"); 49 | 50 | expectCoffee(testFile); 51 | })); 52 | }); 53 | }); 54 | -------------------------------------------------------------------------------- /node-tests/blueprints/util-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy util', function() { 12 | setupTestHooks(this); 13 | 14 | it('util foo-bar', function() { 15 | var args = ['util', 'foo-bar']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var utilFile = file('app/utils/foo-bar.coffee'); 20 | 21 | expect(utilFile) 22 | .to.contain('export default () ->'); 23 | 24 | expectCoffee(utilFile); 25 | 26 | var utilTestFile = file('tests/unit/utils/foo-bar-test.coffee'); 27 | 28 | expect(utilTestFile) 29 | // TODO: This import should use absolute imports 30 | .to.contain("import fooBar from '../../../utils/foo-bar'") 31 | .to.contain("import { module, test } from 'qunit'") 32 | .to.contain("module 'Unit | Utility | foo bar'") 33 | .to.contain('result = fooBar()'); 34 | 35 | expectCoffee(utilTestFile); 36 | })); 37 | }); 38 | 39 | it('util-test foo-bar', function() { 40 | var args = ['util-test', 'foo-bar']; 41 | 42 | return emberNew() 43 | .then(() => emberGenerateDestroy(args, (file) => { 44 | var testFile = file('tests/unit/utils/foo-bar-test.coffee'); 45 | 46 | expect(testFile) 47 | .to.contain("import fooBar from '../../../utils/foo-bar'") 48 | .to.contain("import { module, test } from 'qunit'") 49 | .to.contain("module 'Unit | Utility | foo bar'") 50 | .to.contain('result = fooBar()'); 51 | 52 | expectCoffee(testFile); 53 | })); 54 | }); 55 | }); 56 | -------------------------------------------------------------------------------- /node-tests/blueprints/route-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var chai = require('ember-cli-blueprint-test-helpers/chai'); 9 | var expect = chai.expect; 10 | var file = chai.file; 11 | var expectCoffee = require('../helpers/expect-coffee'); 12 | 13 | describe('Acceptance: ember generate and destroy route', function() { 14 | setupTestHooks(this); 15 | 16 | it.skip('route foo', function() { 17 | var args = ['route', 'foo']; 18 | 19 | return emberNew() 20 | .then(() => emberGenerateDestroy(args, (_file) => { 21 | expect(_file('app/routes/foo.coffee')) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain('FooRoute = Ember.Route.extend()') 24 | .to.contain("export default FooRoute"); 25 | 26 | expect(_file('app/templates/foo.hbs')) 27 | .to.contain('{{outlet}}'); 28 | 29 | expect(_file('tests/unit/routes/foo-test.coffee')) 30 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 31 | .to.contain("moduleFor 'route:foo', 'Unit | Route | foo', {"); 32 | 33 | expect(file('app/router.coffee')) 34 | .to.contain("@route 'foo'"); 35 | }) 36 | .then(() => expect(file('app/router.coffee')) 37 | .to.not.contain("@route 'foo'") 38 | )); 39 | }); 40 | 41 | it('route-test foo', function() { 42 | var args = ['route-test', 'foo']; 43 | 44 | return emberNew() 45 | .then(() => emberGenerateDestroy(args, (_file) => { 46 | var testFile = _file('tests/unit/routes/foo-test.coffee'); 47 | 48 | expect(testFile) 49 | .to.contain("import { moduleFor, test } from 'ember-qunit'") 50 | .to.contain("moduleFor 'route:foo', 'Unit | Route | foo', {"); 51 | 52 | expectCoffee(testFile); 53 | })); 54 | }); 55 | }); 56 | -------------------------------------------------------------------------------- /blueprints/model/index.js: -------------------------------------------------------------------------------- 1 | var inflection = require('inflection'); 2 | var stringUtils = require('../../lib/utilities/string'); 3 | var EOL = require('os').EOL; 4 | 5 | module.exports = { 6 | description: 'Generates an ember-data model.', 7 | 8 | anonymousOptions: [ 9 | 'name', 10 | 'attr:type' 11 | ], 12 | 13 | locals: function(options) { 14 | var attrs = []; 15 | var needs = []; 16 | var entityOptions = options.entity.options; 17 | 18 | for (var name in entityOptions) { 19 | var type = entityOptions[name] || ''; 20 | var dasherizedName = stringUtils.dasherize(name); 21 | var dasherizedNameSingular = inflection.singularize(dasherizedName); 22 | var camelizedName = stringUtils.camelize(name); 23 | var dasherizedType = stringUtils.dasherize(type); 24 | 25 | if (/has-many/.test(dasherizedType)) { 26 | var camelizedNamePlural = inflection.pluralize(camelizedName); 27 | attrs.push(camelizedNamePlural + ': ' + dsAttr(dasherizedName, dasherizedType)); 28 | } else { 29 | attrs.push(camelizedName + ': ' + dsAttr(dasherizedName, dasherizedType)); 30 | } 31 | 32 | if (/has-many|belongs-to/.test(dasherizedType)) { 33 | needs.push("'model:" + dasherizedNameSingular + "'"); 34 | } 35 | } 36 | 37 | attrs = attrs.join('' + EOL + ' '); 38 | needs = ' needs: [' + needs.join(', ') + ']'; 39 | 40 | return { 41 | attrs: attrs, 42 | needs: needs 43 | }; 44 | } 45 | }; 46 | 47 | function dsAttr(name, type) { 48 | switch (type) { 49 | case 'array': 50 | case 'boolean': 51 | case 'date': 52 | case 'number': 53 | case 'object': 54 | case 'string': 55 | return 'DS.attr \'' + type + '\''; 56 | case 'belongs-to': 57 | return 'DS.belongsTo \'' + name + '\''; 58 | case 'has-many': 59 | var singularizedName = inflection.singularize(name); 60 | return 'DS.hasMany \'' + singularizedName + '\''; 61 | default: 62 | // "If you don't specify the type of the attribute, it will be whatever was provided by the server" 63 | // http://emberjs.com/guides/models/defining-models/ 64 | return 'DS.attr()'; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /blueprints/resource/index.js: -------------------------------------------------------------------------------- 1 | var inflection = require('inflection'); 2 | var RSVP = require('rsvp'); 3 | var merge = require('lodash.merge') 4 | var Blueprint = require('ember-cli/lib/models/blueprint'); 5 | 6 | module.exports = { 7 | description: 'Generates a model and route.', 8 | 9 | install: function(options) { 10 | this.project = options.project; 11 | return this._process('install', options); 12 | }, 13 | 14 | uninstall: function(options) { 15 | this.project = options.project; 16 | return this._process('uninstall', options); 17 | }, 18 | 19 | _processBlueprint: function(type, name, options) { 20 | var mainBlueprint = Blueprint.lookup(name, { 21 | ui: this.ui, 22 | analytics: this.analytics, 23 | project: this.project, 24 | paths: this.project.blueprintLookupPaths() 25 | }); 26 | 27 | var thisBlueprint = this; 28 | 29 | return RSVP.Promise.resolve() 30 | .then(function() { 31 | return mainBlueprint[type](options); 32 | }) 33 | .then(function() { 34 | var testBlueprint = mainBlueprint.lookupBlueprint(name + '-test', { 35 | ui: thisBlueprint.ui, 36 | analytics: thisBlueprint.analytics, 37 | project: thisBlueprint.project, 38 | paths: thisBlueprint.project.blueprintLookupPaths(), 39 | ignoreMissing: true 40 | }); 41 | 42 | if (!testBlueprint) { return; } 43 | 44 | if (testBlueprint.locals === Blueprint.prototype.locals) { 45 | testBlueprint.locals = function(options) { 46 | return mainBlueprint.locals(options); 47 | }; 48 | } 49 | 50 | return testBlueprint[type](options); 51 | }); 52 | }, 53 | 54 | _process: function(type, options) { 55 | var modelOptions = merge({}, options, { 56 | entity: { 57 | name: inflection.singularize(options.entity.name) 58 | } 59 | }); 60 | 61 | var routeOptions = merge({}, options); 62 | 63 | var self = this; 64 | return this._processBlueprint(type, 'model', modelOptions) 65 | .then(function() { 66 | return self._processBlueprint(type, 'route', routeOptions); 67 | }); 68 | } 69 | }; 70 | -------------------------------------------------------------------------------- /node-tests/blueprints/mixin-test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers'); 4 | var setupTestHooks = blueprintHelpers.setupTestHooks; 5 | var emberNew = blueprintHelpers.emberNew; 6 | var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy; 7 | 8 | var expect = require('ember-cli-blueprint-test-helpers/chai').expect; 9 | var expectCoffee = require('../helpers/expect-coffee'); 10 | 11 | describe('Acceptance: ember generate and destroy mixin', function() { 12 | setupTestHooks(this); 13 | 14 | it('mixin foo-bar', function() { 15 | var args = ['mixin', 'foo-bar']; 16 | 17 | return emberNew() 18 | .then(() => emberGenerateDestroy(args, (file) => { 19 | var mixinFile = file('app/mixins/foo-bar.coffee'); 20 | 21 | expect(mixinFile) 22 | .to.contain("import Ember from 'ember'") 23 | .to.contain('export default Ember.Mixin.create()'); 24 | 25 | expectCoffee(mixinFile); 26 | 27 | var mixinTestFile = file('tests/unit/mixins/foo-bar-test.coffee'); 28 | 29 | expect(mixinTestFile) 30 | .to.contain("import Ember from 'ember'") 31 | // TODO: Fix this import - it should be absolute 32 | .to.contain("import FooBarMixin from '../../../mixins/foo-bar'") 33 | .to.contain("import { module, test } from 'qunit'") 34 | .to.contain("module 'Unit | Mixin | foo bar'") 35 | .to.contain('FooBarObject = Ember.Object.extend FooBarMixin') 36 | .to.contain('subject = FooBarObject.create()'); 37 | 38 | expectCoffee(mixinTestFile); 39 | })); 40 | }); 41 | 42 | it('mixin-test foo-bar', function() { 43 | var args = ['mixin-test', 'foo-bar']; 44 | 45 | return emberNew() 46 | .then(() => emberGenerateDestroy(args, (file) => { 47 | var mixinTestFile = file('tests/unit/mixins/foo-bar-test.coffee'); 48 | 49 | expect(mixinTestFile) 50 | .to.contain("import Ember from 'ember'") 51 | .to.contain("import FooBarMixin from '../../../mixins/foo-bar'") 52 | .to.contain("import { module, test } from 'qunit'") 53 | .to.contain("module 'Unit | Mixin | foo bar'") 54 | .to.contain('FooBarObject = Ember.Object.extend FooBarMixin') 55 | .to.contain('subject = FooBarObject.create()'); 56 | 57 | expectCoffee(mixinTestFile); 58 | })); 59 | }); 60 | }); 61 | -------------------------------------------------------------------------------- /blueprints/component-test/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | var stringUtils = require('../../lib/utilities/string'); 4 | var EOL = require('os').EOL; 5 | 6 | module.exports = { 7 | description: 'Generates a component integration or unit test.', 8 | 9 | availableOptions: [ 10 | { 11 | name: 'test-type', 12 | type: ['integration', 'unit'], 13 | default: 'integration', 14 | aliases: [ 15 | { 'i': 'integration' }, 16 | { 'u': 'unit' }, 17 | { 'integration': 'integration' }, 18 | { 'unit': 'unit' } 19 | ] 20 | } 21 | ], 22 | 23 | fileMapTokens: function() { 24 | var blueprint = ancestralBlueprint('component-test', this.project); 25 | return blueprint.fileMapTokens.apply(blueprint, arguments); 26 | }, 27 | 28 | locals: function(options) { 29 | var blueprint = ancestralBlueprint('component-test', this.project); 30 | var locals = blueprint.locals.apply(blueprint, arguments); 31 | 32 | var dasherizedModuleName = stringUtils.dasherize(options.entity.name); 33 | var testImports = EOL + "import hbs from 'htmlbars-inline-precompile'"; 34 | var testOptions = "integration: true"; 35 | 36 | var testContent = "assert.expect 2" + EOL + EOL + 37 | " # Set any properties with @set 'myProperty', 'value'" + EOL + 38 | " # Handle any actions with @on 'myAction', (val) ->" + EOL + EOL + 39 | ' @render hbs """{{' + dasherizedModuleName + '}}"""' + EOL + EOL + 40 | " assert.equal @$().text().trim(), ''" + EOL + EOL + 41 | " # Template block usage:" + EOL + 42 | ' @render hbs """' + EOL + 43 | " {{#" + dasherizedModuleName + "}}" + EOL + 44 | " template block text" + EOL + 45 | " {{/" + dasherizedModuleName + "}}" + EOL + 46 | ' """' + EOL + EOL + 47 | " assert.equal @$().text().trim(), 'template block text'"; 48 | 49 | if (options.testType === 'unit') { 50 | testImports = ""; 51 | testOptions = "# Specify the other units that are required for this test" + EOL + 52 | " # needs: ['component:foo', 'helper:bar']," + EOL + " unit: true"; 53 | 54 | testContent = "assert.expect 1" + EOL + EOL + 55 | " # Creates the component instance" + EOL + 56 | " component = @subject()" + EOL + 57 | " # Renders the component to the page" + EOL + 58 | " @render()" + EOL + 59 | " assert.equal @$().text().trim(), ''"; 60 | } 61 | 62 | locals.testImports = testImports; 63 | locals.testOptions = testOptions; 64 | locals.testContent = testContent; 65 | return locals; 66 | } 67 | }; 68 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-cli-coffeescript", 3 | "version": "1.16.1", 4 | "description": "Adds precompilation of CoffeeScript files and all the basic generation types to the `ember generate` command.", 5 | "directories": { 6 | "doc": "doc", 7 | "test": "tests" 8 | }, 9 | "scripts": { 10 | "build": "ember build", 11 | "start": "ember server", 12 | "test": "npm run embertest && npm run nodetest", 13 | "embertest": "ember try:testall", 14 | "nodetest": "mocha node-tests --recursive" 15 | }, 16 | "repository": { 17 | "type": "git", 18 | "url": "git://github.com/kimroen/ember-cli-coffeescript" 19 | }, 20 | "bugs": { 21 | "url": "https://github.com/kimroen/ember-cli-coffeescript/issues" 22 | }, 23 | "homepage": "https://github.com/kimroen/ember-cli-coffeescript", 24 | "engines": { 25 | "node": ">= 0.10.0" 26 | }, 27 | "author": "Kim Røen", 28 | "license": "MIT", 29 | "devDependencies": { 30 | "broccoli-asset-rev": "^2.2.0", 31 | "coffee-script": "^1.12.3", 32 | "ember-ajax": "0.7.1", 33 | "ember-cli": "2.6.2", 34 | "ember-cli-app-version": "^1.0.0", 35 | "ember-cli-babel": "^5.1.5", 36 | "ember-cli-blueprint-test-helpers": "^0.14.0", 37 | "ember-cli-dependency-checker": "^1.2.0", 38 | "ember-cli-htmlbars": "^1.0.1", 39 | "ember-cli-htmlbars-inline-precompile": "^0.3.1", 40 | "ember-cli-inject-live-reload": "^1.3.1", 41 | "ember-cli-qunit": "^1.2.1", 42 | "ember-cli-release": "0.2.8", 43 | "ember-cli-sri": "^2.1.0", 44 | "ember-cli-uglify": "^1.2.0", 45 | "ember-disable-prototype-extensions": "^1.1.0", 46 | "ember-disable-proxy-controllers": "^1.0.1", 47 | "ember-load-initializers": "^0.5.0", 48 | "ember-resolver": "^2.0.3", 49 | "ember-try": "^0.1.2", 50 | "loader.js": "^4.0.0", 51 | "mocha": "^2.5.3" 52 | }, 53 | "keywords": [ 54 | "ember-addon", 55 | "coffeescript", 56 | "blueprints" 57 | ], 58 | "dependencies": { 59 | "broccoli-coffee": "~0.8.0", 60 | "broccoli-persistent-filter": "^1.1.0", 61 | "chalk": "^1.0.0", 62 | "coffeelint": "^1.6.1", 63 | "ember-cli-legacy-blueprints": "^0.1.1", 64 | "ember-cli-version-checker": "^1.3.1", 65 | "fs-extra": "^0.11.1", 66 | "ignore": "^3.0.9", 67 | "inflection": "^1.4.0", 68 | "json-stable-stringify": "^1.0.0", 69 | "lodash.defaults": "^4.2.0", 70 | "lodash.merge": "^4.6.0", 71 | "rsvp": "^4.0.1" 72 | }, 73 | "ember-addon": { 74 | "configPath": "tests/dummy/config", 75 | "before": [ 76 | "ember-cli-babel" 77 | ], 78 | "after": [ 79 | "ember", 80 | "ember-data", 81 | "ember-source" 82 | ] 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /blueprints/route/index.js: -------------------------------------------------------------------------------- 1 | var ancestralBlueprint = require('../../lib/utilities/ancestral-blueprint'); 2 | 3 | var fs = require('fs-extra'); 4 | var path = require('path'); 5 | var EOL = require('os').EOL; 6 | var chalk = require('chalk'); 7 | 8 | module.exports = { 9 | description: 'Generates a route and registers it with the router.', 10 | 11 | availableOptions: [ 12 | { 13 | name: 'path', 14 | type: String, 15 | default: '' 16 | }, 17 | { 18 | name: 'skip-router', 19 | type: Boolean, 20 | default: false 21 | } 22 | ], 23 | 24 | fileMapTokens: function() { 25 | var blueprint = ancestralBlueprint('route', this.project) 26 | return blueprint.fileMapTokens.apply(blueprint, arguments); 27 | }, 28 | 29 | shouldTouchRouter: function(name, options) { 30 | return ancestralBlueprint('route', this.project).shouldTouchRouter(name, options); 31 | }, 32 | 33 | afterInstall: function(options) { 34 | updateRouter.call(this, 'add', options); 35 | }, 36 | 37 | afterUninstall: function(options) { 38 | updateRouter.call(this, 'remove', options); 39 | } 40 | }; 41 | 42 | function updateRouter(action, options) { 43 | var entity = options.entity; 44 | var actionColorMap = { 45 | add: 'green', 46 | remove: 'red' 47 | }; 48 | var color = actionColorMap[action] || 'gray'; 49 | 50 | if (this.shouldTouchRouter(entity.name, options)) { 51 | writeRoute(action, entity.name, options); 52 | 53 | this.ui.writeLine('updating router'); 54 | this._writeStatusToUI(chalk[color], action + ' route', entity.name); 55 | } 56 | } 57 | 58 | function findRouter(options) { 59 | var routerPathParts = [options.project.root]; 60 | 61 | if (options.dummy && options.project.isEmberCLIAddon()) { 62 | routerPathParts = routerPathParts.concat(['tests', 'dummy', 'app', 'router.coffee']); 63 | } else { 64 | routerPathParts = routerPathParts.concat(['app', 'router.coffee']); 65 | } 66 | 67 | return routerPathParts; 68 | } 69 | 70 | function writeRoute(action, name, options) { 71 | var routerPath = path.join.apply(null, findRouter(options)); 72 | var source = fs.readFileSync(routerPath, 'utf-8'); 73 | 74 | var newRoutes; 75 | if (action === 'add') { 76 | newRoutes = addRouteToRouter(name, source); 77 | } else { 78 | newRoutes = removeRouteFromRouter(name, source); 79 | } 80 | 81 | fs.writeFileSync(routerPath, newRoutes); 82 | } 83 | 84 | function removeRouteFromRouter(name, oldContent) { 85 | var existence = new RegExp("(?:route|resource)\\s?\\(?\\s?(['\"])" + name + "\\1"); 86 | 87 | if (!existence.test(oldContent)) { 88 | return oldContent; 89 | } 90 | 91 | var re = new RegExp('^\\s*@route\\s*\\(?(["\'])\\s*'+ name +'\\s*\\1\\)?', 'm'); 92 | return oldContent.replace(re, ''); 93 | } 94 | 95 | function addRouteToRouter(name, oldContent) { 96 | var existence = new RegExp("(?:route|resource)\\s?\\(?\\s?(['\"])" + name + "\\1"); 97 | 98 | if (existence.test(oldContent)) { 99 | return oldContent; 100 | } 101 | 102 | var funcRegex = /(map\s*->[\s\S]+)(\n^\S+)/m; 103 | 104 | return oldContent.replace( 105 | funcRegex, 106 | "$1 @route '" + name + "'" + EOL + "$2" 107 | ); 108 | } 109 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CoffeeScript support for ember-cli [![Build Status](https://travis-ci.org/kimroen/ember-cli-coffeescript.svg?branch=master)](https://travis-ci.org/kimroen/ember-cli-coffeescript) 2 | Adds precompilation of CoffeeScript files and all the basic generation 3 | types to the `ember generate` command, as well as linting. 4 | 5 | ### Includes 6 | - Generating files in CoffeeScript with `ember generate` 7 | - Preprocessing CoffeeScript-files in your app, including tests 8 | - Linting your CoffeeScript-files. 9 | 10 | ### Install 11 | ``` 12 | ember install ember-cli-coffeescript 13 | ``` 14 | 15 | **NB**: ember-cli-coffeescript is tested using ember-cli version `2.3.0` and up. Some of it probably works on 16 | earlier versions, but I wouldn't know. 17 | 18 | ### How to use 19 | 20 | #### Blueprints 21 | Run `ember help generate` to get a list of available blueprints. Use them by running `ember g `. For instance, to generate a component: 22 | 23 | ``` 24 | ember g component my-component 25 | ``` 26 | 27 | ember-cli-coffeescript comes with pod-support for the same blueprints as ember-cli 28 | does. Check out [the ember-cli docs for pods](https://ember-cli.com/user-guide/#using-pods) 29 | for instructions on how to use it. 30 | 31 | If you'd like to use ember-cli-coffeescript without the blueprints, you can add 32 | the following to your `config/environment.js`: 33 | 34 | ```js 35 | ENV.coffeeOptions = { 36 | blueprints: false 37 | } 38 | ``` 39 | 40 | This will make it fall back to the next blueprints in line (probably the ones 41 | from ember-cli). 42 | 43 | #### Precompiling 44 | This will happen automatically - no work necessary. 45 | 46 | #### Linting 47 | If you have a `coffeelint.json` file in the root of you project we will automatically pick up on it and start running linting on files when using the `ember build` and `ember serve` commands. 48 | If you do not want linting to run despite having a `coffeelint.json` file, use the following configuration 49 | in your `config/environment.js`. 50 | 51 | ```js 52 | ENV.coffeeOptions = { 53 | lint: false 54 | } 55 | ``` 56 | 57 | You can set `lint` to `true` to enable linting with the default configurations even without a custom `coffeelint.json` file. 58 | 59 | You can find all the [available options on the website for `coffeelint`](http://www.coffeelint.org/#options). 60 | 61 | If you want to specify a different path for your `coffeelint.json` file you can specify the path 62 | (relative to the project directory or absolute) 63 | 64 | ```js 65 | ENV.coffeeOptions = { 66 | lint: { 67 | configPath: "configurations/coffeelint.json" 68 | } 69 | } 70 | ``` 71 | 72 | If you want to change the way we format the linting output you can specify custom error output and stats output functions: 73 | 74 | ```js 75 | ENV.coffeeOptions = { 76 | lint: { 77 | formatter: function(filePath, lintResults) { }, 78 | statsFormatter: function(stats) { console.log('Files: ', stats.fileCount, "Errors: ", stats.errorCount) } 79 | } 80 | } 81 | ``` 82 | 83 | **NOTE:** The lint results will show up twice when you build and run your app; once 84 | for the app files, and then once for the test files. On rebuild, only the changed 85 | files are linted. 86 | 87 | ##### Lintignore 88 | To avoid linting specific files or folders, you can put a file named `.coffeelintignore` 89 | in the root of your project containing ignore-rules, one per line. This is just like a 90 | `.gitignore`-file, and it will follow the same rules. 91 | 92 | ### Developing 93 | - `git clone` this repository 94 | - `npm install` 95 | - `bower install` 96 | - `npm link` 97 | 98 | Because of the nature of this project, it needs to be consumed by an ember-cli project to be properly developed. 99 | 100 | - Add `"ember-cli-coffeescript": "*"` to your consuming project's `package.json` 101 | - From your project root run `npm link ember-cli-coffeescript` 102 | 103 | ### Running Tests 104 | - `ember test` 105 | - `npm run embertest` 106 | - `npm run nodetest` 107 | 108 | To run all the tests: 109 | 110 | - `npm test` 111 | -------------------------------------------------------------------------------- /lib/utilities/string.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // TODO: remove once Ember's version is on npm 4 | var STRING_DASHERIZE_REGEXP = (/[ _]/g); 5 | var STRING_DASHERIZE_CACHE = {}; 6 | var STRING_DECAMELIZE_REGEXP = (/([a-z\d])([A-Z])/g); 7 | var STRING_CAMELIZE_REGEXP = (/(\-|_|\.|\s)+(.)?/g); 8 | var STRING_UNDERSCORE_REGEXP_1 = (/([a-z\d])([A-Z]+)/g); 9 | var STRING_UNDERSCORE_REGEXP_2 = (/\-|\s+/g); 10 | 11 | module.exports = { 12 | /** 13 | Converts a camelized string into all lower case separated by underscores. 14 | 15 | ```javascript 16 | 'innerHTML'.decamelize(); // 'inner_html' 17 | 'action_name'.decamelize(); // 'action_name' 18 | 'css-class-name'.decamelize(); // 'css-class-name' 19 | 'my favorite items'.decamelize(); // 'my favorite items' 20 | ``` 21 | 22 | @method decamelize 23 | @param {String} str The string to decamelize. 24 | @return {String} the decamelized string. 25 | */ 26 | decamelize: function(str) { 27 | return str.replace(STRING_DECAMELIZE_REGEXP, '$1_$2').toLowerCase(); 28 | }, 29 | 30 | /** 31 | Replaces underscores, spaces, or camelCase with dashes. 32 | 33 | ```javascript 34 | 'innerHTML'.dasherize(); // 'inner-html' 35 | 'action_name'.dasherize(); // 'action-name' 36 | 'css-class-name'.dasherize(); // 'css-class-name' 37 | 'my favorite items'.dasherize(); // 'my-favorite-items' 38 | ``` 39 | 40 | @method dasherize 41 | @param {String} str The string to dasherize. 42 | @return {String} the dasherized string. 43 | */ 44 | dasherize: function(str) { 45 | var cache = STRING_DASHERIZE_CACHE, 46 | hit = cache.hasOwnProperty(str), 47 | ret; 48 | 49 | if (hit) { 50 | return cache[str]; 51 | } else { 52 | ret = this.decamelize(str).replace(STRING_DASHERIZE_REGEXP,'-'); 53 | cache[str] = ret; 54 | } 55 | 56 | return ret; 57 | }, 58 | 59 | /** 60 | Returns the lowerCamelCase form of a string. 61 | 62 | ```javascript 63 | 'innerHTML'.camelize(); // 'innerHTML' 64 | 'action_name'.camelize(); // 'actionName' 65 | 'css-class-name'.camelize(); // 'cssClassName' 66 | 'my favorite items'.camelize(); // 'myFavoriteItems' 67 | 'My Favorite Items'.camelize(); // 'myFavoriteItems' 68 | ``` 69 | 70 | @method camelize 71 | @param {String} str The string to camelize. 72 | @return {String} the camelized string. 73 | */ 74 | camelize: function(str) { 75 | return str.replace(STRING_CAMELIZE_REGEXP, function(match, separator, chr) { 76 | return chr ? chr.toUpperCase() : ''; 77 | }).replace(/^([A-Z])/, function(match) { 78 | return match.toLowerCase(); 79 | }); 80 | }, 81 | 82 | /** 83 | Returns the UpperCamelCase form of a string. 84 | 85 | ```javascript 86 | 'innerHTML'.classify(); // 'InnerHTML' 87 | 'action_name'.classify(); // 'ActionName' 88 | 'css-class-name'.classify(); // 'CssClassName' 89 | 'my favorite items'.classify(); // 'MyFavoriteItems' 90 | ``` 91 | 92 | @method classify 93 | @param {String} str the string to classify 94 | @return {String} the classified string 95 | */ 96 | classify: function(str) { 97 | var parts = str.split('.'), 98 | out = []; 99 | 100 | for (var i=0, l=parts.length; i 0){ 45 | color = chalk.white.bgRed; 46 | } 47 | console.log("\n\n======================================================="); 48 | console.log("Linting completed on " + stats.fileCount + " files with " + color(" "+stats.errorCount+" ") + " errors."); 49 | console.log("=======================================================\n"); 50 | }; 51 | 52 | if(options.formatter){ 53 | this.formatter = options.formatter; 54 | } 55 | if(options.statsFormatter){ 56 | this.statsFormatter = options.statsFormatter; 57 | } 58 | 59 | var rawCoffeeLintConfiguration = null; 60 | if (options.configPath) { 61 | rawCoffeeLintConfiguration = fs.readFileSync(options.configPath, "utf-8"); 62 | } else if (fs.existsSync("./coffeelint.json")) { 63 | rawCoffeeLintConfiguration = fs.readFileSync('./coffeelint.json', "utf-8"); 64 | } 65 | if (rawCoffeeLintConfiguration) { 66 | try { 67 | this.coffeelintJSON = JSON.parse(rawCoffeeLintConfiguration); 68 | } catch(e) { 69 | throw 'Unable to parse json file: ' + path.resolve(options.coffeelintJSON) 70 | } 71 | } 72 | 73 | if(fs.existsSync("./.coffeelintignore")) { 74 | this.coffeelintignore = ignore() 75 | .add(fs.readFileSync('./.coffeelintignore').toString()) 76 | .createFilter(); 77 | } 78 | } 79 | 80 | CoffeeScriptLinter.prototype.extensions = ['coffee']; 81 | CoffeeScriptLinter.prototype.targetExtension = 'coffee'; 82 | 83 | CoffeeScriptLinter.prototype.baseDir = function() { 84 | return path.resolve(__dirname, '..'); 85 | }; 86 | 87 | CoffeeScriptLinter.prototype.processString = function (content, relativePath) { 88 | if(this.coffeelintignore) { 89 | var shouldPass = this.coffeelintignore("../" + relativePath); 90 | if(!shouldPass) { 91 | return content; 92 | } 93 | } 94 | try { 95 | var lintResults = CoffeeLint(content, this.coffeelintJSON); 96 | this.errors += lintResults.length; 97 | this.fileCount++; 98 | this.formatter(relativePath, lintResults); 99 | return content; 100 | } catch (err) { 101 | err.line = err.location && err.location.first_line; 102 | err.column = err.location && err.location.first_column; 103 | throw err 104 | } 105 | }; 106 | 107 | CoffeeScriptLinter.prototype.build = function() { 108 | this.errors = 0; 109 | this.fileCount = 0; 110 | var self = this; 111 | return Filter.prototype.build.call(this).finally(function(){ 112 | self.statsFormatter({errorCount: self.errors, fileCount: self.fileCount}); 113 | }); 114 | }; 115 | 116 | CoffeeScriptLinter.prototype.optionsHash = function() { 117 | if (!this._optionsHash) { 118 | this._optionsHash = crypto.createHash('md5') 119 | .update(stringify(this.options), 'utf8') 120 | .update(stringify(this.coffeelintJSON) || '', 'utf8') 121 | .update(stringify(this.coffeelintignore) || '', 'utf8') 122 | .digest('hex'); 123 | } 124 | 125 | return this._optionsHash; 126 | }; 127 | 128 | CoffeeScriptLinter.prototype.cacheKeyProcessString = function(string, relativePath) { 129 | return this.optionsHash() + Filter.prototype.cacheKeyProcessString.call(this, string, relativePath); 130 | }; 131 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## master 2 | + Use external `RSVP` dependency instead of using directly from `ember-cli` [#147](https://github.com/kimroen/ember-cli-coffeescript/pull/147) 3 | + Update usage of `ember-cli-version-checker` [#145](https://github.com/kimroen/ember-cli-coffeescript/pull/145) 4 | 5 | ## 1.16.1 6 | + Change all blueprints to use direct exports (instead of storing to variable and then exporting). [#137](https://github.com/kimroen/ember-cli-coffeescript/pull/137) and [#139](https://github.com/kimroen/ember-cli-coffeescript/pull/139) 7 | + Change files exporting things from addons to be JavaScript files so they can be consumed by applications without requiring `ember-cli-coffeescript` to be installed. [#136](https://github.com/kimroen/ember-cli-coffeescript/pull/136) 8 | 9 | ## 1.16.0 10 | This release updates CoffeeScript to version 1.12.1, which contains support for a lot of ES2016 features that were unavailable or impractical to use in CoffeeScript. The main ones for Ember apps are [modules](http://coffeescript.org/#modules) and [tagged template literals](http://coffeescript.org/#tagged-template-literals). See [the official CoffeeScript changelog](http://coffeescript.org/#changelog) for the full list of changes. 11 | 12 | This means you can now write your imports and exports without backticks, and all generated code will also now be without these. Rejoice! 13 | 14 | Thanks to [@jakesjews](https://github.com/jakesjews) for championing this update. 15 | 16 | In other news, there are now tests for the blueprints and the install size is slightly smaller. 17 | 18 | + Reduce install size by depending on specific lodash modules directly. [#123](https://github.com/kimroen/ember-cli-coffeescript/pull/123) 19 | + Update to CoffeeScript version 1.12.1, which includes support for `import` and `export` without backticks 🎉 [#124](https://github.com/kimroen/ember-cli-coffeescript/pull/124) 20 | + Add basic tests for the supported blueprints. [#124](https://github.com/kimroen/ember-cli-coffeescript/pull/124) and [#129](https://github.com/kimroen/ember-cli-coffeescript/pull/129) 21 | 22 | ## 1.15.0 23 | + Fix a bunch of issues with blueprints in `ember-cli` versions 2.6.0 and above. [#114](https://github.com/kimroen/ember-cli-coffeescript/pull/114), [#118](https://github.com/kimroen/ember-cli-coffeescript/pull/118), and [#119](https://github.com/kimroen/ember-cli-coffeescript/pull/119) 24 | + Handle unexpected blueprint behavior when running in a path containing the string `ember-cli-coffeescript` at any point. [#120](https://github.com/kimroen/ember-cli-coffeescript/pull/120) 25 | 26 | ## 1.14.0 27 | + Upgrade `broccoli-coffee` to 0.6, which now uses `broccoli-persistent-filter` [#104](https://github.com/kimroen/ember-cli-coffeescript/pull/104) 28 | + Upgrade `node-ignore`, which makes parsing `.coffeelintignore` more spec-compliant in general and makes it work on Windows. [#105](https://github.com/kimroen/ember-cli-coffeescript/pull/105) 29 | + Upgrade the project structure 30 | + Fix problem with generating helper tests and initializer tests [#108](https://github.com/kimroen/ember-cli-coffeescript/pull/108) 31 | 32 | ### 1.13.2 33 | Makes rebuilds faster when linting your CoffeeScript by using `broccoli-persistent-filter`. Many thanks to [@johnnyshields](https://github.com/johnnyshields) and [@stefanpenner](https://github.com/stefanpenner) for making this happen. 34 | 35 | + Upgrade `CoffeeScriptLinter` to `broccoli-persistent-filter` [#95](https://github.com/kimroen/ember-cli-coffeescript/pull/95) 36 | 37 | ### 1.13.1 38 | Updates CoffeeScript to version 1.10.0. [See their changelog](http://coffeescript.org/#1.10.0). 39 | 40 | + Upgrade `broccoli-coffee` to 0.5.0 [#90](https://github.com/kimroen/ember-cli-coffeescript/pull/90) 41 | 42 | ## 1.13.0 43 | *Note:* The generated tests from components require you to have [`ember-cli-htmlbars-inline-precompile`](https://github.com/pangratz/ember-cli-htmlbars-inline-precompile) installed with at least version 0.2.0. 44 | 45 | + Updated all blueprints to match the ember-cli 1.13-range [#89](https://github.com/kimroen/ember-cli-coffeescript/pull/89). Some highlights: 46 | + Generated helpers use `Ember.Helper.helper` instead of `Ember.HTMLBars.makeBoundHelper` 47 | + Generated component-tests are now integration tests by default. See note above 48 | + This fixes some issues when using this combined with pods in various configurations 49 | + All generators should generally work in addons now 50 | + Updated depended-on ember-cli version which gets rid of some warnings [#85](https://github.com/kimroen/ember-cli-coffeescript/pull/85) 51 | + Fix exceptions when using `ember destroy route` or `ember generate route` [#88](https://github.com/kimroen/ember-cli-coffeescript/pull/88) 52 | 53 | ## 0.11.0 54 | + Generating components in addons now works [#67](https://github.com/kimroen/ember-cli-coffeescript/pull/67) 55 | + If both coffeescript and babel is used, now coffee runs first [#74](https://github.com/kimroen/ember-cli-coffeescript/pull/74) 56 | + Blueprint-tweaks: 57 | + Use `currentURL` instead of `currentPath` in acceptance-test [ember-cli#3755](https://github.com/ember-cli/ember-cli/pull/3755) 58 | + Capitalize properly in component-test [ember-cli#3469](https://github.com/ember-cli/ember-cli/pull/3469) 59 | + Fix helper test failing by default [ember-cli#3493](https://github.com/ember-cli/ember-cli/pull/3493) 60 | + Improved serializer-test blueprint [ember-cli#3762](https://github.com/ember-cli/ember-cli/pull/3762) 61 | 62 | ## 0.10.0 63 | + Blueprint improvements for ember-cli 0.2.0 64 | + Extend from Ember.Service in service blueprint [#58](https://github.com/kimroen/ember-cli-coffeescript/pull/58) 65 | + Use Ember.HTMLBars by default in helpers [ember-cli#3383](https://github.com/ember-cli/ember-cli/pull/3383) [ember-cli#3410](https://github.com/ember-cli/ember-cli/pull/3410) 66 | + Update broccoli-coffee to ~0.4.0 67 | + Fix filtering to use CoffeeScript extensions [#64](https://github.com/kimroen/ember-cli-coffeescript/pull/64) 68 | + Update chalk to ^1.0.0 [#63](https://github.com/kimroen/ember-cli-coffeescript/pull/63) 69 | 70 | ## 0.9.1 71 | + Add compatibility with upcoming changes in ember-cli 0.2.0 [#60](https://github.com/kimroen/ember-cli-coffeescript/pull/60) 72 | 73 | ## 0.9.0 74 | + Update blueprints for ember-cli 0.1.13 75 | + Removed classifiedModuleName from moduleFor. They are optional now. [#57](https://github.com/kimroen/ember-cli-coffeescript/pull/57) 76 | + Made all the changes necessary for qunit 2.0 compatibility [#54](https://github.com/kimroen/ember-cli-coffeescript/pull/54) 77 | 78 | ## 0.8.1 79 | + Fix a problem in the acceptance-test blueprint to not hang by default [#51](https://github.com/kimroen/ember-cli-coffeescript/pull/51) 80 | + Fix a problem with config not being respected in test [#55](https://github.com/kimroen/ember-cli-coffeescript/pull/55) 81 | 82 | ## 0.8.0 83 | + Update blueprints for ember-cli 0.1.12 84 | + Add test helper blueprint [ember-cli#3049](https://github.com/ember-cli/ember-cli/pull/3049) 85 | + Use relative paths in test blueprints [ember-cli#3154](https://github.com/ember-cli/ember-cli/pull/3154) 86 | + Fix the resources blueprint [#50](https://github.com/kimroen/ember-cli-coffeescript/pull/50) 87 | 88 | ## 0.7.0 89 | + Update blueprints for ember-cli 0.1.5 90 | + Check presence of needs in model-test blueprints before emitting [ember-cli#2829](https://github.com/ember-cli/ember-cli/pull/2829) 91 | + Reference app instance as application in generated acceptance-tests [ember-cli#2659](https://github.com/ember-cli/ember-cli/pull/2659) 92 | + Add aliases `-resource` and `-route` to the route blueprint [ember-cli#2565](https://github.com/ember-cli/ember-cli/pull/2565) 93 | + Add support for `.coffeelintignore`-files [#45](https://github.com/kimroen/ember-cli-coffeescript/pull/45) 94 | 95 | ## 0.6.0 96 | + Make blueprints optional (defaults to include). 97 | + Move `coffeeOptions` from `Brocfile.js` to `config/environment.js`. See `README` 98 | for more details on how to use. 99 | 100 | ## 0.5.0 101 | + Update blueprints for ember-cli 0.1.4 102 | + Use the Ember.Applications container for initializer tests. [ember-cli#2582](https://github.com/stefanpenner/ember-cli/pull/2582) 103 | + Use project.root instead of process.cwd() in route blueprints. [ember-cli#2604](https://github.com/stefanpenner/ember-cli/pull/2604) 104 | 105 | ## 0.4.0 106 | + Support pod-structure for 107 | + adapters 108 | + serializers 109 | + transforms 110 | + Support pod-structure for tests. Added: 111 | + `component-test` 112 | + `controller-test` 113 | + `model-test` 114 | + `route-test` 115 | + `serializer-test` 116 | + `transform-test` 117 | + `view-test` 118 | + Remove blueprints for controller types. See [original commit in ember-cli](https://github.com/stefanpenner/ember-cli/commit/4070bfa0e524df00fcea6ca7fc7cafb5f3858ac2) 119 | + Make generated relationships in models use dasherized names. [Ref issue ember-cli](https://github.com/stefanpenner/ember-cli/issues/2350) 120 | 121 | ### 0.3.2 122 | + Fix some issues with the generated component tests [#29](https://github.com/kimroen/ember-cli-coffeescript/pull/29) 123 | + Update `broccoli-coffeescript` to `0.3.0`, enabling support for literate CoffeeScript. 124 | 125 | ### 0.3.1 126 | + Add missing dependency [#27](https://github.com/kimroen/ember-cli-coffeescript/pull/27) 127 | 128 | ## 0.3.0 129 | + Add support for linting CoffeeScript [#25](https://github.com/kimroen/ember-cli-coffeescript/pull/25) 130 | 131 | ## 0.2.0 132 | + Add support for the pod-structure for generated files 133 | 134 | ### 0.1.2 135 | + Fix problem with export in generated initializer [#18](https://github.com/kimroen/ember-cli-coffeescript/pull/18) 136 | + Make a workaround for error when generating a controller without specifying a type 137 | + Fix said horrible workaround 138 | + Update dependencies 139 | + Create a changelog 140 | 141 | ### 0.1.1 142 | Do not use this version. 143 | 144 | ## 0.1.0 145 | + Add descriptions and help to all the blueprints 146 | + Move tests to separate blueprints to be in line with ember-cli 147 | + Add test for generated adapters and initializers 148 | + Use `lookupBlueprint` for duplicated code where possible 149 | + Make default model test more robust 150 | + Use `EOL` instead of `\n` where applicable 151 | + Support destroying blueprints 152 | + Change default generated serializer from `ActiveModelSerializer` to `RESTSerializer` 153 | + Update readme with new `type`-syntax for generating controllers 154 | 155 | ### 0.0.7 156 | + Fix a naming-problem with generating components 157 | 158 | ### 0.0.6 159 | + Update dependencies to fix a problem with installing ember-cli-coffeescript with beta versions of node 2.0 160 | 161 | ### 0.0.5 162 | + Generating a helper also generates a test 163 | + The generated initializer for services is more explicit about being for a service 164 | + Generating a route called 'basic' doesn't add it to `router.coffee` 165 | + Generated services are no longer broken 166 | 167 | ### 0.0.4 168 | + Check for updates before adding a new route/resource to the route 169 | + Basic support for older versions of ember-cli 170 | 171 | ### 0.0.2 172 | + Add precompilation of coffeescript 173 | 174 | ### 0.0.1 175 | + Initial release (generators only) 176 | --------------------------------------------------------------------------------