Class: PgSync::Client
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Client
constructor
A new instance of Client.
- #perform(testing: true) ⇒ Object
Methods included from Utils
#colorize, #config_file, #db_config_file, #log, #search_tree
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 $stderr.sync = true end |
Class Method Details
.start ⇒ Object
28 29 30 |
# File 'lib/pgsync/client.rb', line 28 def self.start new(ARGV).perform(testing: false) end |
Instance Method Details
#perform(testing: true) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pgsync/client.rb', line 10 def perform(testing: true) opts = parse_args if opts.version? log VERSION elsif opts.help? log opts # TODO remove deprecated conditions (last two) elsif opts.init? || opts.setup? || opts.arguments[0] == "setup" Init.new.perform(opts) else Sync.new.perform(opts) end rescue Error, PG::ConnectionBad => e raise e if testing abort colorize(e., 31) # red end |