I know I could just delete the code and files; however, is there a way to remove a generated route in yeoman - angular in a similar automated command?
e.g. yo angular:route myroute
is how you generate it
What is the cmd line code I would run to remove, rollback, or delete this scaffolding of a route?
I think there is not command for do it.
I read the documentation (http://yeoman.io/generators.html#writing-your-first-generator) about generators and subgenerators and I can't find anything about removing process.
I read also documentation about generator API (http://yeoman.github.io/generator/actions.html) and there are options like copy
, directory
, read
and write
but still nothing about removing. So I think it's not possible even write your own command for these generators.
Coming from a Rails background even I tried to remove the routes but there doesn't seem to be any method to do so. I've looked through the docs. And there doesn't seem to be any plan to add iy.
Anyway when we generate the files we see which files are generated so all we have to do is delete those.
yo angular:route route1
creates 3 files
app/scripts/controllers/route1.js (controller)
app/views/route1.html (view)
app/test/spec/controllers/route1.js (testing the controller)
For the other generators:
yo angular:controller user app/scripts/controllers/user.js
yo angular:directive myDirective app/scripts/directives/myDirective.js
yo angular:filter myFilter app/scripts/filters/myFilter.js
yo angular:view user app/views/user.html
yo angular:service myService app/scripts/services/myService.js
yo angular:decorator serviceName app/scripts/decorators/serviceNameDecorator.js
yo angular:controller user --coffee app/scripts/controller/user.coffee
Tests are also generated along side.
Here is a shell hack that I have been using.
$ yo angular:controller testcontroller
create app/scripts/controllers/testcontroller.js
create test/spec/controllers/testcontroller.js
$ rm -v `yo angular:controller testcontroller 2>&1 | awk '{print $2}'`
app/scripts/controllers/testcontroller.js
test/spec/controllers/testcontroller.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With