valkey/utils/redis-copy.rb
Jacob Murphy df5db0627f
Remove trademarked language in code comments (#223)
This includes comments used for module API documentation.

* Strategy for replacement: Regex search: `(//|/\*| \*|#).* ("|\()?(r|R)edis( |\.
  |'|\n|,|-|\)|")(?!nor the names of its contributors)(?!Ltd.)(?!Labs)(?!Contributors.)`
* Don't edit copyright comments
* Replace "Redis version X.X" -> "Redis OSS version X.X" to distinguish
from newly licensed repository
* Replace "Redis Object" -> "Object"
* Exclude markdown for now
* Don't edit Lua scripting comments referring to redis.X API
* Replace "Redis Protocol" -> "RESP"
* Replace redis-benchmark, -cli, -server, -check-aof/rdb with "valkey-"
prefix
* Most other places, I use best judgement to either remove "Redis", or
replace with "the server" or "server"

Fixes #148

---------

Signed-off-by: Jacob Murphy <jkmurphy@google.com>
Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
2024-04-09 10:24:03 +02:00

36 lines
1.2 KiB
Ruby

# redis-copy.rb - Copyright (C) 2009-2010 Salvatore Sanfilippo
# BSD license, See the COPYING file for more information.
#
# Copy the whole dataset from one server instance to another one
#
# WARNING: this utility is deprecated and serves as a legacy adapter
# for the more-robust redis-copy gem.
require 'shellwords'
def redisCopy(opts={})
src = "#{opts[:srchost]}:#{opts[:srcport]}"
dst = "#{opts[:dsthost]}:#{opts[:dstport]}"
`redis-copy #{src.shellescape} #{dst.shellescape}`
rescue Errno::ENOENT
$stderr.puts 'This utility requires the redis-copy executable',
'from the redis-copy gem on https://rubygems.org',
'To install it, run `gem install redis-copy`.'
exit 1
end
$stderr.puts "This utility is deprecated. Use the redis-copy gem instead."
if ARGV.length != 4
puts "Usage: redis-copy.rb <srchost> <srcport> <dsthost> <dstport>"
exit 1
end
puts "WARNING: it's up to you to FLUSHDB the destination host before to continue, press any key when ready."
STDIN.gets
srchost = ARGV[0]
srcport = ARGV[1]
dsthost = ARGV[2]
dstport = ARGV[3]
puts "Copying #{srchost}:#{srcport} into #{dsthost}:#{dstport}"
redisCopy(:srchost => srchost, :srcport => srcport.to_i,
:dsthost => dsthost, :dstport => dstport.to_i)