lints_controller.rb 609 字节
Newer Older
D
Douwe Maan 已提交
1
module Ci
K
Kamil Trzcinski 已提交
2
  class LintsController < ApplicationController
V
Valery Sizov 已提交
3
    before_action :authenticate_user!
D
Douwe Maan 已提交
4 5 6 7 8

    def show
    end

    def create
9
      @content = params[:content]
K
Katarzyna Kobierska 已提交
10
      @error = Ci::GitlabCiYamlProcessor.validation_message(@content)
K
Katarzyna Kobierska 已提交
11
      @status = @error.blank?
12

K
Katarzyna Kobierska 已提交
13
      if @error.blank?
14
        @config_processor = Ci::GitlabCiYamlProcessor.new(@content)
D
Douwe Maan 已提交
15 16
        @stages = @config_processor.stages
        @builds = @config_processor.builds
K
Katarzyna Kobierska 已提交
17
        @jobs = @config_processor.jobs
D
Douwe Maan 已提交
18
      end
19
    rescue
G
Grzegorz Bizon 已提交
20
      @error = 'Undefined error'
D
Douwe Maan 已提交
21
      @status = false
G
Grzegorz Bizon 已提交
22 23
    ensure
      render :show
D
Douwe Maan 已提交
24 25 26
    end
  end
end