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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4094dc9186412f408a5fb68be073177c786e8348222f6b57c35744eea709dffb
4
- data.tar.gz: 2d3c38258a5efc0aacc05b1f7d6a3dab1a46f41ec919464b7c90525f30205e35
3
+ metadata.gz: 16ac2bb8ad8fd47afad5c4e2dc8bd875b949636521fcb3b62cba49dd5fd0a37f
4
+ data.tar.gz: 03b783576f4c2d88c2dee210962b06597b9c4009fe0f741457a40ea1be93a193
5
5
  SHA512:
6
- metadata.gz: 8e58881b7b4541f0c6e4f04060e99ca0ad16d473f783dfc9596408eeecb6900d2c8b1ac0bd8ccd31cf27a9d7e07e3fc7494f5b590149ef5f8a09fce4991aace9
7
- data.tar.gz: df11787362b2894323fb7e3535c1cb2b192a5273ee39169c67e09dd826f5ed718e236ae48d0e5240cedb995270b3e2dcb37730ea62d15a8a72ae224285aa8728
6
+ metadata.gz: debf28f7b79c9477eb96c198b9de9afe915b82fed191d3ff93c8a0e639e4ef1cba58a2677bb34240058ca5e0f9e5ca829699ddcd4ed63d1381972490f88fa2e3
7
+ data.tar.gz: a3c9213b64b727b59bd1a29e77496623e9ad2a6cea5af6b6efe6e3a088cba760414ab1c8b8923a8bfb6b063d5ceb09b1dfca75a153cab6373130e096cc2a8882
data/lib/db/test.db CHANGED
Binary file
@@ -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]
@@ -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
- # get params
20
- options = argv.select { _1.start_with?('--') }
21
- port = options.find { _1.start_with?('--port') }&.split('=')&.last
22
- jit = options.find { _1.start_with?('--jit') }&.split('=')&.last
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
- command = "#{jit_prefix(jit)}rackup #{ENV['RACKUP_FILE']} -p #{port}"
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 = options.find { _1.start_with?('--port') }&.split('=')&.last
35
- jit = options.find { _1.start_with?('--jit') }&.split('=')&.last
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
- command = "rerun -- #{jit_prefix_dev(jit)}rackup --port #{port} #{ENV['RACKUP_FILE']}"
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" # Cyan color
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 jit_prefix_dev(key)
67
+ def jit_prefix(key) # fix: removed identical jit_prefix_dev; use this for both
68
68
  case key
69
- when 'yjit'
70
- "ruby --yjit -S "
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
- __reconnect_count ||= 0
186
- __reconnect_count += 1
187
- if __reconnect_count > 3
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
@@ -20,7 +20,7 @@ module Rubee
20
20
  RUBEE_SUPPORT = { "Rubee::Support::Hash" => Hash, "Rubee::Support::String" => String }
21
21
  end
22
22
 
23
- VERSION = '2.7.13'
23
+ VERSION = '2.7.14'
24
24
 
25
25
  require_relative 'rubee/router'
26
26
  require_relative 'rubee/logger'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ru.Bee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.13
4
+ version: 2.7.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Saltykov