Free As In Freelance
being the adventures of Jaime Iniesta on the wild wild web
Aplicación Rails que se autodestruye
written on 06-05-2008 |
comments
Tras 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
photo credit: Vagamundos
