Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the set app name from bower.json #462

Merged
merged 1 commit into from
Jan 12, 2014
Merged

Use the set app name from bower.json #462

merged 1 commit into from
Jan 12, 2014

Conversation

p-m-p
Copy link
Contributor

@p-m-p p-m-p commented Jan 11, 2014

Follow on from the discussions here: yeoman/generator-backbone#187

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) when pulling 8215494 on p-m-p:master into dbd0a43 on yeoman:master.

// - args if supplied
// - Current working directory
try {
this.appname = require(path.join(process.cwd(), 'bower.json')).name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bower.json first, then package.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added below 👇

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) when pulling 5c96344 on p-m-p:master into dbd0a43 on yeoman:master.

this.appname = require(path.join(process.cwd(), 'package.json')).name;
}
catch (e) {
this.appname = this.args[0] || path.basename(process.cwd());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should use the arguments here. It won't work for subgenerators who are expecting other arguments. And it'll break behavior for generators expecting a first arguments (for example, in Generator-BBB we ask a file path as first arg).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you run a sub-generator in a project without a bower or package json? If so how/where should I get the app name from argv when the project is first scaffolded?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just don't think we should use argv by default. If a generator want to use it, then they can implement it themselves. Otherwise, using the folder name looks good enough for me.

@SBoudrias
Copy link
Member

I think this would all be cleaner if you'd exported the logic inside a method (defaultAppName or determineAppname or something similar).

That'd make tests way cleaner as you wouldn't need to instantiate a new Generator inside each tests, and it'd make the constructor function code easier to follow.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) when pulling f41a7d1 on p-m-p:master into dbd0a43 on yeoman:master.

@p-m-p
Copy link
Contributor Author

p-m-p commented Jan 11, 2014

@SBoudrias I agree, I'll have another pass on it tomorrow. I didn't have much time to look at the rest of the code today but if you could answer the questions on the outdated diffs that would help. Cheers.

@p-m-p
Copy link
Contributor Author

p-m-p commented Jan 12, 2014

@SBoudrias how's this looking now?

@addyosmani
Copy link
Member

The PR currently still has some merge conflicts that need to be resolved :)

@p-m-p
Copy link
Contributor Author

p-m-p commented Jan 12, 2014

@addyosmani I'll rebase and squash some of the erroneous commits if you guys are happy with what is here

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling ea1db97 on p-m-p:master into 3642640 on yeoman:master.

@addyosmani
Copy link
Member

LGTM for a merge once @SBoudrias has given his sign-off.

@SBoudrias
Copy link
Member

Awesome! Thanks a lot

SBoudrias added a commit that referenced this pull request Jan 12, 2014
Use the set app name from bower.json
@SBoudrias SBoudrias merged commit e989059 into yeoman:master Jan 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants