rubypitaya 3.3.3 → 3.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rubypitaya/app-template/Gemfile +1 -1
- data/lib/rubypitaya/app-template/Gemfile.lock +2 -2
- data/lib/rubypitaya/core/application_files_importer.rb +4 -1
- data/lib/rubypitaya/core/handler_router.rb +4 -1
- data/lib/rubypitaya/core/main.rb +16 -12
- data/lib/rubypitaya/core/spec-helpers/handler_spec_helper.rb +5 -0
- data/lib/rubypitaya/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9de06df9189f69c78f1c03512f6fada275ee1bdcd590ffe1810da2b62dce14f6
|
4
|
+
data.tar.gz: 5848c25207a857715972ff3cef0f705e30872a1b2bb702ccf89d41e3f49035dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35c5eb0d8a9d3bb497159ba40517126d8749f5d467fa4b632f75d07de5f4692ba848a72540ed375a976853713fe7d6c6900b7aee177ccafecb2e548d8782c327
|
7
|
+
data.tar.gz: 33ec57d8e7f46efe56804806d086d2708a1a9912469fc23a85a03b6927047460cb11f2f96dcdcfae195539b3f980d783f69ceda3f0ad852de07b6cdb752e0442
|
@@ -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.
|
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.
|
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
|
-
|
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 }
|
data/lib/rubypitaya/core/main.rb
CHANGED
@@ -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 =
|
184
|
-
|
185
|
-
|
186
|
-
|
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
|
data/lib/rubypitaya/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|