mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-09 12:46:07 +10:00
This follows a standard `ActiveModel` pattern of creating a custom validators. We use `ActiveModel::EachValidator` here that reuses methods provided by `LegacyValidationHelpers`. We will remove `LegacyValidationHelpers` on some point in the future, at the later stages of CI configuration refactoring. It may be possible to rewrite custom validators to use format like: `validates :config, array_of: String`
28 lines
648 B
Ruby
28 lines
648 B
Ruby
module Gitlab
|
|
module Ci
|
|
class Config
|
|
module Node
|
|
##
|
|
# Entry that represents a script.
|
|
#
|
|
# Each element in the value array is a command that will be executed
|
|
# by GitLab Runner. Currently we concatenate these commands with
|
|
# new line character as a separator, what is compatible with
|
|
# implementation in Runner.
|
|
#
|
|
class Script < Entry
|
|
include Validatable
|
|
|
|
validations do
|
|
validates :config, array_of_strings: true
|
|
end
|
|
|
|
def value
|
|
@config.join("\n")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|