rubypitaya 3.3.3 → 3.3.7

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: 94da55ebb23095e84bb7673c03c090c5e6d750258ab8a04861776e0f3bccd488
4
- data.tar.gz: b15065b35ab812d985d30bdd0b5ef073b739282632966c09a59e600bfc63b54c
3
+ metadata.gz: 9de06df9189f69c78f1c03512f6fada275ee1bdcd590ffe1810da2b62dce14f6
4
+ data.tar.gz: 5848c25207a857715972ff3cef0f705e30872a1b2bb702ccf89d41e3f49035dc
5
5
  SHA512:
6
- metadata.gz: c7355c105856b63dbd68f15c6181adfba4a5450b6f94c98444e431c1692ab3fddee02d8609dc28b3e3e9afd83792d1fd6197f22e3a7f41b88643551d23b9baa1
7
- data.tar.gz: cf3132334be52609395c0fde4bd1bacc27fe2335dcd75dc5cca27b73351d681145f9e9a5ddc422490809d848053524b59c30ff0149edfe2e0986cdc82700a9c1
6
+ metadata.gz: 35c5eb0d8a9d3bb497159ba40517126d8749f5d467fa4b632f75d07de5f4692ba848a72540ed375a976853713fe7d6c6900b7aee177ccafecb2e548d8782c327
7
+ data.tar.gz: 33ec57d8e7f46efe56804806d086d2708a1a9912469fc23a85a03b6927047460cb11f2f96dcdcfae195539b3f980d783f69ceda3f0ad852de07b6cdb752e0442
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rubypitaya', '3.3.3'
3
+ gem 'rubypitaya', '3.3.7'
4
4
 
5
5
  group :development do
6
6
  gem 'pry', '0.14.1'
@@ -103,7 +103,7 @@ GEM
103
103
  rspec-support (~> 3.10.0)
104
104
  rspec-support (3.10.3)
105
105
  ruby2_keywords (0.0.5)
106
- rubypitaya (3.3.3)
106
+ rubypitaya (3.3.7)
107
107
  activerecord (= 6.1.4.1)
108
108
  etcdv3 (= 0.11.4)
109
109
  google-protobuf (= 3.18.1)
@@ -143,7 +143,7 @@ DEPENDENCIES
143
143
  listen (= 3.7.0)
144
144
  pry (= 0.14.1)
145
145
  rspec (= 3.10.0)
146
- rubypitaya (= 3.3.3)
146
+ rubypitaya (= 3.3.7)
147
147
  sinatra-contrib (= 2.1.0)
148
148
 
149
149
  BUNDLED WITH
@@ -4,12 +4,15 @@ module RubyPitaya
4
4
 
5
5
  class ApplicationFilesImporter
6
6
 
7
- def import
7
+ def import(is_cheats_enabled)
8
8
  app_folder_paths = Path::Plugins::APP_FOLDER_PATHS + [Path::Core::APP_FOLDER_PATH, Path::APP_FOLDER_PATH]
9
9
 
10
10
  app_folder_paths.each do |app_folder_path|
11
11
  app_files_path = "#{app_folder_path}/**/*.rb"
12
12
 
13
+ gem_files = Gem.find_files(app_files_path)
14
+ gem_files = gem_files.select { |a| !a[/.+_cheats.rb/] && !a[/.+_cheat.rb/] } unless is_cheats_enabled
15
+
13
16
  Gem.find_files(app_files_path).each do |path|
14
17
  require path unless path.include?('app/migrations')
15
18
  end
@@ -45,7 +45,10 @@ module RubyPitaya
45
45
 
46
46
  def import_handler_classes
47
47
  handler_classes = ObjectSpace.each_object(HandlerBase.singleton_class).select do |klass|
48
- klass != HandlerBase
48
+ class_name = klass.to_s.downcase
49
+ is_cheat_class = class_name.end_with?('cheat') || class_name.end_with?('cheats')
50
+
51
+ klass != HandlerBase && (@is_cheats_enabled || !is_cheat_class)
49
52
  end
50
53
 
51
54
  @handlers = handler_classes.map { |handler_class| handler_class.new }
@@ -32,6 +32,7 @@ module RubyPitaya
32
32
  def initialize
33
33
  @setup = Setup.new
34
34
  @environment_name = @setup.fetch('rubypitaya.server.environment', 'development')
35
+ @is_cheats_enabled = @setup.fetch('rubypitaya.server.cheats', false)
35
36
  @is_development_environment = @environment_name == 'development'
36
37
  @setup.auto_reload if @is_development_environment
37
38
 
@@ -42,7 +43,7 @@ module RubyPitaya
42
43
  end
43
44
 
44
45
  @application_files_importer = ApplicationFilesImporter.new
45
- @application_files_importer.import
46
+ @application_files_importer.import(@is_cheats_enabled)
46
47
  @application_files_importer.auto_reload if @is_development_environment
47
48
 
48
49
  @server_name = @setup['rubypitaya.server.name']
@@ -94,7 +95,6 @@ module RubyPitaya
94
95
  @initializer_broadcast = InitializerBroadcast.new
95
96
  @initializer_broadcast.run(@initializer_content)
96
97
 
97
- @is_cheats_enabled = @setup.fetch('rubypitaya.server.cheats', false)
98
98
  @handler_router = HandlerRouter.new(@is_cheats_enabled)
99
99
 
100
100
  run_http
@@ -180,10 +180,20 @@ module RubyPitaya
180
180
 
181
181
  @config.clear_cache
182
182
 
183
- response = @handler_router.call(handler_name, action_name, @session,
184
- @postman, @redis_connector.redis,
185
- @mongo_connector.mongo, @setup, @config,
186
- @log, params)
183
+ response = {}
184
+
185
+ begin
186
+ response = @handler_router.call(handler_name, action_name, @session,
187
+ @postman, @redis_connector.redis,
188
+ @mongo_connector.mongo, @setup, @config,
189
+ @log, params)
190
+ rescue RouteError => error
191
+ @log.error "ROUTE ERROR: #{error.class} | #{error.message}} \n #{error.backtrace.join("\n")}"
192
+ response = {
193
+ code: error.code,
194
+ message: error.message
195
+ }
196
+ end
187
197
 
188
198
  delta_time_seconds = ((Time.now.to_f - start_time_seconds) * 1000).round(2)
189
199
 
@@ -191,12 +201,6 @@ module RubyPitaya
191
201
 
192
202
  response
193
203
  end
194
- rescue RouteError => error
195
- @log.error "ROUTE ERROR: #{error.class} | #{error.message}} \n #{error.backtrace.join("\n")}"
196
- response = {
197
- code: error.code,
198
- message: error.message
199
- }
200
204
  rescue Exception => error
201
205
  @log.error "INTERNAL ERROR: #{error.class} | #{error.message}} \n #{error.backtrace.join("\n")}"
202
206
  run_nats_connection
@@ -43,6 +43,11 @@ module RubyPitaya
43
43
  @@postman, @@redis_connector.redis,
44
44
  @@mongo_connector.mongo, @@setup,
45
45
  @@config, @@log, params)
46
+ rescue RouteError => error
47
+ @@response = {
48
+ code: error.code,
49
+ message: error.message
50
+ }
46
51
  end
47
52
 
48
53
  def response
@@ -1,3 +1,3 @@
1
1
  module RubyPitaya
2
- VERSION = '3.3.3'
2
+ VERSION = '3.3.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubypitaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luciano Prestes Cavalcanti
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-27 00:00:00.000000000 Z
11
+ date: 2021-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg