From 4ed46eadaf1299d6a4d6dfe5c442ddd078674562 Mon Sep 17 00:00:00 2001 From: Bernerd Schaefer Date: Thu, 3 Feb 2011 13:53:18 +0100 Subject: [PATCH] Add Akephalos::ClientManager for DRb Server This is a refactoring of the internal communication structure between the MRI ruby process and the JRuby DRb server. This sets the path for allowing per-instance configurations and eventually supporting a single long-running akephalos instance. --- lib/akephalos/capybara.rb | 7 +------ lib/akephalos/client.rb | 10 ---------- lib/akephalos/remote_client.rb | 24 ++++++++++++++++-------- lib/akephalos/server.rb | 31 +++++++++++++++++++++++++++---- 4 files changed, 44 insertions(+), 28 deletions(-) diff --git a/lib/akephalos/capybara.rb b/lib/akephalos/capybara.rb index b33430c..23564f4 100644 --- a/lib/akephalos/capybara.rb +++ b/lib/akephalos/capybara.rb @@ -162,11 +162,6 @@ def select_node attr_reader :app, :rack_server - # @return [Client] an instance of Akephalos::Client - def self.driver - @driver ||= Akephalos::Client.new - end - def initialize(app) @app = app @rack_server = Capybara::Server.new(@app) @@ -271,7 +266,7 @@ def page # @return the browser def browser - self.class.driver + @browser ||= Akephalos::Client.new end # @return the session cookies diff --git a/lib/akephalos/client.rb b/lib/akephalos/client.rb index 48c3e47..15254b8 100644 --- a/lib/akephalos/client.rb +++ b/lib/akephalos/client.rb @@ -35,16 +35,6 @@ def initialize Thread.new { @_client.run } end - # Set the global configuration settings for Akephalos. - # - # @note This is only used when communicating over DRb, since just a - # single client instance is exposed. - # @param [Hash] config the configuration settings - # @return [Hash] the configuration - def configuration=(config) - Akephalos.configuration = config - end - # Visit the requested URL and return the page. # # @param [String] url the URL to load diff --git a/lib/akephalos/remote_client.rb b/lib/akephalos/remote_client.rb index 1fbc94b..a277927 100644 --- a/lib/akephalos/remote_client.rb +++ b/lib/akephalos/remote_client.rb @@ -15,23 +15,31 @@ module Akephalos # client.visit "http://www.oinopa.com" # client.page.source # => "