Class: Pcrd::Commands::Analyze

Inherits:
Object
  • Object
show all
Defined in:
lib/pcrd/commands/analyze.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Constructor Details

#initialize(config, options = {}) ⇒ Analyze

Returns a new instance of Analyze.



8
9
10
11
# File 'lib/pcrd/commands/analyze.rb', line 8

def initialize(config, options = {})
  @config  = config
  @options = Options.normalize(options)
end

Instance Method Details

#runObject



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

def run
  validate_config!

  source_pool = Connection::Client.new(@config.source)
  reader      = Schema::Reader.new(source_pool)
  packer      = Schema::Packer.new
  printer     = Output::AnalyzePrinter.new

  if compare_target?
    run_compare(reader, packer, printer)
  else
    run_source_only(reader, packer, printer)
  end

  source_pool.close
end