Method: Cup::Cupfile#valid?

Defined in:
lib/cup/cupfile.rb

#valid?Boolean

Returns:

  • (Boolean)


53
54
55
56
57
58
59
60
61
62
# File 'lib/cup/cupfile.rb', line 53

def valid?
  @validation_errors = []

  validation_error 'cupfile error, path not specified' if path.nil?
  validation_error 'name is required' if name.nil? or name.strip.size == 0
  validation_error 'version is require and must be of the form X.Y.Z where X, Y and Z are numbers' unless version =~ /\d+\.\d+\.\d+/
  validation_error "licence file '#{licence}' does not exist" unless licence_file_exists?

  @validation_errors.empty?
end