Merge pull request #11 from mozilla/call-it-app
Just use "App" for AppName (fix #8)
This commit is contained in:
Коммит
6ec35ce36e
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"esnext": true,
|
||||
"bitwise": false,
|
||||
"curly": false,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"newcap": true,
|
||||
"noarg": true,
|
||||
"undef": true,
|
||||
"strict": false,
|
||||
"trailing": false,
|
||||
"smarttabs": true
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
"trailing": false,
|
||||
"smarttabs": true,
|
||||
"globals": {
|
||||
"<%= _.classify(appname) %>": true,
|
||||
"App": true,
|
||||
"jQuery": true,
|
||||
"$": true,
|
||||
"Ember": true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var <%= _.classify(appname) %> = window.<%= _.classify(appname) %> = Ember.Application.create();
|
||||
var App = window.App = Ember.Application.create();
|
||||
|
||||
// Order and include as you please.
|
||||
require('scripts/l10n/*');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= _.classify(appname) %>.Router.map(function () {
|
||||
App.Router.map(function () {
|
||||
// Add your routes here
|
||||
});
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<%= _.classify(appname) %>.ApplicationRoute = Ember.Route.extend({
|
||||
App.ApplicationRoute = Ember.Route.extend({
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<%= _.classify(appname) %>.ApplicationAdapter = DS.FixtureAdapter;
|
||||
App.ApplicationAdapter = DS.FixtureAdapter;
|
||||
|
||||
// Add ability to query fixtures in development mode.
|
||||
if (<%= _.classify(appname) %>.ApplicationAdapter === DS.FixtureAdapter) {
|
||||
if (App.ApplicationAdapter === DS.FixtureAdapter) {
|
||||
DS.FixtureAdapter.reopen({
|
||||
queryFixtures: function(records, query, type) {
|
||||
return records.filter(function(record) {
|
||||
|
|
|
@ -9,11 +9,11 @@ var should = chai.should();
|
|||
|
||||
chai.Assertion.includeStack = true;
|
||||
|
||||
<%= _.classify(appname) %>.rootElement = "#ember-testing";
|
||||
App.rootElement = "#ember-testing";
|
||||
Ember.Test.adapter = Ember.Test.MochaAdapter.create();
|
||||
|
||||
<%= _.classify(appname) %>.setupForTesting();
|
||||
<%= _.classify(appname) %>.injectTestHelpers();
|
||||
App.setupForTesting();
|
||||
App.injectTestHelpers();
|
||||
|
||||
window.start = function () {};
|
||||
window.stop = function () {};
|
||||
|
|
|
@ -8,7 +8,7 @@ describe("Index page", function () {
|
|||
|
||||
describe("ApplicationRoute", function () {
|
||||
describe("model property", function () {
|
||||
var applicationRoute = <%= _.classify(appname) %>.ApplicationRoute.create();
|
||||
var applicationRoute = App.ApplicationRoute.create();
|
||||
it("should have the right number of items", function () {
|
||||
var model = applicationRoute.model();
|
||||
model.should.have.length(3);
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(name) %>Controller = Ember.ObjectController.extend({
|
||||
App.<%= _.classify(name) %>Controller = Ember.ObjectController.extend({
|
||||
// Implement your controller here.
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(name) %>EditController = Ember.ObjectController.extend({
|
||||
App.<%= _.classify(name) %>EditController = Ember.ObjectController.extend({
|
||||
needs: '<%= name.toLowerCase() %>',
|
||||
actions: {
|
||||
save: function() {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(pluralized_name) %>Controller = Ember.ObjectController.extend({
|
||||
App.<%= _.classify(pluralized_name) %>Controller = Ember.ObjectController.extend({
|
||||
// Implement your controller here.
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(pluralized_name) %>Route = Ember.Route.extend({
|
||||
App.<%= _.classify(pluralized_name) %>Route = Ember.Route.extend({
|
||||
model: function() {
|
||||
return this.get('store').find('<%= _.slugify(name) %>');
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(name) %>EditRoute = Ember.Route.extend({
|
||||
App.<%= _.classify(name) %>EditRoute = Ember.Route.extend({
|
||||
model: function(params) {
|
||||
return this.get('store').find('<%= _.slugify(name) %>',
|
||||
this.modelFor('<%= _.slugify(name)%>').id);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(name) %>Route = Ember.Route.extend({<% if (!singlePage) { %>
|
||||
App.<%= _.classify(name) %>Route = Ember.Route.extend({<% if (!singlePage) { %>
|
||||
model: function(params) {
|
||||
return this.get('store').find('<%= _.slugify(name) %>',
|
||||
params.<%= _.slugify(name) %>_id);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(name) %> = DS.Model.extend({<% _.each(attrs, function(attr, i) { %>
|
||||
App.<%= _.classify(name) %> = DS.Model.extend({<% _.each(attrs, function(attr, i) { %>
|
||||
<%= _.camelize(attr.name) %>: DS.attr('<%= attr.type %>')<% if(i < (attributes.length - 1)) { %>,<% } %>
|
||||
<% }); %>});
|
||||
|
||||
// delete below here if you do not want fixtures
|
||||
<%= _.classify(appname) %>.<%= _.classify(name) %>.FIXTURES = [
|
||||
App.<%= _.classify(name) %>.FIXTURES = [
|
||||
<% var ids = [1,2]; _.each(ids, function(idx, id) { %>
|
||||
{
|
||||
id: <%= id %>,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= _.classify(appname) %>.Router.map(function () {
|
||||
App.Router.map(function () {
|
||||
<% _.each(models, function(model, i) { %>
|
||||
this.resource('<%= model.plural %>', function() {
|
||||
this.resource('<%= model.single %>', {path: '/:<%= model.single %>_id' }, function() {
|
||||
|
|
|
@ -35,6 +35,7 @@ describe('File Creation', function () {
|
|||
'../../router',
|
||||
'../../app', [
|
||||
helpers.createDummyGenerator(),
|
||||
/*jshint scripturl:true*/
|
||||
'mocha:app'
|
||||
]
|
||||
]);
|
||||
|
@ -75,9 +76,10 @@ describe('File Creation', function () {
|
|||
this.ember.appname = 'some-app';
|
||||
});
|
||||
|
||||
it('creates an application object named after the directory usually', function (done) {
|
||||
it('creates an application object named App (see issue #8)',
|
||||
function (done) {
|
||||
this.ember.run({}, function () {
|
||||
helpers.assertFileContent('app/scripts/app.js', /var SomeApp = window.SomeApp = Ember\.Application\.create\(\);/);
|
||||
helpers.assertFileContent('app/scripts/app.js', /var App = window.App = Ember\.Application\.create\(\);/);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -34,6 +34,7 @@ describe('Karma', function () {
|
|||
'../../router',
|
||||
'../../app', [
|
||||
helpers.createDummyGenerator(),
|
||||
/*jshint scripturl:true*/
|
||||
'mocha:app'
|
||||
]
|
||||
]);
|
||||
|
@ -46,7 +47,7 @@ describe('Karma', function () {
|
|||
});
|
||||
|
||||
it('creates files with correct syntax', function (done) {
|
||||
this.ember.app.options['karma'] = true;
|
||||
this.ember.app.options.karma = true;
|
||||
EXPECTED_FILES = [
|
||||
'karma.conf.js',
|
||||
'test/integration/index.js',
|
||||
|
@ -56,10 +57,10 @@ describe('Karma', function () {
|
|||
helpers.assertFiles(EXPECTED_FILES);
|
||||
|
||||
var content = fs.readFileSync(EXPECTED_FILES[1]);
|
||||
assert(content.toString().match(/Temp.ApplicationRoute/));
|
||||
assert(content.toString().match(/App.ApplicationRoute/));
|
||||
|
||||
var content = fs.readFileSync(EXPECTED_FILES[2]);
|
||||
assert(content.toString().match(/Temp.rootElement/));
|
||||
content = fs.readFileSync(EXPECTED_FILES[2]);
|
||||
assert(content.toString().match(/App.rootElement/));
|
||||
|
||||
done();
|
||||
});
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(pluralized_name) %>View = Ember.View.extend({
|
||||
App.<%= _.classify(pluralized_name) %>View = Ember.View.extend({
|
||||
});
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(name) %>View = Ember.View.extend({
|
||||
App.<%= _.classify(name) %>View = Ember.View.extend({
|
||||
});
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<%= _.classify(appname) %>.<%= _.classify(name) %>EditView = Ember.View.extend({
|
||||
App.<%= _.classify(name) %>EditView = Ember.View.extend({
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче