Commit 5d43d81f by Diana Huang Committed by GitHub

Merge pull request #228 from edx/diana/update-rake-behavior

Better filtering for rake search:initialize behavior
parents 1235e147 fb59b727
...@@ -16,7 +16,8 @@ end ...@@ -16,7 +16,8 @@ end
LOG = Logger.new(STDERR) LOG = Logger.new(STDERR)
RAKE_SEARCH_INITIALIZE = (Rake.application.top_level_tasks.include? 'search:initialize') # Indicates whether this is being run from within a 'search:' task in rake.
RAKE_SEARCH = (Rake.application.top_level_tasks.select {|task| task.include? 'search:'}).any?
desc 'Load the environment' desc 'Load the environment'
task :environment do task :environment do
......
...@@ -72,7 +72,7 @@ Dir[File.dirname(__FILE__) + '/models/*.rb'].each { |file| require file } ...@@ -72,7 +72,7 @@ Dir[File.dirname(__FILE__) + '/models/*.rb'].each { |file| require file }
Dir[File.dirname(__FILE__) + '/presenters/*.rb'].each { |file| require file } Dir[File.dirname(__FILE__) + '/presenters/*.rb'].each { |file| require file }
$check_index_mapping_exists = defined?(RAKE_SEARCH_INITIALIZE) === nil || RAKE_SEARCH_INITIALIZE === false $check_index_mapping_exists = defined?(RAKE_SEARCH) === nil || RAKE_SEARCH === false
if $check_index_mapping_exists if $check_index_mapping_exists
# Ensure Elasticsearch index mappings exist, unless we are creating it in the rake search initialize # Ensure Elasticsearch index mappings exist, unless we are creating it in the rake search initialize
Comment.put_search_index_mapping Comment.put_search_index_mapping
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment