From e05c31b890de9921d09b197d7cffc4a626bf19a7 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Thu, 28 Aug 2008 20:00:32 +0000 Subject: [PATCH] ActionItem629: adding backup task --- lib/tasks/backup.rake | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) create mode 100644 lib/tasks/backup.rake diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake new file mode 100644 index 0000000..30ba32f --- /dev/null +++ b/lib/tasks/backup.rake @@ -0,0 +1,8 @@ +desc "Creates a backup of the user files stored in public/" +task :backup do + 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) } + tarball = 'backups/files-' + Time.now.strftime('%Y-%m-%d-%R') + '.tar.bz2' + + mkdir_p(File.dirname(tarball)) + sh('tar', 'cjf', tarball, *dirs) +end -- libgit2 0.21.2