2016-07-10 08:35:53 -04:00
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
class Config
|
2016-11-14 04:31:45 -05:00
|
|
|
module Entry
|
2016-07-10 08:35:53 -04:00
|
|
|
##
|
|
|
|
# Entry that represents a job script.
|
|
|
|
#
|
2016-11-14 04:31:45 -05:00
|
|
|
class Commands < Node
|
2016-07-10 08:35:53 -04:00
|
|
|
include Validatable
|
|
|
|
|
|
|
|
validations do
|
|
|
|
include LegacyValidationHelpers
|
|
|
|
|
2016-07-29 06:30:38 -04:00
|
|
|
validate do
|
|
|
|
unless string_or_array_of_strings?(config)
|
2016-07-10 08:35:53 -04:00
|
|
|
errors.add(:config,
|
|
|
|
'should be a string or an array of strings')
|
|
|
|
end
|
|
|
|
end
|
2016-07-10 14:26:37 -04:00
|
|
|
|
2016-07-29 06:30:38 -04:00
|
|
|
def string_or_array_of_strings?(field)
|
|
|
|
validate_string(field) || validate_array_of_strings(field)
|
2016-07-10 14:26:37 -04:00
|
|
|
end
|
2016-07-10 08:35:53 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def value
|
2016-07-29 06:30:38 -04:00
|
|
|
Array(@config)
|
2016-07-10 08:35:53 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|