Commit e05c31b890de9921d09b197d7cffc4a626bf19a7

Authored by AntonioTerceiro
1 parent 7c751030

ActionItem629: adding backup task

This task aims to ease making backup of the files that are created under
public/

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2427 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 8 additions and 0 deletions   Show diff stats
lib/tasks/backup.rake 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +desc "Creates a backup of the user files stored in public/"
  2 +task :backup do
  3 + dirs = Dir.glob('public/images/[0-9][0-9][0-9][0-9]') + ['public/articles', 'public/thumbnails', 'public/user_themes'].select { |d| File.exists?(d) }
  4 + tarball = 'backups/files-' + Time.now.strftime('%Y-%m-%d-%R') + '.tar.bz2'
  5 +
  6 + mkdir_p(File.dirname(tarball))
  7 + sh('tar', 'cjf', tarball, *dirs)
  8 +end
... ...