Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a solr:create rake task #33

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/solr_wrapper/tasks/solr_wrapper.rake
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,23 @@ namespace :solr do
end
end

namespace :collection do
desc 'Create a collection in solr'
task create: :start do
start = ARGV.find_index('solr:collection:create')
if ARGV.length >= start + 2
dir = ARGV[start + 1]
name = ARGV[start + 2]
# Rake tries to run these as tasks.
task(dir.to_sym) {}
task(name.to_sym) {}
@solr_instance.create(dir: dir, name: name)
else
$stderr.puts "Usage: rake solr:collection:create <directory> <name>"
end
end
end

desc 'restart solr'
task restart: :environment do
puts "Restarting solr"
Expand Down