OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/lib/tasks/setting.rake

23 lines
620 B

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
desc 'Allow to get a Setting: rake setting:get[key]'
task :get, [:key] => :environment do |_t, args|
setting = Setting.find_by_name(args[:key])
unless setting.nil?
puts(setting.value)
end
end
end