Module: Horatio::Detector::Validator

Included in:
Docker, Dynamic, Maven, NodePackage, RubyGem
Defined in:
lib/horatio/detector/validator.rb

Instance Method Summary collapse

Instance Method Details

#validateObject



14
15
16
17
# File 'lib/horatio/detector/validator.rb', line 14

def validate
  validate_version
  validate_name
end

#validate_nameObject



4
5
6
7
# File 'lib/horatio/detector/validator.rb', line 4

def validate_name
  color { Log.info "validating passed in name"}
  name.match(/^[\w\-\.]*$/i) ? true : raise("name specified using invalid format")
end

#validate_versionObject



9
10
11
12
# File 'lib/horatio/detector/validator.rb', line 9

def validate_version
  color { Log.info "validating passed in version"}
  version.match(/^(\d+.)+\d+/i) ? true : raise("version specified using invalid format")
end