Aplicación Rails que se autodestruye
written on 06-05-2008 | comments

Suicidio de amor / Love suicideTras leer el interesante artículo 21 Ruby Tricks You Should Be Using In Your Own Code sobre la posibilidad de borrar un árbol de directorios con FileUtils.rm_r 'nombre_directorio' no pude resistir la tentación de probar esto:

rails autodestroy cd autodestroy script/generate controller Suicide now

Y en app/controllers/suicide_controller.rb:

def now FileUtils.rm_r "#{RAILS_ROOT}" end

Listos para la autodestrucción...

script/server Al visitar http://localhost:3000/suicide/now, la aplicación se borrará a si misma del disco duro.

Manejar con cuidado! :P

Creative Commons License photo credit: Vagamundos

Back to the list of posts
blog comments powered by Disqus