Skip to content

Commit

Permalink
Merge pull request #22 from mcfly-io/feat-appname
Browse files Browse the repository at this point in the history
  • Loading branch information
thaiat committed Feb 3, 2016
2 parents ccf83fe + 52f54b2 commit d48f1d1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
9 changes: 5 additions & 4 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = generators.Base.extend({
this.mixins.beautifyJson();

this.appname = this.appname || path.basename(process.cwd());
this.appname = this.mixins.camelize(this.appname);
this.appname = this.mixins.dasherize(this.appname);

//******* arguments ***********
// To access arguments later use this.argumentName
Expand All @@ -36,7 +36,7 @@ module.exports = generators.Base.extend({
defaults: this.appname
});

this.appname = this.mixins.camelize(this.appname);
this.appname = this.mixins.dasherize(this.appname);
// ***** arguments ********

// ****** options *********
Expand Down Expand Up @@ -85,6 +85,7 @@ module.exports = generators.Base.extend({
}];
this.prompt(prompts, function(answers) {
this.answers = answers;
this.appname = this.answers.appname ? this.mixins.dasherize(this.answers.appname) : this.mixins.dasherize(this.appname);
// To access answers later use this.answers.someAnswer;
this.answers.clientFolder = this.mixins.dasherize(this.answers.clientFolder);
done();
Expand Down Expand Up @@ -133,14 +134,14 @@ module.exports = generators.Base.extend({
this.fs.copyTpl(
this.templatePath('_package.json'),
this.destinationPath('package.json'), {
appname: this.mixins.dasherize(this.appname),
appname: this.appname,
clientFolder: this.answers.clientFolder
}
);
this.fs.copyTpl(
this.templatePath('_README.md'),
this.destinationPath('README.md'), {
appname: this.mixins.dasherize(this.appname)
appname: this.appname
}
);
this.fs.copyTpl(
Expand Down
8 changes: 5 additions & 3 deletions generators/component/templates/_component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ import {<%=componentnameClass%>Component} from './<%=componentnameFile%>.compone
/* beautify ignore:end */

describe('Component: <%=componentnameClass%>Component', () => {

let builder;
beforeEachProviders(() => []);

it('should be defined', injectAsync([TestComponentBuilder], (tcb) => {
return tcb.createAsync(<%=componentnameClass%>Component)
.then((fixture) => {
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
expect(compiled).toBeDefined();
let element = fixture.debugElement.nativeElement;
let cmpInstance = fixture.debugElement.componentInstance;
expect(cmpInstance).toBeDefined();
expect(element).toBeDefined();
});
}));

Expand Down
4 changes: 2 additions & 2 deletions test/mocha/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe(generatorShortname + ':app', function() {
it('creates a .yo-rc.json file', function() {
var content = {};
content[generatorFullname] = {
appname: appname,
appname: 'name-x',
clientFolder: clientFolder
};
assert.JSONFileContent('.yo-rc.json', content);
Expand All @@ -86,7 +86,7 @@ describe(generatorShortname + ':app', function() {
it('should be transformed to snake case', function() {
var content = {};
content[generatorFullname] = {
appname: appname,
appname: 'name-x',
clientFolder: 'dummy-folder'
};
assert.JSONFileContent('.yo-rc.json', content);
Expand Down
2 changes: 1 addition & 1 deletion test/mocha/component.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe(generatorShortname + ':component', function() {
[pathdir + 'my-dummy.component.ts', /export class MyDummyComponent/],
[pathdir + 'my-dummy.component.ts', /selector: 'my-dummy'/],
[pathdir + 'my-dummy.component.spec.ts', /import {MyDummyComponent} from '\.\/my-dummy.component.ts';/],
[pathdir + 'my-dummy.component.spec.ts', /return tcb.createAsync\(MyDummyComponent\)/],
[pathdir + 'my-dummy.component.spec.ts', /createAsync\(MyDummyComponent\)/],
[pathdir + 'my-dummy.component.html', /<div>myDummy<\/div>/]

];
Expand Down

0 comments on commit d48f1d1

Please sign in to comment.