Class: Flydata::CompatibilityCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/flydata/compatibility_check.rb

Defined Under Namespace

Classes: CompatibilityError

Instance Method Summary collapse

Constructor Details

#initialize(dp_hash, de_hash = nil, options = {}) ⇒ CompatibilityCheck

Returns a new instance of CompatibilityCheck.



7
8
9
10
# File 'lib/flydata/compatibility_check.rb', line 7

def initialize(dp_hash, de_hash=nil, options={})
  @dp = dp_hash
  @errors=[]
end

Instance Method Details

#checkObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/flydata/compatibility_check.rb', line 12

def check
  self.methods.grep(/^check_/).each do |m|
    begin
      send(m)
    rescue CompatibilityError => e
      @errors << e
    end
  end
  print_errors
end


23
24
25
26
27
28
29
30
# File 'lib/flydata/compatibility_check.rb', line 23

def print_errors
  return if @errors.empty?
  puts "There may be some compatibility issues with this current server : "
  @errors.each do |error|
    puts "  * #{error.message}"
  end
  raise "Please correct these errors if you wish to run FlyData Agent"
end