Sha256: d191a7e2b9e85befd5c2b3f852d5a7e2d46a25d07c678b7008ea11fa129a52b9
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
#! /usr/bin/env ruby require 'uri' if ARGV.size != 2 require 'wyrm/version' puts <<EOF wyrm-#{Wyrm::VERSION} Usage: #{$0} src_db|dirname dst_db|dirname dirname contains a set of wyrm files, or will soon. sample db strings: postgres://localhost/lotsa_datsa mysql://root:pwned@localhost/lotsa_datsa mysql2://root:pwned@localhost/lotsa_fastsa_datsa EOF exit(1) end module FsPath def fs_path? scheme == 'file' || scheme.nil? end end src, dst = ARGV.map{|arg| URI.parse(arg).extend(FsPath)} require 'wyrm/cli' Wyrm.sanity_check_dcmp include Wyrm case when src.fs_path? && dst.fs_path? puts "No point copying one directory to another. Just use filesystem tools. It's faster." exit(1) when !src.fs_path? && dst.fs_path? # src is a url, and dst is a path, so dump to file system require 'wyrm/dump' Dump.new( src.to_s, dst.path ).call when src.fs_path? && !dst.fs_path? # src is a path and dst is a url, so restore to db require 'wyrm/restore' Restore.new(src.path, dst.to_s, drop_tables: true).call else # both db urls, so transfer require 'wyrm/hole.rb' Hole.new( src.to_s, dst.to_s ).call end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wyrm-0.4.2 | bin/wyrm |
wyrm-0.4.1 | bin/wyrm |