forked from OpenNeo/impress
move async behavior to development_async environment
This commit is contained in:
parent
e40d4601d8
commit
1a6bbd8dbd
6 changed files with 50 additions and 23 deletions
34
Gemfile
34
Gemfile
|
@ -3,22 +3,6 @@ source 'http://rubygems.org'
|
||||||
gem 'rails', '3.0.0'
|
gem 'rails', '3.0.0'
|
||||||
#gem 'sqlite3-ruby', '~> 1.3.1', :require => 'sqlite3'
|
#gem 'sqlite3-ruby', '~> 1.3.1', :require => 'sqlite3'
|
||||||
|
|
||||||
# async wrappers
|
|
||||||
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git'
|
|
||||||
gem 'rack-fiber_pool', :require => 'rack/fiber_pool'
|
|
||||||
gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git', :require => [
|
|
||||||
'em-synchrony',
|
|
||||||
'em-synchrony/em-http'
|
|
||||||
]
|
|
||||||
|
|
||||||
# async activerecord requires
|
|
||||||
gem 'mysqlplus', :git => 'git://github.com/oldmoe/mysqlplus.git', :require => 'mysqlplus'
|
|
||||||
gem 'em-mysqlplus', :git => 'git://github.com/igrigorik/em-mysqlplus.git', :require => 'em-activerecord'
|
|
||||||
|
|
||||||
# async http requires
|
|
||||||
gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http'
|
|
||||||
gem 'addressable', :require => 'addressable/uri'
|
|
||||||
|
|
||||||
gem 'compass', '~> 0.10.1'
|
gem 'compass', '~> 0.10.1'
|
||||||
gem 'haml', '~> 3.0.18'
|
gem 'haml', '~> 3.0.18'
|
||||||
gem 'rdiscount', '~> 1.6.5'
|
gem 'rdiscount', '~> 1.6.5'
|
||||||
|
@ -27,6 +11,24 @@ gem 'will_paginate', '~> 3.0.pre2'
|
||||||
|
|
||||||
gem 'jammit', '~> 0.5.3'
|
gem 'jammit', '~> 0.5.3'
|
||||||
|
|
||||||
|
group :development_async, :production do
|
||||||
|
# async wrappers
|
||||||
|
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git'
|
||||||
|
gem 'rack-fiber_pool', :require => 'rack/fiber_pool'
|
||||||
|
gem 'em-synchrony', :git => 'git://github.com/igrigorik/em-synchrony.git', :require => [
|
||||||
|
'em-synchrony',
|
||||||
|
'em-synchrony/em-http'
|
||||||
|
]
|
||||||
|
|
||||||
|
# async activerecord requires
|
||||||
|
gem 'mysqlplus', :git => 'git://github.com/oldmoe/mysqlplus.git', :require => 'mysqlplus'
|
||||||
|
gem 'em-mysqlplus', :git => 'git://github.com/igrigorik/em-mysqlplus.git', :require => 'em-activerecord'
|
||||||
|
|
||||||
|
# async http requires
|
||||||
|
gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http'
|
||||||
|
gem 'addressable', :require => 'addressable/uri'
|
||||||
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'factory_girl_rails', '~> 1.0'
|
gem 'factory_girl_rails', '~> 1.0'
|
||||||
gem 'rspec-rails', '~> 2.0.0.beta.22'
|
gem 'rspec-rails', '~> 2.0.0.beta.22'
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
require ::File.expand_path('../config/environment', __FILE__)
|
require ::File.expand_path('../config/environment', __FILE__)
|
||||||
|
|
||||||
use Rack::FiberPool
|
use Rack::FiberPool if defined?(USE_FIBER_POOL) && USE_FIBER_POOL
|
||||||
run OpenneoImpressItems::Application
|
run OpenneoImpressItems::Application
|
||||||
|
|
|
@ -18,10 +18,6 @@ OpenneoImpressItems::Application.configure do
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
config.active_support.deprecation = :log
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
config.serve_static_assets = true
|
|
||||||
|
|
||||||
config.threadsafe!
|
|
||||||
end
|
end
|
||||||
|
|
||||||
RemoteImpressHost = 'beta.impress.openneo.net'
|
RemoteImpressHost = 'beta.impress.openneo.net'
|
||||||
|
|
27
config/environments/development_async.rb
Normal file
27
config/environments/development_async.rb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
OpenneoImpressItems::Application.configure do
|
||||||
|
# Settings specified here will take precedence over those in config/environment.rb
|
||||||
|
|
||||||
|
# In the development environment your application's code is reloaded on
|
||||||
|
# every request. This slows down response time but is perfect for development
|
||||||
|
# since you don't have to restart the webserver when you make code changes.
|
||||||
|
config.cache_classes = false
|
||||||
|
|
||||||
|
# Log error messages when you accidentally call methods on nil.
|
||||||
|
config.whiny_nils = true
|
||||||
|
|
||||||
|
# Show full error reports and disable caching
|
||||||
|
config.consider_all_requests_local = true
|
||||||
|
config.action_view.debug_rjs = true
|
||||||
|
config.action_controller.perform_caching = false
|
||||||
|
|
||||||
|
# Don't care if the mailer can't send
|
||||||
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
config.active_support.deprecation = :log
|
||||||
|
|
||||||
|
config.threadsafe!
|
||||||
|
end
|
||||||
|
|
||||||
|
RemoteImpressHost = 'beta.impress.openneo.net'
|
||||||
|
|
||||||
|
USE_FIBER_POOL = true
|
|
@ -29,7 +29,7 @@ OpenneoImpressItems::Application.configure do
|
||||||
|
|
||||||
# Disable Rails's static asset server
|
# Disable Rails's static asset server
|
||||||
# In production, Apache or nginx will already do this
|
# In production, Apache or nginx will already do this
|
||||||
config.serve_static_assets = true
|
# config.serve_static_assets = true
|
||||||
|
|
||||||
# Enable serving of images, stylesheets, and javascripts from an asset server
|
# Enable serving of images, stylesheets, and javascripts from an asset server
|
||||||
# config.action_controller.asset_host = "http://assets.example.com"
|
# config.action_controller.asset_host = "http://assets.example.com"
|
||||||
|
@ -44,3 +44,5 @@ OpenneoImpressItems::Application.configure do
|
||||||
end
|
end
|
||||||
|
|
||||||
RemoteImpressHost = 'impress.openneo.net'
|
RemoteImpressHost = 'impress.openneo.net'
|
||||||
|
|
||||||
|
USE_FIBER_POOL = true
|
||||||
|
|
|
@ -12,7 +12,7 @@ module RocketAMF
|
||||||
def fetch
|
def fetch
|
||||||
uri = @service.gateway.uri
|
uri = @service.gateway.uri
|
||||||
data = envelope.serialize
|
data = envelope.serialize
|
||||||
if EventMachine.reactor_running?
|
if defined?(EventMachine) && EventMachine.reactor_running?
|
||||||
req = EM::HttpRequest.new(uri).post :body => data
|
req = EM::HttpRequest.new(uri).post :body => data
|
||||||
response_body = req.response
|
response_body = req.response
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue