Sha256: 0152db5b5f171abcd69db10bcb7389446d9261a19f2e323e28f982d93eadae07

Contents?: true

Size: 1.37 KB

Versions: 8

Compression:

Stored size: 1.37 KB

Contents

# steal the cool tasks from redis-rb
require 'rbconfig'
require "rubygems"
require "bundler"
Bundler.setup
redis_path = $:.
  find {|path| path =~ /redis-/ }.
  split("/").
  tap do |array|
    array.replace(
      array[0..array.index(array.find {|segment| segment =~ /redis-/})]
    )
  end.
  join("/")

load "#{redis_path}/tasks/redis.tasks.rb"

class RedisRunner
  def self.port
    6379
  end

  def self.stop
    system %(echo "SHUTDOWN" | nc localhost #{port})
  end
end

class SingleRedisRunner < RedisRunner
  def self.redisconfdir
    File.expand_path(File.dirname(__FILE__) + "/../spec/config/single.conf")
  end
end

class MasterRedisRunner < RedisRunner
  def self.redisconfdir
    File.expand_path(File.dirname(__FILE__) + "/../spec/config/master.conf")
  end

  def self.dtach_socket
    "/tmp/redis_master.dtach"
  end

  def self.port
    6380
  end
end

class SlaveRedisRunner < RedisRunner
  def self.redisconfdir
    File.expand_path(File.dirname(__FILE__) + "/../spec/config/slave.conf")
  end

  def self.dtach_socket
    "/tmp/redis_slave.dtach"
  end

  def self.port
    6381
  end
end

class RedisClusterRunner
  def self.runners
    [ SingleRedisRunner, MasterRedisRunner, SlaveRedisRunner ]
  end

  def self.start_detached
    runners.each do |runner|
      runner.start_detached
    end
  end

  def self.stop
    runners.each do |runner|
      runner.stop
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
honkster-redis-store-0.3.16 tasks/redis.tasks.rb
honkster-redis-store-0.3.15 tasks/redis.tasks.rb
honkster-redis-store-0.3.14 tasks/redis.tasks.rb
honkster-redis-store-0.3.13 tasks/redis.tasks.rb
honkster-redis-store-0.3.12 tasks/redis.tasks.rb
redis-store-0.3.8 tasks/redis.tasks.rb
honkster-redis-store-0.3.11 tasks/redis.tasks.rb
honkster-redis-store-0.3.10 tasks/redis.tasks.rb