-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 current package.json name value for ember init
.
#491
Use the current package.json name value for ember init
.
#491
Conversation
@@ -18,7 +18,8 @@ module.exports = new Command({ | |||
|
|||
run: function(environment, options) { | |||
var cwd = process.cwd(); | |||
var rawName = path.basename(cwd); | |||
var pkg = require(cwd + '/package'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will fail if no package is present? seems incorrect
Just updated to use |
Now with tests. |
can you just put project in the outer environment object: https://github.com/stefanpenner/ember-cli/blob/master/lib/cli/index.js#L37 and inject it here: https://github.com/stefanpenner/ember-cli/blob/master/lib/cli/cli.js#L26 on commands? This may seem a bit strange, but it keeps knowledge of how to get the project instance isolated from commands, which is more aligned with the command refactor. |
@@ -9,7 +9,7 @@ module.exports = new Task({ | |||
// Options: Boolean dryRun | |||
run: function(ui, options) { | |||
var cwd = process.cwd(); | |||
var rawName = path.basename(cwd); | |||
var rawName = options.rawName || path.basename(cwd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like we never want to fallback to path.basename
instead always requiring the correct inputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just refactored as you suggested earlier. I've still got a couple failures I'm working through though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, thanks! Just reviewing before i got to sleep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this still seems strange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the fallback.
Refactor `CLI` to inject the current Project into each command.
Updated with latest round of formatting tweaks. Please let me know if there is anything else needed. |
looks good |
Use the current package.json name value for `ember init`.
Closes #395.
Please note I did not add tests for this, as this code path is completely refactored (and tested) in #466.