-
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
Add edit capability to ember init
#1000
Conversation
Added a little video describing the use case: https://www.dropbox.com/s/inarmwkye7wpjln/final-ember-cli-edit-file.mov |
@@ -35,6 +36,10 @@ FileInfo.prototype.confirmOverwrite = function(path) { | |||
] | |||
}; | |||
|
|||
if(! /^win/.test(process.platform)) { |
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.
i was just going to ask about this^ Can I assume you tested that this PR doesn't break our windows support?
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.
The option to start the edit process shouldn't be available in non windows environments. But I need to check. I'll spin up an AWS instance tonight to verify.
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.
@stefanpenner I ran on Windows, it correctly prevents showing of the prompt (windows 7). And didn't blow up. :) (though I should mention that this was a quick check)
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.
sounds like due diligence has been exercised.
This is awesome 😄 |
* This has been added to edit-file-diff model in order to more easily * abstract when `ember update` is a thing When you run `ember init` a new option is given. If you select it the following events take place: 1. A tmp file containing the .diff of your file as compared to the blueprint file 2. A child process is spawned with whatever command is set to $EDITOR with an argument of the above tmp file path 3. On the 'close' event of this child process the diff you've edited is applied to your file 4. the tmp file from step 1 is removed 5. normal process resumes
This is for editors like sublime and text mate that will by default launch and resume execution of io. In these cases it is usually reccomended to use the `-w` flag and to set those flags on the $EDITOR variable in your rc file. e.g $EDITOR=mate becomes $EDITOR='/usr/local/bin/mate -w' This updates the childProcess spawn to trim arguments and pass them as appropriate. In the case of mate -w editor is set to `mate` editorArgs is set to ['-w']
LGTM changelog entry and we are good to go |
Need to add error handling for when a patch can't be cleanly applied. Which begs the question, what should we do if a patch is not cleanly applicable? Prompt the user again? /cc @stefanpenner |
@stefanpenner This has been resolved. It now re-requests confirmation if diff is not applicable. 😄 |
Add edit capability to `ember init`
👍 |
This has been added to edit-file-diff model in order to more easily abstract when
ember update
is a thingWhen you run
ember init
a new option is given when the process encounters a file it needs input from user. If you select it the following events take place:blueprint file
with an argument of the above tmp file path
applied to your file