Module: MongoDelta::CLI

Extended by:
Logging
Defined in:
lib/mongo_delta/cli.rb

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Logging

logger, setup_logger

Class Attribute Details

.config_pathObject

Returns the value of attribute config_path.



11
12
13
# File 'lib/mongo_delta/cli.rb', line 11

def config_path
  @config_path
end

.dbObject

Returns the value of attribute db.



11
12
13
# File 'lib/mongo_delta/cli.rb', line 11

def db
  @db
end

.ignore_errorsObject

Returns the value of attribute ignore_errors.



11
12
13
# File 'lib/mongo_delta/cli.rb', line 11

def ignore_errors
  @ignore_errors
end

.optimeObject

Returns the value of attribute optime.



11
12
13
# File 'lib/mongo_delta/cli.rb', line 11

def optime
  @optime
end

.serviceObject

Returns the value of attribute service.



11
12
13
# File 'lib/mongo_delta/cli.rb', line 11

def service
  @service
end

.source_uriObject

Returns the value of attribute source_uri.



11
12
13
# File 'lib/mongo_delta/cli.rb', line 11

def source_uri
  @source_uri
end

Class Method Details

.startObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/mongo_delta/cli.rb', line 13

def start
  parse_options
  validate_options!

  config =
    if config_path
      Configuration.load_from_file(config_path)
    else
      Configuration.load_from_db(source_uri, db, service)
    end
  config.db = db
  config.service = service
  config.ignore_errors = ignore_errors

  stream = Stream.new(config)
  stream.run(optime)
rescue Mongo::ConnectionFailure, Configuration::Error
  logger.fatal($!.message)
  exit(1)
end