gitlab-ci-lint 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.dockerignore +12 -0
- data/.gitignore +215 -60
- data/.gitlab-ci.yml +72 -0
- data/CHANGELOG.md +16 -0
- data/Dockerfile +35 -0
- data/Gemfile +15 -15
- data/Makefile +50 -0
- data/README.md +49 -1
- data/bin/gitlab_ci_lint +16 -11
- data/docker-compose.yml +45 -0
- data/docs/annotations/replace.md +128 -0
- data/gitlab.gemspec +0 -3
- data/lib/gitlab/ci/lint.rb +50 -50
- data/lib/gitlab/ci/lint/actions.rb +11 -0
- data/lib/gitlab/ci/lint/arguments.rb +69 -0
- data/lib/gitlab/ci/lint/client.rb +33 -0
- data/lib/gitlab/ci/lint/colors.rb +25 -0
- data/lib/gitlab/ci/lint/configuration.rb +27 -0
- data/lib/gitlab/ci/lint/log.rb +53 -0
- data/lib/gitlab/ci/lint/multio.rb +19 -0
- data/lib/gitlab/ci/lint/system.rb +21 -0
- data/lib/gitlab/ci/lint/version.rb +7 -7
- data/lib/gitlab/ci/lint/yml.rb +40 -0
- data/spec/gitlab/ci/lint/spec.rb +5 -5
- data/values.yml +11 -8
- metadata +14 -52
- data/.rspec +0 -3
- data/.rspec_status +0 -0
- data/file.log +0 -2
- data/lib/gitlab/ci/lint/reader/yml.rb +0 -19
- data/lib/gitlab/ci/lint/settings/arguments.rb +0 -27
- data/lib/gitlab/ci/lint/settings/colors.rb +0 -17
- data/lib/gitlab/ci/lint/settings/configuration.rb +0 -24
- data/lib/gitlab/ci/lint/settings/log.rb +0 -52
@@ -1,24 +0,0 @@
|
|
1
|
-
module Gitlab
|
2
|
-
module Ci
|
3
|
-
class Configuration
|
4
|
-
attr_reader :gitlab_ci_file, :gitlab_ci_path, :gitlab_endpoint,
|
5
|
-
:gitlab_token, :log_file
|
6
|
-
def initialize
|
7
|
-
@gitlab_ci_file = ENV["GITLAB_CI_FILE"]
|
8
|
-
@gitlab_ci_path = ENV["GITLAB_CI_PATH"]
|
9
|
-
@gitlab_endpoint = ENV["GITLAB_ENDPOINT"]
|
10
|
-
@gitlab_token = ENV["GITLAB_TOKEN"]
|
11
|
-
@log_file = ENV["LOG_FILE"]
|
12
|
-
end
|
13
|
-
def variables
|
14
|
-
return {
|
15
|
-
"gitlab_ci_file" => @gitlab_ci_file,
|
16
|
-
"gitlab_ci_path" => @gitlab_ci_path,
|
17
|
-
"gitlab_endpoint" => @gitlab_endpoint,
|
18
|
-
"gitlab_token" => @gitlab_token,
|
19
|
-
"log_file" => @log_file
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require "logger"
|
2
|
-
require "singleton"
|
3
|
-
require_relative "./colors.rb"
|
4
|
-
|
5
|
-
class MultiIO
|
6
|
-
def initialize(*targets)
|
7
|
-
@targets = targets
|
8
|
-
end
|
9
|
-
def write(*args)
|
10
|
-
@targets.each {|target| target.write(*args)}
|
11
|
-
end
|
12
|
-
def close
|
13
|
-
@targets.each(&:close)
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
class Log < Colors
|
19
|
-
include Singleton
|
20
|
-
attr_accessor :logger
|
21
|
-
def initialize(log_file="./file.log")
|
22
|
-
@logger = Logger.new MultiIO.new(STDOUT,
|
23
|
-
File.open(File.exist?(log_file) ? log_file : "./file.log", "a"))
|
24
|
-
@logger.level = Logger::INFO
|
25
|
-
@logger.formatter = proc do |severity, datetime, progname, msg|
|
26
|
-
datetime = "[#{datetime.strftime('%Y-%m-%d %H:%M:%S')}]"
|
27
|
-
case severity
|
28
|
-
when "INFO"
|
29
|
-
colorized_severity = self.class.colorize("#{severity}", "black", "green")
|
30
|
-
self.class.colorize("#{colorized_severity} - #{datetime} - #{msg}\n", "black", "green")
|
31
|
-
when "ERROR"
|
32
|
-
colorized_severity = self.class.colorize("#{severity}", "black", "red")
|
33
|
-
"#{colorized_severity} - #{datetime} - #{msg}\n"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
def set_level(level)
|
38
|
-
@logger.level = level
|
39
|
-
end
|
40
|
-
def info(message, color=:green)
|
41
|
-
@logger.info(message)
|
42
|
-
end
|
43
|
-
def debug(message, color=:green)
|
44
|
-
@logger.debug(message)
|
45
|
-
end
|
46
|
-
def error(message, color=:green)
|
47
|
-
@logger.error(message)
|
48
|
-
end
|
49
|
-
def warn(message)
|
50
|
-
@logger.warn(message)
|
51
|
-
end
|
52
|
-
end
|