rails-web-console 0.3.2 → 0.4.0
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c329cfda8e600624144d9ec01945ee6581aed4bd
|
4
|
+
data.tar.gz: 7c4086adfe3931c4d429dd69d39ed1c4da86a290
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21abd1e7fb7e0bc395245d1d66c8da1c487645ee5443a1ea5f71ccdc9d0d82072a444d709164fb0f220420c02b7a4b3de99b9602da3c8b0ed29313e6223ca59a
|
7
|
+
data.tar.gz: c6e85625b053d725b51ff3d31cc26f894b06eeb92b09609b76ce337dcefa2d72255bfb9cd94bc8a90a4dc2422b7628071505a13903e0f747141f7269ec9ac44a
|
@@ -11,16 +11,26 @@ module RailsWebConsole
|
|
11
11
|
def index
|
12
12
|
end
|
13
13
|
|
14
|
+
SCRIPT_LIMIT = defined?(::WEB_CONSOLE_SCRIPT_LIMIT) ? ::WEB_CONSOLE_SCRIPT_LIMIT : 1000
|
15
|
+
WARNING_LIMIT_MSG = "WARNING: stored script in session was limited to the first " +
|
16
|
+
"#{SCRIPT_LIMIT} chars to avoid issues with cookie overflow\n"
|
14
17
|
def run
|
15
|
-
|
18
|
+
# we limit up to 1k to avoid ActionDispatch::Cookies::CookieOverflow (4k) which we
|
19
|
+
# can't rescue since it happens in a middleware
|
20
|
+
script = params[:script]
|
21
|
+
# we allow users to ignore the limit if they are using another session storage mechanism
|
22
|
+
script = script[0...SCRIPT_LIMIT] unless defined?(::WEB_CONSOLE_IGNORE_SCRIPT_LIMIT)
|
23
|
+
session[:script] = script
|
16
24
|
stdout_orig = $stdout
|
17
25
|
$stdout = StringIO.new
|
18
26
|
begin
|
27
|
+
puts WARNING_LIMIT_MSG if params[:script].size > SCRIPT_LIMIT &&
|
28
|
+
!defined?(::WEB_CONSOLE_IGNORE_SCRIPT_LIMIT)
|
19
29
|
result_eval = eval params[:script], binding
|
20
30
|
$stdout.rewind
|
21
31
|
result = %Q{<div class="stdout">#{escape $stdout.read}</div>
|
22
32
|
<div class="return">#{escape result_eval.inspect}</div>}
|
23
|
-
rescue => e
|
33
|
+
rescue Exception => e
|
24
34
|
result = e.to_s
|
25
35
|
end
|
26
36
|
$stdout = stdout_orig
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-web-console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Rosenfeld Rosas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|