lib/rhoconnect/server.rb in rhoconnect-3.2.0.beta2 vs lib/rhoconnect/server.rb in rhoconnect-3.2.0.beta3
- old
+ new
@@ -204,12 +204,36 @@
return false if settings.respond_to?(:use_async_model) and settings.use_async_model == false
return false if @dispatch_framework_initialized
@dispatch_framework_initialized ||=true
if RUBY_VERSION =~ /1.9/ and not defined?(JRUBY_VERSION)
- require 'rhoconnect/async'
- register Rhoconnect::Synchrony
- helpers Rhoconnect::AsyncHelpers
+ begin
+ require 'rhoconnect/async'
+ register Rhoconnect::Synchrony
+ helpers Rhoconnect::AsyncHelpers
+ rescue LoadError => e
+ # if it fails here - Async can not be used
+ settings.use_async_model = false
+ warning_for_async_gems = <<_INSTALL_ASYNC_GEMS
+
+***** WARNING *****
+Rhoconnect has detected that Ruby 1.9.x is used and tried to initialize Async Framework, but failed:
+
+ #{e.inspect}
+
+Make sure to include the following dependencies into your application's Gemfile:
+
+platforms :ruby_19, :mingw_19 do
+ gem 'rack-fiber_pool'
+ gem 'async-rack'
+end
+
+After that, run 'bundle install' to install the necassary dependency gems.
+***** WARNING *****
+
+_INSTALL_ASYNC_GEMS
+ puts warning_for_async_gems
+ end
else
settings.use_async_model = false
end
end