aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks/config_files.rake
diff options
context:
space:
mode:
authorMark Longair <mhl@pobox.com>2013-10-31 13:06:59 +0000
committerMark Longair <mhl@pobox.com>2013-11-07 12:46:25 +0000
commitaa9998404c976019de6355ec9a88c1884046a2ae (patch)
tree58b0d482c8d2a03e5b937f32e52a59c67f7bdc99 /lib/tasks/config_files.rake
parentba67583127e153d3ec8f8e828e5699ccbe153d47 (diff)
Add a rake task to rewrite the crontab-example file
As suggested by Louise Crow, this new rake task reuses the convert_ugly function to rewrite the crontab-example file into a usable crontab file.
Diffstat (limited to 'lib/tasks/config_files.rake')
-rw-r--r--lib/tasks/config_files.rake18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index 33e4a9e00..d0e4001f0 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -48,5 +48,23 @@ namespace :config_files do
end
end
+ desc 'Convert Debian .ugly crontab file in config to a form suitable for installing in /etc/cron.d'
+ task :convert_crontab => :environment do
+ example = 'rake config_files:convert_crontab DEPLOY_USER=deploy VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli SITE=alaveteli CRONTAB=config/crontab-example'
+ check_for_env_vars(['DEPLOY_USER',
+ 'VHOST_DIR',
+ 'VCSPATH',
+ 'SITE',
+ 'CRONTAB'], example)
+ replacements = {
+ :user => ENV['DEPLOY_USER'],
+ :vhost_dir => ENV['VHOST_DIR'],
+ :vcspath => ENV['VCSPATH'],
+ :site => ENV['SITE']
+ }
+ convert_ugly(ENV['CRONTAB'], replacements).each do |line|
+ puts line
+ end
+ end
end