Skip to content

Commit 489ab24

Browse files
committedJan 22, 2016
[RAILS] Added checks for Redis availability to the 03-expert.rb template
Related: elastic#521
1 parent eb48291 commit 489ab24

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
 

‎elasticsearch-rails/lib/rails/templates/03-expert.rb

+16
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
exit(1)
66
end
77

8+
begin
9+
require 'redis'
10+
rescue LoadError
11+
say_status "ERROR", "Please install the 'redis' gem before running this template", :red
12+
exit(1)
13+
end
14+
15+
begin
16+
Redis.new.info
17+
rescue Redis::CannotConnectError
18+
puts
19+
say_status "ERROR", "Redis not available", :red
20+
say_status "", "This template uses an asynchronous indexer via Sidekiq, and requires a running Redis server."
21+
exit(1)
22+
end
23+
824
append_to_file 'README.rdoc', <<-README
925
1026
== [3] Expert

0 commit comments

Comments
 (0)
Please sign in to comment.