This repository has been archived by the owner on Nov 25, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
4,210 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*jshint node:true*/ | ||
|
||
var stringUtil = require('ember-cli-string-utils'); | ||
var path = require('path'); | ||
var inflector = require('inflection'); | ||
|
||
module.exports = { | ||
description: 'Generates an import wrapper.', | ||
|
||
fileMapTokens: function() { | ||
return { | ||
__name__: function(options) { | ||
if (options.pod && options.hasPathToken) { | ||
return options.locals.blueprintName; | ||
} | ||
return options.dasherizedModuleName; | ||
}, | ||
__path__: function(options) { | ||
if (options.pod && options.hasPathToken) { | ||
return path.join(options.podPath, options.dasherizedModuleName); | ||
} | ||
return inflector.pluralize(options.locals.blueprintName); | ||
}, | ||
__root__: function(options) { | ||
if (options.inRepoAddon) { | ||
return path.join('lib', options.inRepoAddon, 'app'); | ||
} | ||
return 'app'; | ||
} | ||
}; | ||
}, | ||
|
||
locals: function(options) { | ||
var addonRawName = options.inRepoAddon ? options.inRepoAddon : options.project.name(); | ||
var addonName = stringUtil.dasherize(addonRawName); | ||
var fileName = stringUtil.dasherize(options.entity.name); | ||
var blueprintName = options.originBlueprintName; | ||
var modulePathSegments = [addonName, inflector.pluralize(options.originBlueprintName), fileName]; | ||
|
||
if (blueprintName.match(/-addon/)) { | ||
blueprintName = blueprintName.substr(0,blueprintName.indexOf('-addon')); | ||
modulePathSegments = [addonName, inflector.pluralize(blueprintName), fileName]; | ||
} | ||
|
||
if (options.pod) { | ||
modulePathSegments = [addonName, fileName, blueprintName]; | ||
} | ||
|
||
return { | ||
modulePath: modulePathSegments.join('/'), | ||
blueprintName: blueprintName | ||
}; | ||
} | ||
}; |
15 changes: 3 additions & 12 deletions
15
blueprints/acceptance-test/files/tests/acceptance/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
blueprints/controller-test/files/tests/unit/__path__/__test__.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { moduleFor, test } from 'ember-qunit'; | ||
|
||
moduleFor('controller:<%= dasherizedModuleName %>', { | ||
moduleFor('controller:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { | ||
// Specify the other units that are required for this test. | ||
// needs: ['controller:foo'] | ||
}); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
var controller = this.subject(); | ||
let controller = this.subject(); | ||
assert.ok(controller); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
/*jshint node:true*/ | ||
|
||
var testInfo = require('ember-cli-test-info'); | ||
|
||
module.exports = { | ||
description: 'Generates a controller unit test.' | ||
description: 'Generates a controller unit test.', | ||
locals: function(options) { | ||
return { | ||
friendlyTestDescription: testInfo.description(options.entity.name, 'Unit', 'Controller') | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/*jshint node:true*/ | ||
|
||
module.exports = require('ember-cli/blueprints/addon-import'); | ||
module.exports = require('../-addon-import'); |
4 changes: 2 additions & 2 deletions
4
blueprints/helper-test/files/tests/unit/helpers/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { <%= camelizedModuleName %> } from '<%= dependencyDepth %>/helpers/<%= dasherizedModuleName %>'; | ||
import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('<%= friendlyTestName %>'); | ||
|
||
// Replace this with your real tests. | ||
test('it works', function(assert) { | ||
var result = <%= camelizedModuleName %>(42); | ||
let result = <%= camelizedModuleName %>([42]); | ||
assert.ok(result); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
/*jshint node:true*/ | ||
|
||
var getDependencyDepth = require('ember-cli-get-dependency-depth'); | ||
var testInfo = require('ember-cli-test-info'); | ||
var stringUtils = require('ember-cli-string-utils'); | ||
|
||
module.exports = { | ||
description: 'Generates a helper unit test.', | ||
locals: function(options) { | ||
return { | ||
friendlyTestName: testInfo.name(options.entity.name, "Unit", "Helper"), | ||
dependencyDepth: getDependencyDepth(options.entity.name) | ||
friendlyTestName: testInfo.name(options.entity.name, 'Unit', 'Helper'), | ||
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix) | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/*jshint node:true*/ | ||
|
||
module.exports = require('ember-cli/blueprints/addon-import'); | ||
module.exports = require('../-addon-import'); |
9 changes: 4 additions & 5 deletions
9
blueprints/initializer-test/files/tests/unit/initializers/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
/*jshint node:true*/ | ||
|
||
var getDependencyDepth = require('ember-cli-get-dependency-depth'); | ||
var testInfo = require('ember-cli-test-info'); | ||
var stringUtils = require('ember-cli-string-utils'); | ||
|
||
module.exports = { | ||
description: 'Generates an initializer unit test.', | ||
locals: function(options) { | ||
return { | ||
friendlyTestName: testInfo.name(options.entity.name, "Unit", "Initializer"), | ||
dependencyDepth: getDependencyDepth(options.entity.name) | ||
friendlyTestName: testInfo.name(options.entity.name, 'Unit', 'Initializer'), | ||
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix) | ||
}; | ||
} | ||
}; |
4 changes: 2 additions & 2 deletions
4
blueprints/initializer/files/__root__/initializers/__name__.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export function initialize(/* container, application */) { | ||
export function initialize(/* application */) { | ||
// application.inject('route', 'foo', 'service:foo'); | ||
} | ||
|
||
export default { | ||
name: '<%= dasherizedModuleName %>', | ||
initialize: initialize | ||
initialize | ||
}; |
1 change: 1 addition & 0 deletions
1
blueprints/instance-initializer-addon/files/__root__/__path__/__name__.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default, initialize } from '<%= modulePath %>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/*jshint node:true*/ | ||
|
||
module.exports = require('../-addon-import'); |
25 changes: 25 additions & 0 deletions
25
blueprints/instance-initializer-test/files/tests/unit/instance-initializers/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Ember from 'ember'; | ||
import { initialize } from '<%= dasherizedModulePrefix %>/instance-initializers/<%= dasherizedModuleName %>'; | ||
import { module, test } from 'qunit'; | ||
import destroyApp from '../../helpers/destroy-app'; | ||
|
||
module('<%= friendlyTestName %>', { | ||
beforeEach: function() { | ||
Ember.run(() => { | ||
this.application = Ember.Application.create(); | ||
this.appInstance = this.application.buildInstance(); | ||
}); | ||
}, | ||
afterEach: function() { | ||
Ember.run(this.appInstance, 'destroy'); | ||
destroyApp(this.application); | ||
} | ||
}); | ||
|
||
// Replace this with your real tests. | ||
test('it works', function(assert) { | ||
initialize(this.appInstance); | ||
|
||
// you would normally confirm the results of the initializer here | ||
assert.ok(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/*jshint node:true*/ | ||
|
||
var testInfo = require('ember-cli-test-info'); | ||
var stringUtils = require('ember-cli-string-utils'); | ||
|
||
module.exports = { | ||
description: 'Generates an instance initializer unit test.', | ||
locals: function(options) { | ||
return { | ||
friendlyTestName: testInfo.name(options.entity.name, 'Unit', 'Instance Initializer'), | ||
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix) | ||
}; | ||
} | ||
}; |
8 changes: 8 additions & 0 deletions
8
blueprints/instance-initializer/files/__root__/instance-initializers/__name__.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export function initialize(/* appInstance */) { | ||
// appInstance.inject('route', 'foo', 'service:foo'); | ||
} | ||
|
||
export default { | ||
name: '<%= dasherizedModuleName %>', | ||
initialize | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/*jshint node:true*/ | ||
|
||
module.exports = { | ||
description: 'Generates an instance initializer.' | ||
}; |
6 changes: 3 additions & 3 deletions
6
blueprints/mixin-test/files/tests/unit/mixins/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import Ember from 'ember'; | ||
import <%= classifiedModuleName %>Mixin from '../../../mixins/<%= dasherizedModuleName %>'; | ||
import <%= classifiedModuleName %>Mixin from '<%= projectName %>/mixins/<%= dasherizedModuleName %>'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('<%= friendlyTestName %>'); | ||
|
||
// Replace this with your real tests. | ||
test('it works', function(assert) { | ||
var <%= classifiedModuleName %>Object = Ember.Object.extend(<%= classifiedModuleName %>Mixin); | ||
var subject = <%= classifiedModuleName %>Object.create(); | ||
let <%= classifiedModuleName %>Object = Ember.Object.extend(<%= classifiedModuleName %>Mixin); | ||
let subject = <%= classifiedModuleName %>Object.create(); | ||
assert.ok(subject); | ||
}); |
Oops, something went wrong.