Sha256: 540038ff666b0be1b0cc36d7bc1ab062c0c1d9494febd5d9dd392bb01be81aac

Contents?: true

Size: 615 Bytes

Versions: 10

Compression:

Stored size: 615 Bytes

Contents

module Orats
  # manage the redis process
  module Redis
    def redis_bin(bin_name = 'redis-cli')
      exec = "#{bin_name} -h #{@options[:redis_location]}"

      return exec if @options[:redis_password].empty?
      exec << " -a #{@options[:redis_password]}"
    end

    def drop_namespace(namespace)
      run "#{redis_bin} KEYS '#{namespace}:*'| " + \
          "xargs --delim='\n' #{redis_bin} DEL"
    end

    def exit_if_redis_unreachable
      task 'Check if you can ping redis'

      return if run("#{redis_bin} ping")

      error 'Cannot ping redis', 'attempt to PING'
      exit 1
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
orats-0.9.7 lib/orats/redis.rb
orats-0.9.6 lib/orats/redis.rb
orats-0.9.5 lib/orats/redis.rb
orats-0.9.4 lib/orats/redis.rb
orats-0.9.3 lib/orats/redis.rb
orats-0.9.2 lib/orats/redis.rb
orats-0.9.1 lib/orats/redis.rb
orats-0.9.0 lib/orats/redis.rb
orats-0.8.1 lib/orats/redis.rb
orats-0.8.0 lib/orats/redis.rb