Class: PgSync::Client
Constant Summary
Constants included from Utils
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Client
constructor
A new instance of Client.
- #perform ⇒ Object
Methods included from Utils
#colorize, #confirm_tables_exist, #db_config_file, #deprecated, #escape, #first_schema, #friendly_name, #log, #monotonic_time, #output, #quote_ident, #quote_ident_full, #quote_string, #task_name, #warning
Constructor Details
#initialize(args) ⇒ Client
Returns a new instance of Client.
5 6 7 8 |
# File 'lib/pgsync/client.rb', line 5 def initialize(args) @args = args output.sync = true end |
Class Method Details
.start ⇒ Object
34 35 36 |
# File 'lib/pgsync/client.rb', line 34 def self.start new(ARGV).perform end |
Instance Method Details
#perform ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/pgsync/client.rb', line 10 def perform result = Slop::Parser.new().parse(@args) arguments = result.arguments = result.to_h [:defer_constraints_v2] ||= [:defer_constraints] raise Error, "Specify either --db or --config, not both" if [:db] && [:config] raise Error, "Cannot use --overwrite with --in-batches" if [:overwrite] && [:in_batches] if [:version] log VERSION elsif [:help] log elsif [:init] Init.new(arguments, ).perform else Sync.new(arguments, ).perform end rescue => e # Error, PG::ConnectionBad, Slop::Error raise e if && [:debug] abort colorize(e..strip, :red) end |