Sha256: 1d044122d89233b30a2015269723e5652947f7380a27d15adc7b9deafcf804e3

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'riak/test_server'
require 'singleton'

module Ripple
  # Extends the {Riak::TestServer} to be aware of the Ripple
  # configuration and adjust settings appropriately. Also simplifies
  # its usage in the generation of test helpers.
  class TestServer < Riak::TestServer
    include Singleton

    # Creates and starts the test server
    def self.setup
      instance.create
      instance.start
    end

    # Clears data from the test server
    def self.clear
      instance.drop
    end

    # @private
    def initialize(options=Ripple.config.dup)
      options[:env] ||= {}
      options[:env][:riak_kv] ||= {}
      options[:env][:riak_kv][:js_source_dir] ||= Ripple.config.delete(:js_source_dir) || (Rails.root + "app/mapreduce").to_s
      options[:env][:riak_kv][:map_cache_size] ||= 0
      options[:env][:riak_core] ||= {}
      options[:env][:riak_core][:http] ||= [ Tuple[Ripple.config[:host], Ripple.config[:http_port]] ]
      options[:env][:riak_kv][:pb_port] ||= Ripple.config[:pb_port]
      options[:env][:riak_kv][:pb_ip] ||= Ripple.config[:host]
      options[:root] ||= (Rails.root + 'tmp/riak_test_server').to_s
      super(options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ripple-1.0.0.beta lib/ripple/test_server.rb