From 9b3ecece5707885b10bc3d758e4066bf1b86cd46 Mon Sep 17 00:00:00 2001 From: Cyril Rohr Date: Mon, 28 Jul 2014 12:51:29 +0000 Subject: [PATCH] Allow to configure settings with rake task --- lib/tasks/setting.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/tasks/setting.rake diff --git a/lib/tasks/setting.rake b/lib/tasks/setting.rake new file mode 100644 index 0000000000..9509be6b15 --- /dev/null +++ b/lib/tasks/setting.rake @@ -0,0 +1,14 @@ +namespace :setting do + desc "Allow to set a Setting: rake setting:set[key1=value1,key2=value2]" + task :set => :environment do |t,args| + args.extras.each do |tuple| + key, value = tuple.split("=") + setting = Setting.find_by_name(key) + if setting.nil? + Setting.create! name: key, value: value + else + setting.update_attributes! value: value + end + end + end +end