ru.Bee 2.7.12 → 2.7.14
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/lib/db/test.db +0 -0
- data/lib/rubee/autoload.rb +1 -1
- data/lib/rubee/cli/server.rb +25 -27
- data/lib/rubee/models/sequel_object.rb +9 -6
- data/lib/rubee.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e6378c189ee732e5d57d9243c15cbb821b438adb16cb35c78f22940526bac65c
|
|
4
|
+
data.tar.gz: 7c39cfc95486d9eab4e4685ba4467bbc683f994ca9e28f6f6b1f27d539707692
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42a775843e2181ace3bea37ee918adf8a3606309b2831572b27936eac49d7c8b2fb259ad2822097f8386305e9a29765813e5d16a7315ff499d5b3b4dd30d8dd0
|
|
7
|
+
data.tar.gz: 12ca16e3d05017ed31e7b6c301da397105eb5e0f9394e0a308051eae49ea5d07472e9dcb8b480655e3baf0b4bb13ff3874b2bbd45c87a952d432a2679ce32015
|
data/lib/db/test.db
CHANGED
|
Binary file
|
data/lib/rubee/autoload.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Rubee
|
|
2
2
|
class Autoload
|
|
3
|
-
BLACKLIST = ['rubee.rb', 'test_helper.rb']
|
|
3
|
+
BLACKLIST = ['rubee.rb', 'test_helper.rb', 'puma.rb']
|
|
4
4
|
class << self
|
|
5
5
|
def call(black_list = [], **options)
|
|
6
6
|
load_whitelisted(options[:white_list_dirs]) && return if options[:white_list_dirs]
|
data/lib/rubee/cli/server.rb
CHANGED
|
@@ -9,36 +9,45 @@ module Rubee
|
|
|
9
9
|
|_| \_\\____/ |____/|_____|__|
|
|
10
10
|
Ver: %s ⬡ ⬢ ⬢ rubee ⬢ ⬡
|
|
11
11
|
LOGO
|
|
12
|
-
|
|
13
12
|
class << self
|
|
14
13
|
def call(command, argv)
|
|
15
14
|
send(command, argv)
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
def start(argv)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
options = argv.select { _1.start_with?('--') }
|
|
19
|
+
port = options.find { _1.start_with?('--port') }&.split('=')&.last
|
|
20
|
+
jit = options.find { _1.start_with?('--jit') }&.split('=')&.last
|
|
21
|
+
port ||= ENV.fetch('PORT', '7000') # fix: don't clobber parsed port
|
|
22
|
+
puma_config = ENV.fetch('PUMA_CONFIG', 'config/puma.rb')
|
|
23
|
+
rackup_file = ENV.fetch('RACKUP_FILE', '')
|
|
23
24
|
|
|
24
|
-
port ||= '7000'
|
|
25
25
|
print_logo
|
|
26
26
|
color_puts("Starting takeoff of ruBee on port: #{port}...", color: :yellow)
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
command = [
|
|
29
|
+
jit_prefix(jit),
|
|
30
|
+
"bundle exec puma",
|
|
31
|
+
File.exist?(puma_config) ? "-C #{puma_config}" : '',
|
|
32
|
+
rackup_file,
|
|
33
|
+
"-p #{port}",
|
|
34
|
+
].join(" ")
|
|
35
|
+
|
|
28
36
|
color_puts(command, color: :gray)
|
|
29
37
|
exec(command)
|
|
30
38
|
end
|
|
31
39
|
|
|
32
40
|
def start_dev(argv)
|
|
33
41
|
options = argv.select { _1.start_with?('--') }
|
|
34
|
-
port
|
|
35
|
-
jit
|
|
42
|
+
port = options.find { _1.start_with?('--port') }&.split('=')&.last
|
|
43
|
+
jit = options.find { _1.start_with?('--jit') }&.split('=')&.last
|
|
44
|
+
port ||= ENV.fetch('PORT', '7000') # fix: consistent with start; use ENV fallback
|
|
45
|
+
rackup_file = ENV.fetch('RACKUP_FILE', '')
|
|
36
46
|
|
|
37
|
-
port ||= '7000'
|
|
38
47
|
print_logo
|
|
39
|
-
|
|
40
48
|
color_puts("Starting takeoff of ruBee server on port #{port} in dev mode...", color: :yellow)
|
|
41
|
-
|
|
49
|
+
|
|
50
|
+
command = "rerun -- #{jit_prefix(jit)}rackup --port #{port} #{rackup_file}"
|
|
42
51
|
color_puts(command, color: :gray)
|
|
43
52
|
exec(command)
|
|
44
53
|
end
|
|
@@ -52,24 +61,13 @@ LOGO
|
|
|
52
61
|
end
|
|
53
62
|
|
|
54
63
|
def print_logo
|
|
55
|
-
puts "\e[36m#{LOGO % Rubee::VERSION}\e[0m"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def jit_prefix(key)
|
|
59
|
-
case key
|
|
60
|
-
when 'yjit'
|
|
61
|
-
"ruby --yjit -S "
|
|
62
|
-
else
|
|
63
|
-
""
|
|
64
|
-
end
|
|
64
|
+
puts "\e[36m#{LOGO % Rubee::VERSION}\e[0m"
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
def
|
|
67
|
+
def jit_prefix(key) # fix: removed identical jit_prefix_dev; use this for both
|
|
68
68
|
case key
|
|
69
|
-
when 'yjit'
|
|
70
|
-
|
|
71
|
-
else
|
|
72
|
-
""
|
|
69
|
+
when 'yjit' then "ruby --yjit -S "
|
|
70
|
+
else ""
|
|
73
71
|
end
|
|
74
72
|
end
|
|
75
73
|
end
|
|
@@ -54,7 +54,7 @@ module Rubee
|
|
|
54
54
|
|
|
55
55
|
def update(args = {})
|
|
56
56
|
assign_attributes(args)
|
|
57
|
-
args.merge
|
|
57
|
+
args = args.merge(updated:)
|
|
58
58
|
found_hash = self.class.dataset.where(id:)
|
|
59
59
|
return self.class.find(id) if Rubee::DBTools.with_retry { found_hash&.update(**args) }
|
|
60
60
|
|
|
@@ -179,12 +179,15 @@ module Rubee
|
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
def dataset
|
|
182
|
-
@dataset
|
|
182
|
+
@dataset ||= DB[pluralize_class_name.to_sym]
|
|
183
|
+
reconnect_count = 0
|
|
184
|
+
|
|
185
|
+
@dataset
|
|
183
186
|
rescue Exception => e
|
|
184
187
|
reconnect!
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if
|
|
188
|
+
reconnect_count ||= 0
|
|
189
|
+
reconnect_count += 1
|
|
190
|
+
if reconnect_count > 3
|
|
188
191
|
raise e
|
|
189
192
|
end
|
|
190
193
|
sleep(0.1)
|
|
@@ -259,7 +262,7 @@ module Rubee
|
|
|
259
262
|
|
|
260
263
|
def create(attrs)
|
|
261
264
|
if dataset.columns.include?(:created) && dataset.columns.include?(:updated)
|
|
262
|
-
attrs.merge
|
|
265
|
+
attrs = attrs.merge(created: Time.now, updated: Time.now)
|
|
263
266
|
end
|
|
264
267
|
instance = new(**attrs)
|
|
265
268
|
Rubee::DBTools.with_retry { instance.save }
|
data/lib/rubee.rb
CHANGED