summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/node/script.rb
blob: 5072bf0db7d56ef4016629cfb229ffa8a6b0fb5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 ValidationHelpers

          def value
            @value.join("\n")
          end

          def validate!
            unless validate_array_of_strings(@value)
              @errors << 'before_script should be an array of strings'
            end
          end
        end
      end
    end
  end
end