Skip to content

Commit

Permalink
Refactor / cleanup & bump to 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jcran committed Mar 13, 2021
1 parent db22274 commit 171adf8
Show file tree
Hide file tree
Showing 20 changed files with 727 additions and 588 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GIT
PATH
remote: .
specs:
intrigue-ident (4.2.7)
intrigue-ident (5.0.0)
dnsruby
mongo
murmurhash3
Expand Down
36 changes: 18 additions & 18 deletions lib/dns/check_factory.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module Intrigue
module Ident
module Dns
class CheckFactory
module Ident
module Dns
class CheckFactory

#
# Register a new handler
#
def self.register(klass)
@checks = [] unless @checks
@checks << klass if klass
end
#
# Register a new handler
#
def self.register(klass)
@checks = [] unless @checks
@checks << klass if klass
end

#
# Provide the full list of checks
#
def self.checks
@checks
end
end
end
#
# Provide the full list of checks
#
def self.checks
@checks
end
end
end
end
end
34 changes: 17 additions & 17 deletions lib/elastic_search/check_factory.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module Intrigue
module Ident
module ElasticSearch
class CheckFactory
module Ident
module ElasticSearch
class CheckFactory

#
# Register a new handler
#
def self.register(klass)
@checks = [] unless @checks
@checks << klass if klass
end
#
# Register a new handler
#
def self.register(klass)
@checks = [] unless @checks
@checks << klass if klass
end

#
# Provide the full list of checks
#
def self.checks
@checks
end
end
#
# Provide the full list of checks
#
def self.checks
@checks || []
end
end
end
end
end
26 changes: 13 additions & 13 deletions lib/ftp/check_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ module Ident
module Ftp
class CheckFactory

#
# Register a new handler
#
def self.register(klass)
@checks = [] unless @checks
@checks << klass if klass
end
#
# Register a new handler
#
def self.register(klass)
@checks = [] unless @checks
@checks << klass if klass
end

#
# Provide the full list of checks
#
def self.checks
@checks
end
#
# Provide the full list of checks
#
def self.checks
@checks
end

end
end
Expand Down
96 changes: 48 additions & 48 deletions lib/http/check_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,61 @@ module Ident
module Http
class CheckFactory

#
# Register a new handler
#
def self.register(klass)
@checks = [] unless @checks
@checks << klass if klass
end
#
# Register a new handler
#
def self.register(klass)
@checks = [] unless @checks
@checks << klass if klass
end

#
# Provide the full list of checks
#
def self.checks
@checks
end
#
# Provide the full list of checks
#
def self.checks
@checks
end

#
# Provide the full list of checks
#
def self.generate_initial_checks(url)
@checks.map{ |x| x.new.generate_checks("#{url}") }.flatten.compact.select{|x|
x[:require_product] == nil && x[:require_vendor] == nil && x[:require_vendor_product] == nil }
end
#
# Provide the full list of checks
#
def self.generate_initial_checks(url)
@checks.map{ |x| x.new.generate_checks("#{url}") }.flatten.compact.select{|x|
x[:require_product] == nil && x[:require_vendor] == nil && x[:require_vendor_product] == nil }
end

#
# Provide checks given a vendor
#
def self.generate_checks_for_vendor(url,vendor)
@checks.map{ |x| x.new.generate_checks("#{url}") }.flatten.compact.select{|x|
x[:require_vendor] == "#{vendor}" }
end

#
# Provide checks givene a product
#
def self.generate_checks_for_product(url,product)
@checks.map{ |x| x.new.generate_checks("#{url}") }.flatten.compact.select{|x|
x[:require_product] == "#{product}" }
end
#
# Provide checks given a vendor
#
def self.generate_checks_for_vendor(url,vendor)
@checks.map{ |x| x.new.generate_checks("#{url}") }.flatten.compact.select{|x|
x[:require_vendor] == "#{vendor}" }
end

#
# Provide checks givene a product
#
def self.generate_checks_for_product(url,product)
@checks.map{ |x| x.new.generate_checks("#{url}") }.flatten.compact.select{|x|
x[:require_product] == "#{product}" }
end

#
# Provide checks givene a vendor product
#
def self.generate_checks_for_vendor_product(url, vendor, product)
@checks.map{ |x| x.new.generate_checks("#{url}") }.flatten.compact.select{|x|
x[:require_vendor_product] == "#{vendor}_#{product}".downcase.gsub(" ","_") }
end

#
# Provide checks givene a vendor product
#
def self.generate_checks_for_vendor_product(url, vendor, product)
@checks.map{ |x| x.new.generate_checks("#{url}") }.flatten.compact.select{|x|
x[:require_vendor_product] == "#{vendor}_#{product}".downcase.gsub(" ","_") }
end

#
# Provide the full list of checks
#
def self.configuration_checks
@checks.map{ |x| x.new.generate_checks("") }.flatten.compact.select{|x| x[:type] == "content" }
end

#
# Provide the full list of checks
#
def self.configuration_checks
@checks.map{ |x| x.new.generate_checks("") }.flatten.compact.select{|x| x[:type] == "content" }
end


end
Expand Down
Loading

0 comments on commit 171adf8

Please sign in to comment.