haciendaio / hacienda

Hacienda is the new shiny open source content service - built in Manchester, UK
GNU Affero General Public License v3.0
73 stars 10 forks source link

remove 'rm -rf' from bootstrap process #6

Closed damned closed 9 years ago

damned commented 9 years ago

a bit risky with automatic script running 'rm -rf' - not great if someone downloads gem, runs bootstrap and potentially recursively deletes some of their data...

e.g. if some enters a test repo with space in it? with an asterisk in it?

mmircea16 commented 9 years ago

Agree!

I am looking at how to solve the problem. There are 2 use cases:

  1. bootstrapping for development purposes (see bootstrap:config)
  2. bootstrapping in an automated environment (see bootstrap:config_unattended)

While for 1) the solution is simple: stop and ask the user if he wants that folder to be deleted (or even fail if the folder exists), for 2) I don't see a straightforward solution.

Running in automated environment implies no user interaction. One solution would be to have a flag like "safe" which by default is true and the user has to add it in the config_unattended call as false. True would fail if the folder is there while false will delete it. While not amazing, this solution would force the user to understand better what the bootstrap config is doing.

What do you think @damned ?

mmircea16 commented 9 years ago

Added this commit to implement the above: https://github.com/www-thoughtworks-com/hacienda/commit/a35efc66e2b170cf5765ce23d9f86b94fd9f7f0e