riverrun / phauxth

Not actively maintained - Authentication library for Phoenix, and other Plug-based, web applications
409 stars 20 forks source link

Installer is too destructive #34

Closed maxnordlund closed 6 years ago

maxnordlund commented 7 years ago

By that I mean it overwrites a bunch of files, which makes it a bit harder to use on an existing project. Instead it would be sweet if it acted like the new phx.gen.context mix task that only appends to the file instead of overwriting.

This may or may not be hard, I'm not sure how to best go about this. Either some sort of string manipulation, but the best would be to actually parse the code, modify the AST, and render it back again. Perhaps one could use macros to great effect here. Or look at how the various code formatters/linters do it.

Anyway, I do love it though. After a bit of manual restoration (while still keeping the important changes) it works very nice.

riverrun commented 7 years ago

I will look into this. I might add an option to create backups of the relevant files, instead of overwriting them. I would like to keep the default behavior as it is, though, as it works well with new projects.

I am a bit busy at the moment, but hopefully I will find some time to work on this some time this week or next.

maxnordlund commented 7 years ago

Thank you

riverrun commented 6 years ago

The latest version (1.1.3) has a backups option, which is true by default. This means that if a file already exists, a backup of the file will be created.

maxnordlund commented 6 years ago

That's good enough. Does it say so when you run it? Would be nice to know before hand.

riverrun commented 6 years ago

I need to update the documentation / wiki for this, but it does print out a message for every file that is created.

maxnordlund commented 6 years ago

Lovely, thanks.