diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-06 11:35:58 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-06 11:35:58 +0000 |
commit | 465937d6d894fc0bcd7548c53f6e294a17f68b5c (patch) | |
tree | 8cdf48b924afd98de9c168a07822515400670527 /vendor/plugins | |
parent | b06195a428b5cb6c3e95b07c631e2f18febf05f0 (diff) | |
parent | b476615a00ea8ad699c412c604cbae18388dedd7 (diff) |
Merge branch 'release/0.5' into develop
Diffstat (limited to 'vendor/plugins')
-rw-r--r-- | vendor/plugins/acts_as_xapian/lib/tasks/xapian.rake | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/vendor/plugins/acts_as_xapian/lib/tasks/xapian.rake b/vendor/plugins/acts_as_xapian/lib/tasks/xapian.rake index d18cd07d5..649d0c0d4 100644 --- a/vendor/plugins/acts_as_xapian/lib/tasks/xapian.rake +++ b/vendor/plugins/acts_as_xapian/lib/tasks/xapian.rake @@ -30,12 +30,23 @@ namespace :xapian do desc 'Completely rebuilds Xapian search index (must specify all models)' task :rebuild_index => :environment do + def coerce_arg(arg, default) + if arg == "false" + return false + elsif arg == "true" + return true + elsif arg.nil? + return default + else + return arg + end + end raise "specify ALL your models with models=\"ModelName1 ModelName2\" as parameter" if ENV['models'].nil? ActsAsXapian.rebuild_index(ENV['models'].split(" ").map{|m| m.constantize}, - ENV['verbose'] ? true : false, - ENV['terms'] == "false" ? false : ENV['terms'], - ENV['values'] == "false" ? false : ENV['values'], - ENV['texts'] == "false" ? false : true) + coerce_arg(ENV['verbose'], false), + coerce_arg(ENV['terms'], true), + coerce_arg(ENV['values'], true), + coerce_arg(ENV['textx'], true)) end # Parameters - are models, query, offset, limit, sort_by_prefix, |