rbbt-rest 1.2.28 → 1.2.29
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 +8 -8
- data/lib/rbbt/rest/common/cache.rb +3 -3
- data/lib/rbbt/rest/common/misc.rb +1 -1
- data/lib/rbbt/rest/common/render.rb +2 -2
- data/lib/rbbt/rest/common/resources.rb +1 -1
- data/lib/rbbt/rest/common/users.rb +3 -3
- data/lib/rbbt/rest/entity/locate.rb +6 -6
- data/lib/rbbt/rest/entity/map.rb +1 -1
- data/lib/rbbt/rest/file_server.rb +7 -4
- data/lib/rbbt/rest/main.rb +4 -4
- data/lib/rbbt/rest/workflow.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
M2ZiYTdmYzg0MWE3ZWIxNWI3MWE1MGZlNzQzZjcyZThiYmE1ZTE4Mw==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YjdlNzdiZGNjZjYxZTgwYTMwYmI2N2Q4YTc2NmQ5NTk3MGE5N2JiYQ==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
MWNmMDA5NGZjNTIyNDRiODY4NDEwOGQ1MmY3MTg3MDI0YWQ5NjljZTdjZWRk
|
|
10
|
+
OTVhYzQ2ZmE5ZmM2MzI1MDRiMmVkZjliZmI0YmMzZjI2ODQzMGM0ZjM3ZDQx
|
|
11
|
+
NmMxNDM5Nzk5NmQ0YTAwYTJlMzcyMzhmMzA3MmI5YWNjYTYxMTA=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
NzgyMjgzYjMzN2ZlNzlkNDI0Yzk3OTE0YzlhYmE0NjVjYTY4ZDA4ZmIzZDU1
|
|
14
|
+
OTE4MTVlMWZhYjA3YWZjMDU5Y2ZiMDE4NGRkYjdiYzAzMTFkYjM0OGFhNTY1
|
|
15
|
+
ZTI3NDc5YWE5ZDYyOTNmYjZkNGMwZTI3ZWIwMjg1MGU4OWViN2U=
|
|
@@ -103,7 +103,7 @@ module RbbtRESTHelpers
|
|
|
103
103
|
step.abort if pid and Misc.pid_exists? pid
|
|
104
104
|
step.pid = nil
|
|
105
105
|
rescue Exception
|
|
106
|
-
Log.medium
|
|
106
|
+
Log.medium{$!.message}
|
|
107
107
|
end
|
|
108
108
|
step.clean
|
|
109
109
|
end
|
|
@@ -143,10 +143,10 @@ module RbbtRESTHelpers
|
|
|
143
143
|
else
|
|
144
144
|
# check for problems
|
|
145
145
|
if File.exists?(step.info_file) and Time.now - File.atime(step.info_file) > 60
|
|
146
|
-
Log.debug
|
|
146
|
+
Log.debug{ "Checking on #{step.info_file}" }
|
|
147
147
|
running = step.running?
|
|
148
148
|
if FalseClass === running
|
|
149
|
-
Log.debug
|
|
149
|
+
Log.debug{ "Aborting zombie #{step.info_file}" }
|
|
150
150
|
step.abort unless step.done?
|
|
151
151
|
raise RbbtRESTHelpers::Retry
|
|
152
152
|
end
|
|
@@ -40,13 +40,13 @@ module RbbtRESTHelpers
|
|
|
40
40
|
if layout_file
|
|
41
41
|
Haml::Engine.new(Open.read(layout_file), :filename => layout_file, :ugly => production?).render(self, locals) do
|
|
42
42
|
cache(cache, locals.merge(:_template_file => template_file, :user => user).merge(cache_options)) do
|
|
43
|
-
Log.debug
|
|
43
|
+
Log.debug{ "Rendering #{template_file} with layout" }
|
|
44
44
|
Haml::Engine.new(Open.read(template_file), :filename => template_file, :ugly => production?).render(self, locals)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
else
|
|
48
48
|
cache(cache, locals.merge(:_template_file => template_file, :user => user).merge(cache_options)) do
|
|
49
|
-
Log.debug
|
|
49
|
+
Log.debug{ "Rendering #{template_file} without layout" }
|
|
50
50
|
Haml::Engine.new(Open.read(template_file), :filename => template_file, :ugly => production?).render(self, locals)
|
|
51
51
|
end
|
|
52
52
|
end
|
|
@@ -36,7 +36,7 @@ module RbbtRESTHelpers
|
|
|
36
36
|
filename = File.join(settings.file_dir, "all_js-#{md5}.js")
|
|
37
37
|
|
|
38
38
|
if not File.exists?(filename)
|
|
39
|
-
Log.debug
|
|
39
|
+
Log.debug{ "Regenerating JS Compressed file: #{ filename }" }
|
|
40
40
|
|
|
41
41
|
text = recorded_js_files.collect{|file|
|
|
42
42
|
begin
|
|
@@ -13,7 +13,7 @@ module Sinatra
|
|
|
13
13
|
def authorize!
|
|
14
14
|
return true if authorized?
|
|
15
15
|
target_url = request.env["REQUEST_URI"]
|
|
16
|
-
Log.warn
|
|
16
|
+
Log.warn{ "Unauthorized access to #{target_url}" }
|
|
17
17
|
session[:target_url] = target_url
|
|
18
18
|
redirect '/login'
|
|
19
19
|
end
|
|
@@ -51,7 +51,7 @@ module Sinatra
|
|
|
51
51
|
pass = params[:pass]
|
|
52
52
|
|
|
53
53
|
if settings.users.include?(user) and settings.users[user] == pass
|
|
54
|
-
Log.warn
|
|
54
|
+
Log.warn{ "Successful login #{[user, pass] * ": "}" }
|
|
55
55
|
session[:authorized] = true
|
|
56
56
|
session[:user] = user
|
|
57
57
|
if session[:target_url]
|
|
@@ -61,7 +61,7 @@ module Sinatra
|
|
|
61
61
|
redirect '/'
|
|
62
62
|
end
|
|
63
63
|
else
|
|
64
|
-
Log.warn
|
|
64
|
+
Log.warn{ "Failed login attempt #{[user, pass] * ": "}" }
|
|
65
65
|
session[:authorized] = false
|
|
66
66
|
redirect '/login'
|
|
67
67
|
end
|
|
@@ -87,12 +87,12 @@ module EntityRESTHelpers
|
|
|
87
87
|
true
|
|
88
88
|
when File.exists?(check_file)
|
|
89
89
|
begin
|
|
90
|
-
Log.debug
|
|
90
|
+
Log.debug{"Checking action template: #{path}"}
|
|
91
91
|
code = File.read(check_file)
|
|
92
92
|
accept = eval code
|
|
93
93
|
not accept
|
|
94
94
|
rescue
|
|
95
|
-
Log.debug
|
|
95
|
+
Log.debug{"Error Checking action template #{path}: #{$!.message}"}
|
|
96
96
|
true
|
|
97
97
|
end
|
|
98
98
|
else
|
|
@@ -223,12 +223,12 @@ module EntityRESTHelpers
|
|
|
223
223
|
true
|
|
224
224
|
when File.exists?(check_file)
|
|
225
225
|
begin
|
|
226
|
-
Log.debug
|
|
226
|
+
Log.debug{ "Checking action template: #{path}" }
|
|
227
227
|
code = File.read(check_file)
|
|
228
228
|
accept = eval code
|
|
229
229
|
not accept
|
|
230
230
|
rescue
|
|
231
|
-
Log.debug
|
|
231
|
+
Log.debug{ "Error Checking action template #{path}: #{$!.message}" }
|
|
232
232
|
true
|
|
233
233
|
end
|
|
234
234
|
else
|
|
@@ -345,12 +345,12 @@ module EntityRESTHelpers
|
|
|
345
345
|
true
|
|
346
346
|
when File.exists?(check_file)
|
|
347
347
|
begin
|
|
348
|
-
Log.debug
|
|
348
|
+
Log.debug{ "Checking action template: #{path}" }
|
|
349
349
|
code = File.read(check_file)
|
|
350
350
|
accept = eval code
|
|
351
351
|
not accept
|
|
352
352
|
rescue
|
|
353
|
-
Log.debug
|
|
353
|
+
Log.debug{ "Error Checking action template #{path}: #{$!.message}" }
|
|
354
354
|
true
|
|
355
355
|
end
|
|
356
356
|
else
|
data/lib/rbbt/rest/entity/map.rb
CHANGED
|
@@ -25,10 +25,13 @@ module Sinatra
|
|
|
25
25
|
|
|
26
26
|
raise "For security reasons the file path must not leave the resource root directory" unless Misc.path_relative_to(resource.root, path)
|
|
27
27
|
|
|
28
|
-
Log.debug
|
|
28
|
+
Log.debug{"Serving resource: #{[resource, directory, path, path.find] * " | "}"}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if create
|
|
31
|
+
raise "Directory does not exist and cannot be created" unless path.exists?
|
|
32
|
+
else
|
|
33
|
+
raise "Directory does not exist" unless Open.exists? path.find
|
|
34
|
+
end
|
|
32
35
|
|
|
33
36
|
headers['Content-Encoding'] = 'gzip'
|
|
34
37
|
stream do |out|
|
|
@@ -60,7 +63,7 @@ module Sinatra
|
|
|
60
63
|
|
|
61
64
|
raise "For security reasons the file path must not leave the resource root directory" unless Misc.path_relative_to(resource.root, path)
|
|
62
65
|
|
|
63
|
-
Log.debug
|
|
66
|
+
Log.debug{"Resource: #{[resource, file, path, path.find] * " | "}"}
|
|
64
67
|
|
|
65
68
|
raise "File does not exist and can not create it" unless path.exists?
|
|
66
69
|
|
data/lib/rbbt/rest/main.rb
CHANGED
|
@@ -42,7 +42,7 @@ module Sinatra
|
|
|
42
42
|
set :allow_headers, ['URI']
|
|
43
43
|
|
|
44
44
|
before do
|
|
45
|
-
Log.info
|
|
45
|
+
Log.info{ "#{request.request_method} #{request.ip}: " << request.path_info << ". Params: " << Misc.fingerprint(params) }
|
|
46
46
|
process_common_parameters
|
|
47
47
|
|
|
48
48
|
if profile
|
|
@@ -51,7 +51,7 @@ module Sinatra
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
after do
|
|
54
|
-
Log.info
|
|
54
|
+
Log.info{ "#{request.request_method} #{request.ip}: " << request.path_info << ". Status: " << response.status.to_s }
|
|
55
55
|
|
|
56
56
|
if profile
|
|
57
57
|
result = RubyProf.stop
|
|
@@ -60,7 +60,7 @@ module Sinatra
|
|
|
60
60
|
dir = settings.file_dir
|
|
61
61
|
FileUtils.mkdir_p dir unless File.exists? dir
|
|
62
62
|
printer.print(:path => dir, :profile => 'profile')
|
|
63
|
-
Log.info
|
|
63
|
+
Log.info{ "Profile saved at #{ dir }: #{request.env["REQUEST_URI"]}" }
|
|
64
64
|
end
|
|
65
65
|
response.header["URI"] = request.env["REQUEST_URI"]
|
|
66
66
|
end
|
|
@@ -93,7 +93,7 @@ module Sinatra
|
|
|
93
93
|
|
|
94
94
|
@cache_type = production? ? :synchronous : :none
|
|
95
95
|
cache('css', :_template_file => file, :_send_file => true) do
|
|
96
|
-
Log.debug
|
|
96
|
+
Log.debug{ "Rendering stylesheets" }
|
|
97
97
|
renderer = Sass::Engine.new(Open.read(file), :filename => file,
|
|
98
98
|
:style => production? ? :compressed : nil,
|
|
99
99
|
:debug_info => development? ? true : false)
|
data/lib/rbbt/rest/workflow.rb
CHANGED
|
@@ -37,7 +37,7 @@ module Sinatra
|
|
|
37
37
|
|
|
38
38
|
add_workflow_resource(workflow) if add_resource
|
|
39
39
|
|
|
40
|
-
Log.debug
|
|
40
|
+
Log.debug{ "Adding #{ workflow } to REST server" }
|
|
41
41
|
|
|
42
42
|
self.instance_eval workflow.libdir.lib['sinatra.rb'].read, workflow.libdir.lib['sinatra.rb'].find if workflow.respond_to?(:libdir) and File.exists? workflow.libdir.lib['sinatra.rb']
|
|
43
43
|
|