ru.Bee 2.7.13 → 2.7.15
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 +17 -4
- 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: 16ac2bb8ad8fd47afad5c4e2dc8bd875b949636521fcb3b62cba49dd5fd0a37f
|
|
4
|
+
data.tar.gz: 03b783576f4c2d88c2dee210962b06597b9c4009fe0f741457a40ea1be93a193
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: debf28f7b79c9477eb96c198b9de9afe915b82fed191d3ff93c8a0e639e4ef1cba58a2677bb34240058ca5e0f9e5ca829699ddcd4ed63d1381972490f88fa2e3
|
|
7
|
+
data.tar.gz: a3c9213b64b727b59bd1a29e77496623e9ad2a6cea5af6b6efe6e3a088cba760414ab1c8b8923a8bfb6b063d5ceb09b1dfca75a153cab6373130e096cc2a8882
|
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
|
|
@@ -174,17 +174,30 @@ module Rubee
|
|
|
174
174
|
false
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
+
def force_disconnect!
|
|
178
|
+
DB.disconnect
|
|
179
|
+
Object.send(:remove_const, :DB)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def force_reconnect!
|
|
183
|
+
force_disconnect!
|
|
184
|
+
const_set(:DB, Sequel.connect(Rubee::Configuration.get_database_url))
|
|
185
|
+
end
|
|
186
|
+
|
|
177
187
|
def db_set?
|
|
178
188
|
defined?(DB) && !DB.nil?
|
|
179
189
|
end
|
|
180
190
|
|
|
181
191
|
def dataset
|
|
182
|
-
DB[pluralize_class_name.to_sym]
|
|
192
|
+
@dataset ||= DB[pluralize_class_name.to_sym]
|
|
193
|
+
reconnect_count = 0
|
|
194
|
+
|
|
195
|
+
@dataset
|
|
183
196
|
rescue Exception => e
|
|
184
197
|
reconnect!
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if
|
|
198
|
+
reconnect_count ||= 0
|
|
199
|
+
reconnect_count += 1
|
|
200
|
+
if reconnect_count > 3
|
|
188
201
|
raise e
|
|
189
202
|
end
|
|
190
203
|
sleep(0.1)
|
data/lib/rubee.rb
CHANGED