ree_lib 1.0.27 → 1.0.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a595f2a5ec4f7c044a86ecfdfd0e631fee7b3b4f000ca29673189f0660936b18
4
- data.tar.gz: 9b179fdb9527e329d1c784c6fbb04f168e5b95e070fda44f1044d90776486063
3
+ metadata.gz: 84e4aade5b4eaae42f95c7664db6dd35ea318caf734d2890482d8e6d8fec060a
4
+ data.tar.gz: 65969441395458b1520c85e1f71dc610e8d2787a1c2cdcc493477eff93c0fa9a
5
5
  SHA512:
6
- metadata.gz: 3ba5209c69d69b970340659a20fe07b2382e7aa7f84615c696da2925010fe19dff31eec1707a7436898b749ce09aa6e8240ce400cab5911044e324ac1ca168f9
7
- data.tar.gz: 18fc8a1eeb6684d426349ec9f97f4f537c505e20f02bfd6175611b1f25b6ca206e9a2306b0a955527eb54aebd2bf17e326f152f4c45112c7251f957c8588d289
6
+ metadata.gz: a486a292e460edfd1ffb3304d7168ae8f5c9c615c6ae2b32dce08fa661f76f081b9082faa35b5077b43dc28fa0aa39dfb9eb7917fada4736e94cf7c0bbbc2260
7
+ data.tar.gz: 6582341e1519c1e06261d1c1e8faa85106e26c12ea4afe7f2a6788fcbf5d19f2c14c39e32b3f29e4ffa7c1bceba052608cbc5d9fdd39245ca09dbcf031dcd12b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree_lib (1.0.27)
4
+ ree_lib (1.0.29)
5
5
  binding_of_caller (~> 1.0.0)
6
6
  i18n (~> 1.12.0)
7
7
  loofah (~> 2.18.0)
@@ -22,7 +22,7 @@ GEM
22
22
  msgpack (~> 1.2)
23
23
  commander (4.6.0)
24
24
  highline (~> 2.0.0)
25
- concurrent-ruby (1.1.10)
25
+ concurrent-ruby (1.2.0)
26
26
  crack (0.4.5)
27
27
  rexml
28
28
  crass (1.0.6)
@@ -36,9 +36,9 @@ GEM
36
36
  crass (~> 1.0.2)
37
37
  nokogiri (>= 1.5.9)
38
38
  msgpack (1.6.0)
39
- nokogiri (1.13.10-x86_64-darwin)
39
+ nokogiri (1.14.0-x86_64-darwin)
40
40
  racc (~> 1.4)
41
- nokogiri (1.13.10-x86_64-linux)
41
+ nokogiri (1.14.0-x86_64-linux)
42
42
  racc (~> 1.4)
43
43
  oj (3.13.23)
44
44
  pg (1.4.5)
@@ -46,7 +46,7 @@ GEM
46
46
  racc (1.6.2)
47
47
  rainbow (3.1.1)
48
48
  rake (13.0.6)
49
- ree (1.0.14)
49
+ ree (1.0.18)
50
50
  commander (~> 4.6.0)
51
51
  rexml (3.2.5)
52
52
  rollbar (3.3.3)
@@ -66,7 +66,7 @@ GEM
66
66
  sequel (5.58.0)
67
67
  sqlite3 (1.4.4)
68
68
  timecop (0.9.6)
69
- tzinfo (2.0.5)
69
+ tzinfo (2.0.6)
70
70
  concurrent-ruby (~> 1.0)
71
71
  webmock (3.18.1)
72
72
  addressable (>= 2.8.0)
@@ -25,6 +25,7 @@ class ReeDao::BuildPgConnection
25
25
  sslrootcert?: String,
26
26
  search_path?: String,
27
27
  use_iso_date_format?: Bool,
28
+ max_connections?: Integer,
28
29
  },
29
30
  Ksplat[
30
31
  RestKeys => Any # inherited from `build_connection` opts
@@ -13,6 +13,7 @@ class ReeDao::BuildSqliteConnection
13
13
  database: String,
14
14
  readonly?: Bool,
15
15
  timeout?: Integer,
16
+ max_connections?: Integer,
16
17
  },
