diff options
author | Jon Moss <me@jonathanmoss.me> | 2016-01-15 19:03:05 -0500 |
---|---|---|
committer | Jon Moss <me@jonathanmoss.me> | 2016-01-18 18:59:30 -0500 |
commit | 6aeaed4c1a370084e82c6712a32422a58dac8b8c (patch) | |
tree | 0284579e3fe07f57e7f7b9f16d627f63ab8c7eaa /actioncable/lib | |
parent | 75489642c8dcb4c75ccc14b909113a2828d6acb8 (diff) | |
download | rails-6aeaed4c1a370084e82c6712a32422a58dac8b8c.tar.gz rails-6aeaed4c1a370084e82c6712a32422a58dac8b8c.tar.bz2 rails-6aeaed4c1a370084e82c6712a32422a58dac8b8c.zip |
All Redis deps are now optional, Postgres --> PostgreSQL adapter
Diffstat (limited to 'actioncable/lib')
-rw-r--r-- | actioncable/lib/action_cable/storage_adapter.rb | 2 | ||||
-rw-r--r-- | actioncable/lib/action_cable/storage_adapter/postgresql.rb (renamed from actioncable/lib/action_cable/storage_adapter/postgres.rb) | 8 | ||||
-rw-r--r-- | actioncable/lib/action_cable/storage_adapter/redis.rb | 8 |
3 files changed, 14 insertions, 4 deletions
diff --git a/actioncable/lib/action_cable/storage_adapter.rb b/actioncable/lib/action_cable/storage_adapter.rb index f1c395eb3a..a4fe12c770 100644 --- a/actioncable/lib/action_cable/storage_adapter.rb +++ b/actioncable/lib/action_cable/storage_adapter.rb @@ -1,7 +1,7 @@ module ActionCable module StorageAdapter autoload :Base, 'action_cable/storage_adapter/base' - autoload :Postgres, 'action_cable/storage_adapter/postgres' + autoload :PostgreSQL, 'action_cable/storage_adapter/postgresql' autoload :Redis, 'action_cable/storage_adapter/redis' end end diff --git a/actioncable/lib/action_cable/storage_adapter/postgres.rb b/actioncable/lib/action_cable/storage_adapter/postgresql.rb index 5d874533be..1d8460e2ea 100644 --- a/actioncable/lib/action_cable/storage_adapter/postgres.rb +++ b/actioncable/lib/action_cable/storage_adapter/postgresql.rb @@ -1,8 +1,14 @@ require 'thread' +begin + require 'pg' +rescue Gem::LoadError => e + raise Gem::LoadError, "You are trying to use the PostgreSQL ActionCable adapter, but do not have the proper gems installed. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActionCable)." +end + module ActionCable module StorageAdapter - class Postgres < Base + class PostgreSQL < Base # The storage instance used for broadcasting. Not intended for direct user use. def broadcast(channel, payload) with_connection do |pg_conn| diff --git a/actioncable/lib/action_cable/storage_adapter/redis.rb b/actioncable/lib/action_cable/storage_adapter/redis.rb index 3e0ede057a..62a3971ec7 100644 --- a/actioncable/lib/action_cable/storage_adapter/redis.rb +++ b/actioncable/lib/action_cable/storage_adapter/redis.rb @@ -1,5 +1,9 @@ -require 'em-hiredis' -require 'redis' +begin + require 'em-hiredis' + require 'redis' +rescue Gem::LoadError => e + raise Gem::LoadError, "You are trying to use the Redis ActionCable adapter, but do not have the proper gems installed. Add `gem 'em-hiredis'` and `gem 'redis'` to your Gemfile (and ensure its version is at the minimum required by ActionCable)." +end module ActionCable module StorageAdapter |