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.
@@ -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