rubypitaya 3.3.1 → 3.3.5
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 +15 -10
- data/lib/rubypitaya/core/route_error.rb +9 -5
- data/lib/rubypitaya/version.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: 8df3d82ce77fdcc4242708fa55141b36e5812baa3ab435609d8495f3bac0d745
|
4
|
+
data.tar.gz: db92a024f37405e3235fc466e2c0e84068762429ba40d7d3cc5d29f2257e67f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4370cfa9d7677153b09ad5fe5f356fb43d86c56cbcf39ca94c7bed66cf3624470ab6f5eaaf1d7f814d801cef7eaa79ffacbabbdf2bfef574df17566df8c7f35f
|
7
|
+
data.tar.gz: 63b3c54bfb906c6f89ed2c866b974a326676674a2d3decce9fc1c9147f6acf73f98cde7188f1927ec07d12e0d14b18b65eb6920d0d34eb382fe86a844d276efb
|
@@ -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.5)
|
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.5)
|
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
@@ -10,6 +10,7 @@ require 'rubypitaya/core/session'
|
|
10
10
|
require 'rubypitaya/core/postman'
|
11
11
|
require 'rubypitaya/core/parameters'
|
12
12
|
require 'rubypitaya/core/http_routes'
|
13
|
+
require 'rubypitaya/core/route_error'
|
13
14
|
require 'rubypitaya/core/routes_base'
|
14
15
|
require 'rubypitaya/core/status_codes'
|
15
16
|
require 'rubypitaya/core/handler_router'
|
@@ -179,10 +180,20 @@ module RubyPitaya
|
|
179
180
|
|
180
181
|
@config.clear_cache
|
181
182
|
|
182
|
-
response =
|
183
|
-
|
184
|
-
|
185
|
-
|
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
|
186
197
|
|
187
198
|
delta_time_seconds = ((Time.now.to_f - start_time_seconds) * 1000).round(2)
|
188
199
|
|
@@ -190,12 +201,6 @@ module RubyPitaya
|
|
190
201
|
|
191
202
|
response
|
192
203
|
end
|
193
|
-
rescue RouteError => error
|
194
|
-
@log.error "ROUTE ERROR: #{error.class} | #{error.message}} \n #{error.backtrace.join("\n")}"
|
195
|
-
response = {
|
196
|
-
code: error.code,
|
197
|
-
message: error.message
|
198
|
-
}
|
199
204
|
rescue Exception => error
|
200
205
|
@log.error "INTERNAL ERROR: #{error.class} | #{error.message}} \n #{error.backtrace.join("\n")}"
|
201
206
|
run_nats_connection
|
@@ -1,9 +1,13 @@
|
|
1
|
-
|
1
|
+
module RubyPitaya
|
2
|
+
class RouteError < StandardError
|
2
3
|
|
3
|
-
|
4
|
-
@code = code
|
5
|
-
@message = message
|
4
|
+
attr_reader :code, :message
|
6
5
|
|
7
|
-
|
6
|
+
def initialize(code, message)
|
7
|
+
@code = code
|
8
|
+
@message = message
|
9
|
+
|
10
|
+
super(message)
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
data/lib/rubypitaya/version.rb
CHANGED