amber
amber copied to clipboard
[CLI] Add destroy compliment to generator commands
amber g controller Post
will create src/controllers/post.cr
amber d controller Post
should delete src/controllers/post.cr
Do the same for scaffolding and the rest of the generators.
Was this already address?
No but @drujensen believes and mostly convinced me that we'll be ok with out it for now as long as we commit to git before generating things.
I think this could and should be done in teeplate. I believe the relevant starting points are: here: https://github.com/mosop/teeplate/blob/master/src/lib/renderer.cr#L47 and here: https://github.com/mosop/teeplate/blob/master/src/lib/rendering_entry.cr#L57
I've opened an issue here: https://github.com/mosop/teeplate/issues/8
We decided a couple months ago that this isn't a priority. Seems like I was the only one who actually uses the destroy option in the rails
On Nov 12, 2017 9:45 AM, "Mark" [email protected] wrote:
I think this could and should be done in teeplate. I believe the relevant starting points are: here: https://github.com/mosop/teeplate/blob/master/src/lib/ renderer.cr#L47 and here: https://github.com/mosop/teeplate/blob/master/src/lib/ rendering_entry.cr#L57
I've opened an issue here: mosop/teeplate#8 https://github.com/mosop/teeplate/issues/8
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/amberframework/amber/issues/188#issuecomment-343750126, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHmpM5nn3FHH0JzVy4GArcTfHeihilAks5s1yCrgaJpZM4PC9D9 .
Not a priority, but still a good feature. I love the destroy functionality.
One typo with a scaffold and you're spending 10 minutes deleting files (or worse, NOT deleting them at all).
I usually run a scaffold about 3 times before I have it right.
If the Teeplate maintainer puts it in, then it should be an easy add for us at that point.
@amberframework/core-team - There is a fix for this in teeplate, but mosop isn't maintaining it anymore.
If we switch to the amberframework fork of this, we can incorporate the work that @aaronstillwell has done.
Whats the status of this? Has this been resolved by pointing to Amber Fork?
@eliasjpr the fork of teeplate is now at https://github.com/amberframework/teeplate, so we'll get the necessary changes up and running there asap. See https://github.com/amberframework/teeplate/pull/2 for the discussion specific to the necessary behaviour for a destroy command.
@eliasjpr - I think amber will require a change to get this functionality complete in amber.
For files like:
...
07:30:59 Generate | (INFO) skipped spec/models/spec_helper.cr
...
07:30:59 Generate | (INFO) skipped spec/controllers/spec_helper.cr
...
There needs to be logic that does not destroy those files (in this example for destroying a scaffold).
Agree, I think we can skip those files, after all there are just there to shorten the require. I don't think that we should delete or modify these files contents
In order to support a delete option we really need to roll back to previous versions of any files that were modified during the generate stage. If this functionality is to reduce the effort to remove a set of files that were created with the scaffold generator then there is an easier way. I don't have this problem because I order my code in modules using damianham/amber_render_module so to rollback for example:
amber g scaffold Post tutle:string body:text
because I misspelt title I simple type
rm -rf src/modules/post spec/modules/post db/migrations/*create_post.sql
and remove the 2 lines from src/views/layouts/_nav.slang.
Some update on this?, looks like https://github.com/amberframework/teeplate/pull/2 is already accepted, not merged, though.
One option is to leverage git and rollback to the previous sha.