17
18
  Ksplat[
18
19
  RestKeys => Any # inherited from `build_connection` opts
@@ -16,7 +16,7 @@
16
16
  "args": [
17
17
  {
18
18
  "arg": "conn_opts",
19
- "type": "{:conn_str? => String, :adapter => String, :database? => String, :encoding? => String, :user? => String, :password? => String, :host? => String, :port? => String, :convert_infinite_timestamps? => Or[string, nil, float], :connect_timeout? => Integer, :driver_options? => Hash, :notice_receiver? => Proc, :sslmode? => Or[disable, allow, prefer, require, verify-ca, verify-full...], :sslrootcert? => String, :search_path? => String, :use_iso_date_format? => Bool}"
19
+ "type": "{:conn_str? => String, :adapter => String, :database? => String, :encoding? => String, :user? => String, :password? => String, :host? => String, :port? => String, :convert_infinite_timestamps? => Or[string, nil, float], :connect_timeout? => Integer, :driver_options? => Hash, :notice_receiver? => Proc, :sslmode? => Or[disable, allow, prefer, require, verify-ca, verify-full...], :sslrootcert? => String, :search_path? => String, :use_iso_date_format? => Bool, :max_connections? => Integer}"
20
20
  },
21
21
  {
22
22
  "arg": "opts",
@@ -16,7 +16,7 @@
16
16
  "args": [
17
17
  {
18
18
  "arg": "conn_opts",
19
- "type": "{:database => String, :readonly? => Bool, :timeout? => Integer}"
19
+ "type": "{:database => String, :readonly? => Bool, :timeout? => Integer, :max_connections? => Integer}"
20
20
  },
21
21
  {
22
22
  "arg": "opts",
@@ -0,0 +1,10 @@
1
+ package_require('ree_dao')
2
+
3
+ RSpec.describe :build_sqlite_connection do
4
+ link :build_sqlite_connection, from: :ree_dao
5
+
6
+ it {
7
+ db = build_sqlite_connection({database: 'sqlite_db', max_connections: 2})
8
+ expect(db.pool.max_size).to eq 2
9
+ }
10
+ end
@@ -1,10 +1,10 @@
1
1
  class ReeLogger::MultiLogger < Logger
2
2
  include Ree::LinkDSL
3
3
 
4
- link 'ree_logger/rate_limiter', -> { RateLimiter }
5
- link 'ree_logger/log_event', -> { LogEvent }
6
- link :transform_values, from: :ree_hash
7
4
  link :as_json, from: :ree_object
5
+ link :transform_values, from: :ree_hash
6
+ link 'ree_logger/log_event', -> { LogEvent }
7
+ link 'ree_logger/rate_limiter', -> { RateLimiter }
8
8
 
9
9
  undef level=
10
10
  undef datetime_format
@@ -26,7 +26,7 @@ class ReeLogger::MultiLogger < Logger
26
26
  Nilor[String],
27
27
  Nilor[RateLimiter],
28
28
  Nilor[ArrayOf[String]] => Any
29
- )
29
+ ).throws(ArgumentError)
30
30
  def initialize(progname, rate_limiter, filter_words)
31
31
  @progname = progname
32
32
  @rate_limiter = rate_limiter
@@ -57,34 +57,64 @@ class ReeLogger::MultiLogger < Logger
57
57
  @silenced = false
58
58
  end
59
59
 
60
- contract(String, Hash, Nilor[Exception], Bool => nil)
61
- def debug(message, parameters = {}, exception = nil, log_args = false)
62
- log(:debug, message, parameters, nil, false)
60
+ contract(Nilor[String], Hash, Nilor[Exception], Bool, Nilor[String], Optblock => nil)
61
+ def debug(message = nil, parameters = {}, exception = nil, log_args = false, progname = nil, &block)
62
+ if block_given?
63
+ log(:debug, yield, parameters, nil, log_args)
64
+ else
65
+ msg = get_message(message)
66
+ log(:debug, msg, parameters, nil, log_args)
67
+ end
63
68
  end
64
69
 
65
- contract(String, Hash, Nilor[Exception], Bool => nil)
66
- def info(message, parameters = {}, exception = nil, log_args = false)
67
- log(:info, message, parameters, nil)
70
+ contract(Nilor[String], Hash, Nilor[Exception], Bool, Nilor[String], Optblock => nil)
71
+ def info(message = nil, parameters = {}, exception = nil, log_args = false, progname = nil, &block)
72
+ if block_given?
73
+ log(:info, yield, parameters, nil, log_args)
74
+ else
75
+ msg = get_message(message)
76
+ log(:info, msg, parameters, nil)
77
+ end
68
78
  end
69
79
 
70
- contract(String, Hash, Nilor[Exception], Bool => nil)
71
- def warn(message, parameters = {}, exception = nil, log_args = false)
72
- log(:warn, message, parameters, nil)
80
+ contract(Nilor[String], Hash, Nilor[Exception], Bool, Nilor[String], Optblock => nil)
81
+ def warn(message = nil, parameters = {}, exception = nil, log_args = false, progname = nil, &block)
82
+ if block_given?
83
+ log(:warn, yield, parameters, nil, log_args)
84
+ else
85
+ msg = get_message(message)
86
+ log(:warn, msg, parameters, nil)
87
+ end
73
88
  end
74
89
 
75
- contract(String, Hash, Nilor[Exception], Bool => nil)
76
- def error(message, parameters = {}, exception = nil, log_args = true)
77
- log(:error, message, parameters, exception, log_args)
90
+ contract(Nilor[String], Hash, Nilor[Exception], Bool, Nilor[String], Optblock => nil)
91
+ def error(message = nil, parameters = {}, exception = nil, log_args = true, progname = nil, &block)
92
+ if block_given?
93
+ log(:error, yield, parameters, exception, log_args)
94
+ else
95
+ msg = get_message(message)
96
+ log(:error, msg, parameters, exception, log_args)
97
+ end
78
98
  end
79
99
 
80
- contract(String, Hash, Nilor[Exception], Bool => nil)
81
- def fatal(message, parameters = {}, exception = nil, log_args = true)
82
- log(:error, message, parameters, exception, true)
100
+ contract(Nilor[String], Hash, Nilor[Exception], Bool, Nilor[String], Optblock => nil)
101
+ def fatal(message = nil, parameters = {}, exception = nil, log_args = true, progname = nil, &block)
102
+ if block_given?
103
+ log(:error, yield, parameters, exception, log_args)
104
+ else
105
+ msg = get_message(message)
106
+ log(:error, msg, parameters, exception, log_args)
107
+ end
83
108
  end
84
109
 
85
- contract(String, Hash, Nilor[Exception], Bool => nil)
86
- def unknown(message, parameters = {}, exception = nil, log_args = true)
87
- log(:unknown, message, parameters, exception, true)
110
+ contract(Nilor[String], Hash, Nilor[Exception], Bool, Nilor[String], Optblock => nil)
111
+ def unknown(message = nil, parameters = {}, exception = nil, log_args = true, progname = nil, &block)
112
+ if block_given?
113
+ log(:unknown, yield, parameters, exception, log_args)
114
+ else
115
+ msg = get_message(message)
116
+ log(:unknown, msg, parameters, exception, log_args)
117
+ end
88
118
  end
89
119
 
90
120
  contract(Symbol, String, Hash, Nilor[Exception], Bool => nil)
@@ -158,4 +188,8 @@ class ReeLogger::MultiLogger < Logger
158
188
  def higher_or_equal_level?(message_level, appender_level)
159
189
  LEVEL_MAPPING[message_level] >= LEVEL_MAPPING[appender_level]
160
190
  end
191
+
192
+ def get_message(message)
193
+ message || (raise ArgumentError.new("message should be given"))
194
+ end
161
195
  end
@@ -81,6 +81,12 @@ RSpec.describe ReeLogger::MultiLogger do
81
81
  expect(File.read(log_file_path)).to match("hello world")
82
82
  }
83
83
 
84
+ it {
85
+ expect { logger_with_appenders.info {'block message'} }.to output(/block message/).to_stdout
86
+ expect(Rollbar).to have_received(:log)
87
+ expect(File.read(log_file_path)).to match("block message")
88
+ }
89
+
84
90
  it {
85
91
  expect { logger_with_appenders.info('hello world', { param: 1, another_param: { name: 'John'}, password: 'password01' }) }.to output(/John/).to_stdout
86
92
  expect(Rollbar).to have_received(:log)
@@ -136,6 +142,4 @@ RSpec.describe ReeLogger::MultiLogger do
136
142
  end
137
143
  }.to_not output.to_stdout
138
144
  }
139
-
140
-
141
145
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReeLib
4
- VERSION = "1.0.27"
4
+ VERSION = "1.0.29"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ree_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.27
4
+ version: 1.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-08 00:00:00.000000000 Z
11
+ date: 2023-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ree
@@ -260,6 +260,7 @@ files:
260
260
  - lib/ree_lib/packages/ree_dao/schemas/ree_dao/functions/one_to_one.schema.json
261
261
  - lib/ree_lib/packages/ree_dao/schemas/ree_dao/functions/persist_assoc.schema.json
262
262
  - lib/ree_lib/packages/ree_dao/spec/package_schema_spec.rb
263
+ - lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/build_sqlite_connection/max_connections_spec.rb
263
264
  - lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/build_sqlite_connection_spec.rb
264
265
  - lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/one_to_many_spec.rb
265
266
  - lib/ree_lib/packages/ree_dao/spec/ree_dao/functions/one_to_one_spec.rb