bbk-utils 1.0.1.72694 → 1.0.1.84207
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/Gemfile +3 -0
- data/Gemfile.lock +23 -3
- data/README.md +6 -1
- data/bin/console +2 -0
- data/lib/bbk/utils/config.rb +197 -180
- data/lib/bbk/utils/crypt.rb +31 -23
- data/lib/bbk/utils/env_helper.rb +87 -69
- data/lib/bbk/utils/log_formatter.rb +15 -8
- data/lib/bbk/utils/logger.rb +33 -30
- data/lib/bbk/utils/proxy_logger.rb +29 -24
- data/lib/bbk/utils/version.rb +6 -1
- data/lib/bbk/utils/xml.rb +31 -20
- data/lib/bbk/utils.rb +7 -1
- data/sig/bbk/config.rbs +55 -0
- data/sig/bbk/crypt.rbs +9 -0
- data/sig/bbk/env_helper.rbs +14 -0
- data/sig/bbk/log_formatter.rbs +10 -0
- data/sig/bbk/logger.rbs +15 -0
- data/sig/bbk/proxy_logger.rbs +16 -0
- data/sig/bbk/proxy_object.rbs +7 -0
- data/sig/bbk/utils.rbs +5 -0
- data/sig/bbk/xml.rbs +10 -0
- data/sig/env.rbs +4 -0
- data/sig/logger.rbs +37 -0
- metadata +45 -6
data/lib/bbk/utils/env_helper.rb
CHANGED
@@ -1,93 +1,111 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'uri'
|
3
4
|
|
4
5
|
module BBK
|
5
|
-
module
|
6
|
-
|
7
|
-
uri = build_uri_with_defaults(env)
|
8
|
-
apply_env_from_uri(env, uri)
|
9
|
-
env
|
10
|
-
end
|
6
|
+
module Utils
|
7
|
+
module EnvHelper
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def self.build_uri_with_defaults(env)
|
18
|
-
::URI.parse(env['DATABASE_URL'] || '').tap do |uri|
|
19
|
-
uri.scheme = env.fetch('DATABASE_ADAPTER', uri.scheme) || 'postgresql'
|
20
|
-
uri.user = env.fetch('DATABASE_USER', uri.user) || 'postgres'
|
21
|
-
uri.password = env.fetch('DATABASE_PASS', uri.password)
|
22
|
-
uri.hostname = env.fetch('DATABASE_HOST', uri.hostname) || 'db'
|
23
|
-
uri.port = env.fetch('DATABASE_PORT', uri.port) || 5432
|
9
|
+
def self.prepare_database_envs(env)
|
10
|
+
uri = build_uri_with_defaults(env)
|
11
|
+
apply_env_from_uri(env, uri)
|
12
|
+
env
|
13
|
+
end
|
24
14
|
|
25
|
-
|
26
|
-
|
27
|
-
|
15
|
+
def self.prepare_mq_envs(env)
|
16
|
+
apply_mq_env_from_uri(env, build_mq_uri_with_defaults(env))
|
17
|
+
env
|
18
|
+
end
|
28
19
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
uri.
|
20
|
+
def self.prepare_jaeger_envs(env)
|
21
|
+
jaeger_uri = ::URI.parse(env['JAEGER_URL'] || '').tap do |uri|
|
22
|
+
uri.scheme = env.fetch('JAEGER_SENDER', uri.scheme) || 'udp'
|
23
|
+
uri.hostname = env.fetch('JAEGER_HOST', uri.host) || 'jaeger'
|
24
|
+
uri.port = env.fetch('JAEGER_PORT', uri.port) || 6831
|
33
25
|
end
|
26
|
+
env['JAEGER_URL'] = jaeger_uri.to_s
|
27
|
+
env['JAEGER_SENDER'] = jaeger_uri.scheme
|
28
|
+
env['JAEGER_HOST'] = jaeger_uri.host
|
29
|
+
env['JAEGER_PORT'] = jaeger_uri.port.to_s
|
30
|
+
env
|
31
|
+
end
|
34
32
|
|
33
|
+
def self.build_uri_with_defaults(env)
|
34
|
+
::URI.parse(env['DATABASE_URL'] || '').tap do |uri|
|
35
|
+
uri.scheme = env.fetch('DATABASE_ADAPTER', uri.scheme) || 'postgresql'
|
36
|
+
uri.user = env.fetch('DATABASE_USER', uri.user) || 'postgres'
|
37
|
+
uri.password = env.fetch('DATABASE_PASS', uri.password)
|
38
|
+
uri.hostname = env.fetch('DATABASE_HOST', uri.hostname) || 'db'
|
39
|
+
uri.port = env.fetch('DATABASE_PORT', uri.port) || 5432
|
40
|
+
|
41
|
+
name = env.fetch('DATABASE_NAME', uri.path) || ''
|
42
|
+
name = "/#{name}" unless name.start_with?('/')
|
43
|
+
uri.path = name
|
44
|
+
|
45
|
+
if uri.query
|
46
|
+
params = URI.decode_www_form(uri.query).to_h
|
47
|
+
params['pool'] = env.fetch('DATABASE_POOL', params['pool'])
|
48
|
+
uri.query = URI.encode_www_form(params)
|
49
|
+
end
|
50
|
+
end
|
35
51
|
end
|
36
|
-
end
|
37
52
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
53
|
+
def self.apply_env_from_uri(env, uri)
|
54
|
+
env['DATABASE_URL'] = uri.to_s
|
55
|
+
env['DATABASE_ADAPTER'] = uri.scheme
|
56
|
+
env['DATABASE_USER'] = uri.user
|
57
|
+
env['DATABASE_PASS'] = uri.password
|
58
|
+
env['DATABASE_HOST'] = uri.hostname
|
59
|
+
env['DATABASE_PORT'] = uri.port.to_s
|
60
|
+
env['DATABASE_NAME'] = uri.path[1..-1]
|
61
|
+
|
62
|
+
if uri.query
|
63
|
+
params = URI.decode_www_form(uri.query).to_h
|
64
|
+
env['DATABASE_POOL'] = params['pool']
|
65
|
+
end
|
50
66
|
end
|
51
67
|
|
52
|
-
|
68
|
+
def self.build_mq_uri_with_defaults(env)
|
69
|
+
# Only first MQ_URL selected as template if any
|
70
|
+
url = [env.fetch('MQ_URL', '').split(/[;|]/)].flatten.select(&:present?).first || ''
|
53
71
|
|
54
|
-
|
55
|
-
|
56
|
-
|
72
|
+
# all hosts if form of list fills url template
|
73
|
+
hosts = [env.fetch('MQ_HOST',
|
74
|
+
URI.parse(url).hostname || 'mq').split(/[;|]/)].flatten.select(&:present?).uniq
|
57
75
|
|
58
|
-
|
59
|
-
|
76
|
+
hosts.map do |host|
|
77
|
+
URI.parse(url).tap do |uri|
|
78
|
+
uri.scheme = uri.scheme || 'amqps'
|
79
|
+
uri.hostname = host
|
80
|
+
uri.port = env.fetch('MQ_PORT', uri.port) || 5671
|
81
|
+
uri.user = env.fetch('MQ_USER', uri.user)
|
82
|
+
uri.password = env.fetch('MQ_PASS', uri.password)
|
60
83
|
|
61
|
-
|
62
|
-
|
63
|
-
uri.scheme = uri.scheme || 'amqps'
|
64
|
-
uri.hostname = host
|
65
|
-
uri.port = env.fetch('MQ_PORT', uri.port) || 5671
|
66
|
-
uri.user = env.fetch('MQ_USER', uri.user)
|
67
|
-
uri.password = env.fetch('MQ_PASS', uri.password)
|
84
|
+
vhost = [env.fetch('MQ_VHOST', uri.path), '/'].find(&:present?)
|
85
|
+
vhost = "/#{vhost}" unless vhost.start_with?('/')
|
68
86
|
|
69
|
-
|
70
|
-
|
87
|
+
uri.path = vhost
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
71
91
|
|
72
|
-
|
92
|
+
def self.apply_mq_env_from_uri(env, uris)
|
93
|
+
uri = uris.first
|
94
|
+
|
95
|
+
env['MQ_URL'] = uris.map(&:to_s).join(';')
|
96
|
+
env['MQ_HOST'] = uris.map(&:hostname).join(';')
|
97
|
+
env['MQ_PORT'] = uri.port.to_s
|
98
|
+
env['MQ_PASS'] = uri.password
|
99
|
+
env['MQ_USER'] = uri.user
|
100
|
+
vhost = if uri.path == '/'
|
101
|
+
uri.path
|
102
|
+
else
|
103
|
+
uri.path.gsub(%r{\A/}, '')
|
73
104
|
end
|
105
|
+
env['MQ_VHOST'] = vhost
|
74
106
|
end
|
75
|
-
end
|
76
107
|
|
77
|
-
def self.apply_mq_env_from_uri(env, uris)
|
78
|
-
uri = uris.first
|
79
|
-
|
80
|
-
env['MQ_URL'] = uris.map(&:to_s).join(';')
|
81
|
-
env['MQ_HOST'] = uris.map(&:hostname).join(';')
|
82
|
-
env['MQ_PORT'] = uri.port.to_s
|
83
|
-
env['MQ_PASS'] = uri.password
|
84
|
-
env['MQ_USER'] = uri.user
|
85
|
-
vhost = if uri.path == '/'
|
86
|
-
uri.path
|
87
|
-
else
|
88
|
-
uri.path.gsub(%r{\A/}, '')
|
89
|
-
end
|
90
|
-
env['MQ_VHOST'] = vhost
|
91
108
|
end
|
92
109
|
end
|
93
110
|
end
|
111
|
+
|
@@ -1,15 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'logger'
|
2
4
|
|
3
5
|
module BBK
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
module Utils
|
7
|
+
class LogFormatter < ::Logger::Formatter
|
8
|
+
|
9
|
+
FORMAT = "%5s [%sUTC #%d] (%s)[%s]: %s\n"
|
10
|
+
def call(severity, time, progname, msg)
|
11
|
+
line = msg2str(msg).gsub("\n", '\\n')
|
12
|
+
format(FORMAT, severity, format_datetime(time.utc), Process.pid, progname, thread_id, line)
|
13
|
+
end
|
14
|
+
|
15
|
+
def thread_id
|
16
|
+
[Thread.current.object_id.to_s, Thread.current.name].compact.join('@')
|
17
|
+
end
|
10
18
|
|
11
|
-
def thread_id
|
12
|
-
[Thread.current.object_id.to_s, Thread.current.name].compact.join('@')
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
22
|
+
|
data/lib/bbk/utils/logger.rb
CHANGED
@@ -5,44 +5,47 @@ require 'active_support/tagged_logging'
|
|
5
5
|
require 'bbk/utils/log_formatter'
|
6
6
|
|
7
7
|
module BBK
|
8
|
-
|
9
|
-
|
10
|
-
DEFAULT_LEVEL = Logger::Severity::DEBUG
|
8
|
+
module Utils
|
9
|
+
class Logger < ::Logger
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
ActiveSupport::TaggedLogging.new(instance)
|
15
|
-
end
|
11
|
+
DEFAULT_NAME = 'bbk'
|
12
|
+
DEFAULT_LEVEL = Logger::Severity::DEBUG
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
self.progname = progname
|
21
|
-
|
22
|
-
if level.is_a?(Integer)
|
23
|
-
self.level = level
|
24
|
-
else
|
25
|
-
level = level.to_s.upcase
|
26
|
-
level = level.present? ? level : 'INFO'
|
27
|
-
self.level = Logger.const_get(level)
|
14
|
+
def self.new(*args, **kwargs)
|
15
|
+
instance = super
|
16
|
+
ActiveSupport::TaggedLogging.new(instance)
|
28
17
|
end
|
29
18
|
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
def initialize(progname, level, io: STDOUT)
|
20
|
+
io.sync = true
|
21
|
+
super(io)
|
22
|
+
self.progname = progname
|
23
|
+
|
24
|
+
if level.is_a?(Integer)
|
25
|
+
self.level = level
|
26
|
+
else
|
27
|
+
level = level.to_s.upcase
|
28
|
+
level = level.present? ? level : 'INFO'
|
29
|
+
self.level = Logger.const_get(level)
|
30
|
+
end
|
31
|
+
|
32
|
+
self.formatter = LogFormatter.new
|
33
|
+
info "Using LOG_LEVEL=#{level}"
|
34
|
+
end
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
def silence(*_args)
|
37
|
+
yield self
|
38
|
+
end
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
@default.level = DEFAULT_LEVEL
|
40
|
+
def self.default
|
41
|
+
unless @default
|
42
|
+
@default = new(DEFAULT_NAME, DEFAULT_LEVEL)
|
43
|
+
@default.level = DEFAULT_LEVEL
|
44
|
+
end
|
44
45
|
@default
|
45
46
|
end
|
47
|
+
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
51
|
+
|
@@ -3,37 +3,42 @@
|
|
3
3
|
require 'bbk/utils/logger'
|
4
4
|
|
5
5
|
module BBK
|
6
|
-
|
7
|
-
|
6
|
+
module Utils
|
7
|
+
class ProxyLogger
|
8
8
|
|
9
|
-
|
10
|
-
@logger = logger
|
11
|
-
@tagged = @logger.respond_to?(:tagged)
|
12
|
-
@tags = [tags].flatten
|
13
|
-
end
|
9
|
+
attr_reader :tags, :logger
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
def initialize(logger, tags:)
|
12
|
+
@logger = logger
|
13
|
+
@tagged = @logger.respond_to?(:tagged)
|
14
|
+
@tags = [tags].flatten
|
15
|
+
end
|
19
16
|
|
20
|
-
|
21
|
-
|
17
|
+
def add_tags(*tags)
|
18
|
+
@tags += tags.flatten
|
19
|
+
@tags = @tags.uniq
|
20
|
+
end
|
21
|
+
|
22
|
+
def method_missing(method, *args, &block)
|
23
|
+
super unless logger.respond_to?(method)
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
if @tagged
|
26
|
+
current_tags = tags - logger.formatter.current_tags
|
27
|
+
logger.tagged(current_tags) { logger.send(method, *args, &block) }
|
28
|
+
else
|
29
|
+
logger.send(method, *args, &block)
|
30
|
+
end
|
28
31
|
end
|
29
|
-
end
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
def respond_to?(name, include_private=false)
|
34
|
+
logger.send(:respond_to?, name, include_private) || super
|
35
|
+
end
|
36
|
+
|
37
|
+
def respond_to_missing?(method_name, include_private = false)
|
38
|
+
logger.send(:respond_to_missing?, method_name, include_private) || super
|
39
|
+
end
|
34
40
|
|
35
|
-
def respond_to_missing?(method_name, include_private = false)
|
36
|
-
logger.send(:respond_to_missing?, method_name, include_private) || super
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
44
|
+
|
data/lib/bbk/utils/version.rb
CHANGED
data/lib/bbk/utils/xml.rb
CHANGED
@@ -1,30 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'securerandom'
|
2
4
|
require 'russian'
|
3
5
|
|
4
6
|
module BBK
|
5
|
-
module
|
6
|
-
|
7
|
+
module Utils
|
8
|
+
module Xml
|
7
9
|
|
8
|
-
|
9
|
-
# Generate identifier to future substitution in XML body. Ex.: real attachment identifier when uploading to FTP
|
10
|
-
def self.build_substitution_id(id)
|
11
|
-
"@{#{id}}"
|
12
|
-
end
|
10
|
+
MTOM_ID_FIRST_LETTERS = %w[a b c d e f].freeze
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
##
|
13
|
+
# Generate identifier to future substitution in XML body. Ex.: real attachment identifier when uploading to FTP
|
14
|
+
def self.build_substitution_id(id)
|
15
|
+
"@{#{id}}"
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Generate uuid compatible with SOAP AttachmentContent identifier
|
20
|
+
def self.generate_mtom_attachment_id
|
21
|
+
id = SecureRandom.uuid
|
22
|
+
id[0] = MTOM_ID_FIRST_LETTERS.sample
|
23
|
+
id
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Normalize XML href to be predictible and constant in various cases
|
28
|
+
def self.normalize_slug(name, href)
|
29
|
+
href_uri = URI.parse(href)
|
30
|
+
href_slug = [href_uri.scheme, href_uri.host, *href_uri.path.split('/'), href_uri.query].select do |item|
|
31
|
+
item.present?
|
32
|
+
end.join('-').gsub(
|
33
|
+
/[.&]/, '-'
|
34
|
+
)
|
35
|
+
Russian.translit "#{name}_#{href_slug}"
|
36
|
+
end
|
21
37
|
|
22
|
-
##
|
23
|
-
# Normalize XML href to be predictible and constant in various cases
|
24
|
-
def self.normalize_slug(name, href)
|
25
|
-
href_uri = URI.parse(href)
|
26
|
-
href_slug = [href_uri.scheme, href_uri.host, *href_uri.path.split('/'), href_uri.query].select(&:present?).join('-').gsub(/[\.&]/, '-')
|
27
|
-
Russian.translit "#{name}_#{href_slug}"
|
28
38
|
end
|
29
39
|
end
|
30
40
|
end
|
41
|
+
|
data/lib/bbk/utils.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support'
|
2
4
|
require 'active_support/core_ext'
|
3
5
|
require 'bbk/utils/config'
|
@@ -10,11 +12,15 @@ require 'bbk/utils/env_helper'
|
|
10
12
|
|
11
13
|
module BBK
|
12
14
|
module Utils
|
15
|
+
|
13
16
|
class << self
|
17
|
+
|
14
18
|
attr_accessor :logger
|
15
19
|
|
16
20
|
end
|
17
21
|
|
18
|
-
self.logger = ::BBK::Logger.default
|
22
|
+
self.logger = ::BBK::Utils::Logger.default
|
23
|
+
|
19
24
|
end
|
20
25
|
end
|
26
|
+
|
data/sig/bbk/config.rbs
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
class Config
|
4
|
+
|
5
|
+
class BooleanCaster
|
6
|
+
FALSE_VALUES: Array[bool | Integer | String | Symbol]
|
7
|
+
def self.cast: (untyped value) -> (bool|nil)
|
8
|
+
end
|
9
|
+
|
10
|
+
interface _CallableCaster
|
11
|
+
def call: (String) -> untyped
|
12
|
+
end
|
13
|
+
|
14
|
+
interface _ClassCaster
|
15
|
+
def new: (String) -> untyped
|
16
|
+
end
|
17
|
+
|
18
|
+
type typeCaster = _CallableCaster | _ClassCaster
|
19
|
+
type configItem = {env: String, file: String?, required: bool, desc: String?, bool: bool, value: untyped, default: untyped, type: typeCaster?}
|
20
|
+
type envSource = _ENV | ENVClass
|
21
|
+
|
22
|
+
attr_accessor store: untyped
|
23
|
+
attr_accessor name: String?
|
24
|
+
|
25
|
+
def self.instance: () -> instance
|
26
|
+
|
27
|
+
def initialize: (?String name) -> void
|
28
|
+
def map: (envSource env, String file, ?required: bool, ?desc: String, ?bool: bool, ?key: String) -> void
|
29
|
+
def require: (envSource env, ?desc: String?, ?bool: bool, ?type: typeCaster, ?key: String?) -> void
|
30
|
+
def optional: (envSource env, ?default: untyped, ?desc: String, ?bool: bool, ?type: typeCaster, ?key: String) -> void
|
31
|
+
|
32
|
+
def run!: (?envSource source) -> void
|
33
|
+
def []: (String key) -> untyped
|
34
|
+
def []=: (String key, untyped value) -> void
|
35
|
+
def content: (String key) -> untyped
|
36
|
+
def fetch: (String key, ?untyped default) -> untyped
|
37
|
+
# def to_s: () -> String
|
38
|
+
def as_json: (*untyped) -> Hash[String, untyped]
|
39
|
+
def to_json: (*untyped) -> String
|
40
|
+
def to_yaml: (*untyped) -> String
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def normalize_key: (string key) -> String
|
45
|
+
def process: (envSource source, configItem item) -> void
|
46
|
+
|
47
|
+
def required!: (configItem item) -> void
|
48
|
+
def print_file_item: (configItem item, String padding) -> String
|
49
|
+
def print_item: (configItem item, String padding) -> String
|
50
|
+
def wrap_required: (configItem item) -> String
|
51
|
+
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/sig/bbk/crypt.rbs
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
module Crypt
|
4
|
+
def self.full_check: (String key_path, String cert_path, *String cacert_chain) -> Array[String]?
|
5
|
+
def self.valid_key: (String key_path, String cert_path) -> bool
|
6
|
+
def self.valid_cert_sign?: (String cert_path, *String ca_certs_paths) -> bool
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
module EnvHelper
|
4
|
+
|
5
|
+
def self.prepare_database_envs: (Hash[String, untyped]|::_ENV env ) -> (Hash[String,untyped]|::_ENV)
|
6
|
+
def self.prepare_mq_envs: (Hash[String, untyped]|::_ENV env) -> (Hash[String, untyped]|::_ENV)
|
7
|
+
def self.prepare_jaeger_envs: (Hash[String, untyped]|::_ENV env) -> (Hash[String, untyped]|::_ENV)
|
8
|
+
def self.build_uri_with_defaults: (Hash[String, untyped]|::_ENV env) -> URI::Generic
|
9
|
+
def self.apply_env_from_uri: (Hash[String, untyped]|::_ENV env, URI::Generic uri) -> void
|
10
|
+
def self.build_mq_uri_with_defaults: (Hash[String, untyped]|::_ENV env) -> Array[URI::Generic]
|
11
|
+
def self.apply_mq_env_from_uri: (Hash[String, untyped]|::_ENV env, Array[URI::Generic] uris) -> void
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/sig/bbk/logger.rbs
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
class Logger < ::Logger
|
4
|
+
|
5
|
+
def self.new: (*untyped) -> _Logger
|
6
|
+
|
7
|
+
def initialize: (String progname, String|Symbol|Integer|nil level, ?io: ::Logger::logdev) -> void
|
8
|
+
|
9
|
+
def silence: (*untyped) { (self) -> untyped } -> untyped
|
10
|
+
|
11
|
+
def self.default: () -> instance
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
class ProxyLogger
|
4
|
+
|
5
|
+
include _ProxyObject
|
6
|
+
|
7
|
+
attr_reader tags: Array[String]
|
8
|
+
attr_reader logger: BBK::Utils::Logger|::_Logger
|
9
|
+
|
10
|
+
def initialize: (BBK::Utils::Logger|::_Logger logger, tags: Array[String?]|String?) -> void
|
11
|
+
|
12
|
+
def add_tags: (*String tags) -> void
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/sig/bbk/utils.rbs
ADDED
data/sig/bbk/xml.rbs
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
module Xml
|
4
|
+
MTOM_ID_FIRST_LETTERS: Array[String]
|
5
|
+
def self.build_substituion_id: (string id) -> String
|
6
|
+
def self.generate_mtom_attachment_id: -> String
|
7
|
+
def self.normalize_slug: (String name, String href) -> String
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/sig/env.rbs
ADDED
data/sig/logger.rbs
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
interface _Logger
|
2
|
+
|
3
|
+
def add: (untyped severity, ?untyped message, ?untyped progname) -> untyped
|
4
|
+
|
5
|
+
def close: () -> untyped
|
6
|
+
|
7
|
+
def debug: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
8
|
+
|
9
|
+
def debug!: () -> untyped
|
10
|
+
|
11
|
+
def error: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
12
|
+
|
13
|
+
def error!: () -> untyped
|
14
|
+
|
15
|
+
def fatal: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
16
|
+
|
17
|
+
def fatal!: () -> untyped
|
18
|
+
|
19
|
+
def info: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
20
|
+
|
21
|
+
def info!: () -> untyped
|
22
|
+
|
23
|
+
def info?: () -> untyped
|
24
|
+
|
25
|
+
def level: () -> untyped
|
26
|
+
|
27
|
+
def level=: (untyped severity) -> untyped
|
28
|
+
|
29
|
+
def progname: () -> untyped
|
30
|
+
|
31
|
+
def progname=: (untyped) -> untyped
|
32
|
+
|
33
|
+
def warn: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
34
|
+
|
35
|
+
def warn!: () -> untyped
|
36
|
+
|
37
|
+
end
|