22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/taeval/git_checkout/gitlab_repo.rb', line 22
def validate
url = "https://gitlab.com/api/v4/projects/#{@user}%2F#{@repo}"
cmd = "curl -sL --header 'PRIVATE-TOKEN: #{@token}' #{url}"
stdout, stderr, status = Open3.capture3(cmd)
@output.print "validating #{url}", stdout, stderr
repo_api_data = JSON.parse(stdout, symbolize_names: true)
if stderr == '' && !repo_api_data.has_key?(:message)
field_validate(repo_api_data)
else
@reporter.add(repo: @repo, runner: :git_checkout, msg: "status: #{status}; message: #{stderr}") if stderr != ''
@reporter.add(repo: @repo, runner: :git_checkout, msg: "status: #{status}; message: #{repo_api_data[:message]}; url: #{url}") if repo_api_data.has_key?(:message)
end
cmd = "curl -sL --header 'PRIVATE-TOKEN: #{@token}' #{url}/users"
stdout, stderr, status = Open3.capture3(cmd)
@output.print "validating #{url}/users", stdout, stderr
repo_api_data = JSON.parse(stdout, symbolize_names: true)
if stderr == '' && repo_api_data.is_a?(Array)
fork_validate(repo_api_data)
else
@reporter.add(repo: @repo, runner: :git_checkout, msg: "status: #{status}; message: #{stderr}") if stderr != ''
@reporter.add(repo: @repo, runner: :git_checkout, msg: "status: #{status}; message: #{repo_api_data[:message]}; url: #{url}") if repo_api_data.has_key?(:message)
end
end
|