lib/indexer/validator.rb in indexer-0.2.0 vs lib/indexer/validator.rb in indexer-0.3.0
- old
+ new
@@ -226,11 +226,11 @@
def install_message=(value)
Valid.string!(value)
super(value)
end
-# TODO: How to handle project toplevel namespace?
+# TODO: How best to handle project toplevel namespace since it can be either a class or a module in a Ruby project?
# Namespace must be a single line string.
def namespace=(value)
Valid.oneline!(value, :namespace)
#raise ValidationError unless /^(class|module)/ =~ value
@@ -249,13 +249,16 @@
def webcvs=(value)
Valid.uri!(value, :webcvs)
super(value)
end
- #
- def extra=(value)
- Valid.hash!(value, :extra)
+ # Custom field names must a valid list of strings.
+ def customs=(value)
+ Valid.array!(value, :customs)
+ value.each_with_index do |data, index|
+ Valid.string!(data, "customs ##{index}")
+ end
super(value)
end
# A specification is not valid without a name and verison.
#
@@ -282,22 +285,23 @@
#
# Initializes the {Metadata} attributes.
#
def initialize_attributes
@data = {
- :type => 'ruby',
:revision => REVISION,
+ :type => 'ruby',
:sources => [],
:authors => [],
:organizations => [],
:requirements => [],
:conflicts => [],
:alternatives => [],
:resources => [],
:repositories => [],
:categories => [],
- :paths => {'load' => ['lib']},
- :copyrights => []
+ :copyrights => [],
+ :customs => [],
+ :paths => {'lib' => ['lib']},
}
end
private