Class: PgSync::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/pgsync/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Client

Returns a new instance of Client.



3
4
5
6
7
8
9
# File 'lib/pgsync/client.rb', line 3

def initialize(args)
  $stdout.sync = true
  $stderr.sync = true
  @exit = false
  @arguments, @options = parse_args(args)
  @mutex = windows? ? Mutex.new : MultiProcessing::Mutex.new
end

Instance Method Details

#performObject

TODO clean up this mess



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/pgsync/client.rb', line 12

def perform
  return if @exit

  args, opts = @arguments, @options
  [:to, :from, :to_safe, :exclude, :schemas].each do |opt|
    opts[opt] ||= config[opt.to_s]
  end
  map_deprecations(args, opts)

  if opts[:init]
    setup(db_config_file(args[0]) || config_file || ".pgsync.yml")
  else
    sync(args, opts)
  end

  true
end