web-console 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +6 -5
- data/README.markdown +8 -38
- data/lib/web_console.rb +0 -2
- data/lib/web_console/extensions.rb +3 -2
- data/lib/web_console/helper.rb +1 -1
- data/lib/web_console/integration.rb +25 -2
- data/lib/web_console/integration/cruby.rb +18 -35
- data/lib/web_console/integration/rubinius.rb +22 -50
- data/lib/web_console/middleware.rb +24 -37
- data/lib/web_console/railtie.rb +1 -1
- data/lib/web_console/request.rb +3 -3
- data/lib/web_console/templates/console.js.erb +1 -1
- data/lib/web_console/tracer.rb +11 -0
- data/lib/web_console/version.rb +1 -1
- data/lib/web_console/whiny_request.rb +3 -3
- metadata +12 -60
- data/lib/web_console/integration/jruby.rb +0 -111
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ed4f368321b193eeb169e5c5fc82db4b704cbaa
|
4
|
+
data.tar.gz: db55b7d89f828ec70974bd9ed46d19e8509f001c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196f9a54b30873b3838c8798f02803fc850af578812c84cc32bf5faccc7e8decc33cb878048e899d9bf4cf0c13415b52edbd042f19ba9c4654e1a784b1961e59
|
7
|
+
data.tar.gz: 9927a7e855ceeccfca83ca490bacf8392f8c55fedf2291ecc87f17d51437b7eea35cfe04e050ec6f52eee5d14e793248383c4e670904e4253a43ac96c6284541
|
data/CHANGELOG.markdown
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
-
##
|
5
|
+
## 3.0.0
|
6
6
|
|
7
|
-
* [#
|
8
|
-
* [#
|
7
|
+
* [#173](https://github.com/rails/web-console/pull/173) Revert "Change config.development_only default until 4.2.4 is released" ([@gsamokovarov])
|
8
|
+
* [#171](https://github.com/rails/web-console/pull/171) Fixed blocked IP logging ([@gsamokovarov])
|
9
|
+
* [#162](https://github.com/rails/web-console/pull/162) Render the console inside the body tag ([@gsamokovarov])
|
10
|
+
* [#165](https://github.com/rails/web-console/pull/165) Revamped integrations for CRuby and Rubinius ([@gsamokovarov])
|
9
11
|
|
10
12
|
## 2.2.1
|
11
13
|
|
12
|
-
* [#150](https://github.com/rails/web-console/pull/150) Change config.development_only default until 4.2.4 is released
|
14
|
+
* [#150](https://github.com/rails/web-console/pull/150) Change config.development_only default until 4.2.4 is released ([@gsamokovarov])
|
13
15
|
|
14
16
|
## 2.2.0
|
15
17
|
|
@@ -53,4 +55,3 @@
|
|
53
55
|
[@parterburn]: https://github.com/parterburn
|
54
56
|
[@sh19910711]: https://github.com/sh19910711
|
55
57
|
[@frenesim]: https://github.com/frenesim
|
56
|
-
[@schneems]: https://github.com/schneems
|
data/README.markdown
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
<p align=right>
|
2
2
|
Documentation for:
|
3
|
-
<a href=https://github.com/rails/web-console/tree/
|
4
|
-
<a href=https://github.com/rails/web-console/tree/v2.1.0>v2.1.0</a>
|
5
|
-
<a href=https://github.com/rails/web-console/tree/v2.1.1>v2.1.1</a>
|
6
|
-
<a href=https://github.com/rails/web-console/tree/v2.1.2>v2.1.2</a>
|
3
|
+
<a href=https://github.com/rails/web-console/tree/v1.0.4>v1.0.4</a>
|
7
4
|
<a href=https://github.com/rails/web-console/tree/v2.1.3>v2.1.3</a>
|
8
5
|
</p>
|
9
6
|
|
@@ -28,7 +25,7 @@ application, add the following to your `Gemfile`.
|
|
28
25
|
|
29
26
|
```ruby
|
30
27
|
group :development do
|
31
|
-
gem 'web-console', '~>
|
28
|
+
gem 'web-console', '~> 3.0'
|
32
29
|
end
|
33
30
|
```
|
34
31
|
|
@@ -37,35 +34,9 @@ restart your server for the _Web Console_ to kick in.
|
|
37
34
|
|
38
35
|
## Runtime
|
39
36
|
|
40
|
-
_Web Console_ uses [John Mair]'s [binding_of_caller] to spawn a console in a
|
41
|
-
specific binding. This comes at the price of limited Ruby runtime support.
|
42
|
-
|
43
37
|
### CRuby
|
44
38
|
|
45
|
-
CRuby
|
46
|
-
|
47
|
-
### JRuby
|
48
|
-
|
49
|
-
JRuby needs to run in interpreted mode. You can enable it by:
|
50
|
-
|
51
|
-
```bash
|
52
|
-
export JRUBY_OPTS=-J-Djruby.compile.mode=OFF
|
53
|
-
|
54
|
-
# If you run JRuby 1.7.12 and above, you can use:
|
55
|
-
export JRUBY_OPTS=--dev
|
56
|
-
```
|
57
|
-
|
58
|
-
An unstable version of [binding_of_caller] is needed as the latest stable one
|
59
|
-
won't compile on _JRuby_. To install it, put the following in your application
|
60
|
-
`Gemfile`:
|
61
|
-
|
62
|
-
```ruby
|
63
|
-
group :development do
|
64
|
-
gem 'binding_of_caller', '0.7.3.pre1'
|
65
|
-
end
|
66
|
-
```
|
67
|
-
|
68
|
-
Only _JRuby_ 1.7, is supported (no JRuby 9K support at the moment).
|
39
|
+
CRuby 2.2 and below is **not** supported.
|
69
40
|
|
70
41
|
### Rubinius
|
71
42
|
|
@@ -75,7 +46,7 @@ Internal errors like `ZeroDevisionError` aren't caught.
|
|
75
46
|
|
76
47
|
The web console allows you to create an interactive Ruby session in your
|
77
48
|
browser. Those sessions are launched automatically in case on an error, but
|
78
|
-
they can also be launched manually in
|
49
|
+
they can also be launched manually in any page.
|
79
50
|
|
80
51
|
For example, calling `console` in a view will display a console in the current
|
81
52
|
page in the context of the view binding.
|
@@ -215,17 +186,16 @@ Make sure you configuration lives in `config/environments/development.rb`.
|
|
215
186
|
|
216
187
|
## Credits
|
217
188
|
|
218
|
-
* Shoutout to [Charlie Somerville] for [better_errors]
|
219
|
-
* Kudos to [John Mair] for [
|
189
|
+
* Shoutout to [Charlie Somerville] for [better_errors].
|
190
|
+
* Kudos to [John Mair] for [debug_inspector].
|
220
191
|
* Thanks to [Charles Oliver Nutter] for all the _JRuby_ feedback.
|
221
|
-
* Hugs and kisses to all of our [contributors]
|
192
|
+
* Hugs and kisses to all of our [contributors]!
|
222
193
|
|
223
194
|
[better_errors]: https://github.com/charliesome/better_errors
|
224
|
-
[
|
195
|
+
[debug_inspector]: https://github.com/banister/debug_inspector
|
225
196
|
[Charlie Somerville]: https://github.com/charliesome
|
226
197
|
[John Mair]: https://github.com/banister
|
227
198
|
[Charles Oliver Nutter]: https://github.com/headius
|
228
199
|
[templates]: https://github.com/rails/web-console/tree/master/lib/web_console/templates
|
229
|
-
[this]: https://github.com/rails/web-console/blob/master/lib/web_console/integration/cruby.rb#L20-L32
|
230
200
|
[rvt]: https://github.com/gsamokovarov/rvt
|
231
201
|
[contributors]: https://github.com/rails/web-console/graphs/contributors
|
data/lib/web_console.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
ActionDispatch::DebugExceptions.class_eval do
|
2
2
|
def render_exception_with_web_console(request, exception)
|
3
3
|
render_exception_without_web_console(request, exception).tap do
|
4
|
-
# Retain superficial Rails
|
4
|
+
# Retain superficial Rails 4.2 compatibility.
|
5
5
|
env = Hash === request ? request : request.env
|
6
6
|
|
7
|
-
|
7
|
+
backtrace_cleaner = env['action_dispatch.backtrace_cleaner']
|
8
|
+
error = ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception).exception
|
8
9
|
|
9
10
|
# Get the original exception if ExceptionWrapper decides to follow it.
|
10
11
|
env['web_console.exception'] = error
|
data/lib/web_console/helper.rb
CHANGED
@@ -11,7 +11,7 @@ module WebConsole
|
|
11
11
|
def console(binding = nil)
|
12
12
|
raise DoubleRenderError if request.env['web_console.binding']
|
13
13
|
|
14
|
-
request.env['web_console.binding'] = binding || ::
|
14
|
+
request.env['web_console.binding'] = binding || ::WebConsole.caller_bindings.first
|
15
15
|
|
16
16
|
# Make sure nothing is rendered from the view helper. Otherwise
|
17
17
|
# you're gonna see unexpected #<Binding:0x007fee4302b078> in the
|
@@ -1,8 +1,31 @@
|
|
1
|
+
module WebConsole
|
2
|
+
# Returns the Ruby bindings of Kernel#callers locations.
|
3
|
+
#
|
4
|
+
# The list of bindings here doesn't map 1 to 1 with Kernel#callers, as we
|
5
|
+
# can't build Ruby bindings for C functions or the equivalent native
|
6
|
+
# implementations in JRuby and Rubinius.
|
7
|
+
#
|
8
|
+
# This method needs to be overridden by every integration.
|
9
|
+
def self.caller_bindings
|
10
|
+
raise NotImplementedError
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Exception
|
15
|
+
# Returns an array of the exception backtrace locations bindings.
|
16
|
+
#
|
17
|
+
# The list won't map to the traces in #backtrace 1 to 1, because we can't
|
18
|
+
# build bindings for every trace (C functions, for example).
|
19
|
+
#
|
20
|
+
# Every integration should the instance variable.
|
21
|
+
def bindings
|
22
|
+
@bindings || []
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
1
26
|
case RUBY_ENGINE
|
2
27
|
when 'rbx'
|
3
28
|
require 'web_console/integration/rubinius'
|
4
|
-
when 'jruby'
|
5
|
-
require 'web_console/integration/jruby'
|
6
29
|
when 'ruby'
|
7
30
|
require 'web_console/integration/cruby'
|
8
31
|
end
|
@@ -1,40 +1,23 @@
|
|
1
|
-
|
2
|
-
begin
|
3
|
-
# We share the same exception binding extraction mechanism as better_errors,
|
4
|
-
# so try to use it if it is already available. It also solves problems like
|
5
|
-
# charliesome/better_errors#272, caused by an infinite recursion.
|
6
|
-
require 'better_errors'
|
1
|
+
require 'debug_inspector'
|
7
2
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
rescue LoadError
|
13
|
-
# The bindings in which the exception originated in.
|
14
|
-
def bindings
|
15
|
-
@bindings || []
|
16
|
-
end
|
17
|
-
|
18
|
-
# CRuby calls #set_backtrace every time it raises an exception. Overriding
|
19
|
-
# it to assign the #bindings.
|
20
|
-
def set_backtrace_with_binding_of_caller(*args)
|
21
|
-
# Thanks to @charliesome who wrote this bit for better_errors.
|
22
|
-
unless Thread.current[:__web_console_exception_lock]
|
23
|
-
Thread.current[:__web_console_exception_lock] = true
|
24
|
-
begin
|
25
|
-
# Raising an exception here will cause all of the rubies to go into a
|
26
|
-
# stack overflow. Some rubies may even segfault. See
|
27
|
-
# https://bugs.ruby-lang.org/issues/10164 for details.
|
28
|
-
@bindings = binding.callers.drop(1)
|
29
|
-
ensure
|
30
|
-
Thread.current[:__web_console_exception_lock] = false
|
31
|
-
end
|
32
|
-
end
|
3
|
+
def WebConsole.caller_bindings
|
4
|
+
bindings = RubyVM::DebugInspector.open do |context|
|
5
|
+
context.backtrace_locations.each_index.map { |i| context.frame_binding(i) }
|
6
|
+
end
|
33
7
|
|
34
|
-
|
35
|
-
|
8
|
+
# For C functions, we can't extract a binding. In this case,
|
9
|
+
# DebugInspector#frame_binding would have returned us nil. That's why we need
|
10
|
+
# to compact the bindings.
|
11
|
+
#
|
12
|
+
# Dropping two bindings, removes the current Ruby one in this exact method,
|
13
|
+
# and the one in the caller method. The caller method binding can be obtained
|
14
|
+
# by Kernel#binding, if needed.
|
15
|
+
bindings.compact.drop(2)
|
16
|
+
end
|
36
17
|
|
37
|
-
|
38
|
-
|
18
|
+
TracePoint.trace(:raise) do |context|
|
19
|
+
exc = context.raised_exception
|
20
|
+
if exc.bindings.empty?
|
21
|
+
exc.instance_variable_set(:@bindings, WebConsole.caller_bindings)
|
39
22
|
end
|
40
23
|
end
|
@@ -1,62 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# Filters internal Rubinius locations.
|
4
|
-
#
|
5
|
-
# There are a couple of reasons why we wanna filter out the locations.
|
6
|
-
#
|
7
|
-
# * ::Kernel.raise, is implemented in Ruby for Rubinius. We don't wanna
|
8
|
-
# have the frame for it to align with the CRuby and JRuby implementations.
|
9
|
-
#
|
10
|
-
# * For internal methods location variables can be nil. We can't create a
|
11
|
-
# bindings for them.
|
12
|
-
#
|
13
|
-
# * Bindings from the current file are considered internal and ignored.
|
14
|
-
#
|
15
|
-
# We do that all that so we can align the bindings with the backtraces
|
16
|
-
# entries.
|
17
|
-
class InternalLocationFilter
|
18
|
-
def initialize(locations)
|
19
|
-
@locations = locations
|
20
|
-
end
|
1
|
+
def WebConsole.caller_bindings
|
2
|
+
locations = ::Rubinius::VM.backtrace(1, true)
|
21
3
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
# Gets the current bindings for all available Ruby frames.
|
32
|
-
#
|
33
|
-
# Filters the internal Rubinius and WebConsole frames.
|
34
|
-
def self.current_bindings
|
35
|
-
locations = ::Rubinius::VM.backtrace(1, true)
|
36
|
-
|
37
|
-
InternalLocationFilter.new(locations).filter.map do |location|
|
38
|
-
Binding.setup(
|
39
|
-
location.variables,
|
40
|
-
location.variables.method,
|
41
|
-
location.constant_scope,
|
42
|
-
location.variables.self,
|
43
|
-
location
|
44
|
-
)
|
45
|
-
end
|
46
|
-
end
|
4
|
+
# Kernel.raise, is implemented in Ruby for Rubinius. We don't wanna have
|
5
|
+
# the frame for it to align with the CRuby and JRuby implementations.
|
6
|
+
#
|
7
|
+
# For internal methods location variables can be nil. We can't create a
|
8
|
+
# bindings for them.
|
9
|
+
locations.reject! do |location|
|
10
|
+
location.file.start_with?('kernel/delta/kernel.rb') || location.variables.nil?
|
47
11
|
end
|
48
|
-
end
|
49
12
|
|
50
|
-
|
51
|
-
|
52
|
-
|
13
|
+
bindings = locations.map do |location|
|
14
|
+
Binding.setup(
|
15
|
+
location.variables,
|
16
|
+
location.variables.method,
|
17
|
+
location.constant_scope,
|
18
|
+
location.variables.self,
|
19
|
+
location
|
20
|
+
)
|
53
21
|
end
|
22
|
+
|
23
|
+
# Drop the binding of the direct caller. That one can be created by
|
24
|
+
# Kernel#binding.
|
25
|
+
bindings.drop(1)
|
54
26
|
end
|
55
27
|
|
56
28
|
::Rubinius.singleton_class.class_eval do
|
57
29
|
def raise_exception_with_current_bindings(exc)
|
58
30
|
if exc.bindings.empty?
|
59
|
-
exc.instance_variable_set(:@bindings, WebConsole
|
31
|
+
exc.instance_variable_set(:@bindings, WebConsole.caller_bindings)
|
60
32
|
end
|
61
33
|
|
62
34
|
raise_exception_without_current_bindings(exc)
|
@@ -15,47 +15,40 @@ module WebConsole
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def call(env)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
18
|
+
request = create_regular_or_whiny_request(env)
|
19
|
+
return @app.call(env) unless request.from_whitelisted_ip?
|
20
|
+
|
21
|
+
if id = id_for_repl_session_update(request)
|
22
|
+
return update_repl_session(id, request)
|
23
|
+
elsif id = id_for_repl_session_stack_frame_change(request)
|
24
|
+
return change_stack_trace(id, request)
|
25
|
+
end
|
27
26
|
|
28
|
-
|
27
|
+
status, headers, body = @app.call(env)
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
if exception = env['web_console.exception']
|
30
|
+
session = Session.from_exception(exception)
|
31
|
+
elsif binding = env['web_console.binding']
|
32
|
+
session = Session.from_binding(binding)
|
33
|
+
end
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
if session && acceptable_content_type?(headers)
|
36
|
+
response = Response.new(body, status, headers)
|
37
|
+
template = Template.new(env, session)
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
end
|
39
|
+
response.headers["X-Web-Console-Session-Id"] = session.id
|
40
|
+
response.headers["X-Web-Console-Mount-Point"] = mount_point
|
41
|
+
response.write(template.render('index'))
|
42
|
+
response.finish
|
43
|
+
else
|
44
|
+
[ status, headers, body ]
|
47
45
|
end
|
48
|
-
rescue => e
|
49
|
-
WebConsole.logger.error("\n#{e.class}: #{e}\n\tfrom #{e.backtrace.join("\n\tfrom ")}")
|
50
|
-
raise e
|
51
|
-
ensure
|
52
|
-
raise app_exception if Exception === app_exception
|
53
46
|
end
|
54
47
|
|
55
48
|
private
|
56
49
|
|
57
50
|
def acceptable_content_type?(headers)
|
58
|
-
Mime::Type.parse(headers['Content-Type']).first == Mime
|
51
|
+
Mime::Type.parse(headers['Content-Type']).first == Mime[:html]
|
59
52
|
end
|
60
53
|
|
61
54
|
def json_response(opts = {})
|
@@ -127,11 +120,5 @@ module WebConsole
|
|
127
120
|
{ output: I18n.t('errors.unacceptable_request') }
|
128
121
|
end
|
129
122
|
end
|
130
|
-
|
131
|
-
def call_app(env)
|
132
|
-
@app.call(env)
|
133
|
-
rescue => e
|
134
|
-
throw :app_exception, e
|
135
|
-
end
|
136
123
|
end
|
137
124
|
end
|
data/lib/web_console/railtie.rb
CHANGED
@@ -20,7 +20,7 @@ module WebConsole
|
|
20
20
|
initializer 'web_console.development_only' do
|
21
21
|
unless (config.web_console.development_only == false) || Rails.env.development?
|
22
22
|
abort <<-END.strip_heredoc
|
23
|
-
Web Console is activated in the #{Rails.env} environment
|
23
|
+
Web Console is activated in the #{Rails.env} environment. This is
|
24
24
|
usually a mistake. To ensure it's only activated in development
|
25
25
|
mode, move it to the development group of your Gemfile:
|
26
26
|
|
data/lib/web_console/request.rb
CHANGED
@@ -5,14 +5,14 @@ module WebConsole
|
|
5
5
|
cattr_accessor :whitelisted_ips
|
6
6
|
@@whitelisted_ips = Whitelist.new
|
7
7
|
|
8
|
-
# Define a vendor MIME type. We can call it using Mime
|
8
|
+
# Define a vendor MIME type. We can call it using Mime[:web_console_v2].
|
9
9
|
Mime::Type.register 'application/vnd.web-console.v2', :web_console_v2
|
10
10
|
|
11
11
|
# Returns whether a request came from a whitelisted IP.
|
12
12
|
#
|
13
13
|
# For a request to hit Web Console features, it needs to come from a white
|
14
14
|
# listed IP.
|
15
|
-
def
|
15
|
+
def from_whitelisted_ip?
|
16
16
|
whitelisted_ips.include?(strict_remote_ip)
|
17
17
|
end
|
18
18
|
|
@@ -23,7 +23,7 @@ module WebConsole
|
|
23
23
|
|
24
24
|
# Returns whether the request is acceptable.
|
25
25
|
def acceptable?
|
26
|
-
xhr? && accepts.any? { |mime| Mime
|
26
|
+
xhr? && accepts.any? { |mime| Mime[:web_console_v2] == mime }
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
@@ -488,7 +488,7 @@ REPLConsole.request = function request(method, url, params, callback) {
|
|
488
488
|
xhr.open(method, url, true);
|
489
489
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
490
490
|
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
491
|
-
xhr.setRequestHeader("Accept", "<%= Mime
|
491
|
+
xhr.setRequestHeader("Accept", "<%= Mime[:web_console_v2] %>");
|
492
492
|
xhr.send(params);
|
493
493
|
|
494
494
|
xhr.onreadystatechange = function() {
|
data/lib/web_console/version.rb
CHANGED
@@ -4,9 +4,9 @@ module WebConsole
|
|
4
4
|
# If any calls to +from_whitelisted_ip?+ and +acceptable_content_type?+
|
5
5
|
# return false, an info log message will be displayed in users' logs.
|
6
6
|
class WhinyRequest < SimpleDelegator
|
7
|
-
def
|
8
|
-
whine_unless request.
|
9
|
-
"Cannot render console from #{request.
|
7
|
+
def from_whitelisted_ip?
|
8
|
+
whine_unless request.from_whitelisted_ip? do
|
9
|
+
"Cannot render console from #{request.strict_remote_ip}! " \
|
10
10
|
"Allowed networks: #{request.whitelisted_ips}"
|
11
11
|
end
|
12
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web-console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Somerville
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2015-12-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|
@@ -19,90 +19,42 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '4.
|
22
|
+
version: '4.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '4.
|
29
|
+
version: '4.2'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: activemodel
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
34
|
- - ">="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '4.
|
36
|
+
version: '4.2'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '4.
|
43
|
+
version: '4.2'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
|
-
name:
|
45
|
+
name: debug_inspector
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
51
|
-
- - "<"
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '4.0'
|
50
|
+
version: '0'
|
54
51
|
type: :runtime
|
55
52
|
prerelease: false
|
56
53
|
version_requirements: !ruby/object:Gem::Requirement
|
57
54
|
requirements:
|
58
55
|
- - ">="
|
59
56
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
61
|
-
- - "<"
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: '4.0'
|
64
|
-
- !ruby/object:Gem::Dependency
|
65
|
-
name: binding_of_caller
|
66
|
-
requirement: !ruby/object:Gem::Requirement
|
67
|
-
requirements:
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 0.7.2
|
71
|
-
type: :runtime
|
72
|
-
prerelease: false
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - ">="
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 0.7.2
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: actionmailer
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - ">="
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '4.0'
|
85
|
-
type: :development
|
86
|
-
prerelease: false
|
87
|
-
version_requirements: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - ">="
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '4.0'
|
92
|
-
- !ruby/object:Gem::Dependency
|
93
|
-
name: activerecord
|
94
|
-
requirement: !ruby/object:Gem::Requirement
|
95
|
-
requirements:
|
96
|
-
- - ">="
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: '4.0'
|
99
|
-
type: :development
|
100
|
-
prerelease: false
|
101
|
-
version_requirements: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '4.0'
|
57
|
+
version: '0'
|
106
58
|
description:
|
107
59
|
email:
|
108
60
|
- charlie@charliesomerville.com
|
@@ -125,7 +77,6 @@ files:
|
|
125
77
|
- lib/web_console/helper.rb
|
126
78
|
- lib/web_console/integration.rb
|
127
79
|
- lib/web_console/integration/cruby.rb
|
128
|
-
- lib/web_console/integration/jruby.rb
|
129
80
|
- lib/web_console/integration/rubinius.rb
|
130
81
|
- lib/web_console/locales/en.yml
|
131
82
|
- lib/web_console/middleware.rb
|
@@ -149,6 +100,7 @@ files:
|
|
149
100
|
- lib/web_console/testing/erb_precompiler.rb
|
150
101
|
- lib/web_console/testing/fake_middleware.rb
|
151
102
|
- lib/web_console/testing/helper.rb
|
103
|
+
- lib/web_console/tracer.rb
|
152
104
|
- lib/web_console/version.rb
|
153
105
|
- lib/web_console/view.rb
|
154
106
|
- lib/web_console/whiny_request.rb
|
@@ -165,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
117
|
requirements:
|
166
118
|
- - ">="
|
167
119
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
120
|
+
version: 2.2.2
|
169
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
122
|
requirements:
|
171
123
|
- - ">="
|
@@ -173,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
125
|
version: '0'
|
174
126
|
requirements: []
|
175
127
|
rubyforge_project:
|
176
|
-
rubygems_version: 2.5
|
128
|
+
rubygems_version: 2.4.5
|
177
129
|
signing_key:
|
178
130
|
specification_version: 4
|
179
131
|
summary: A debugging tool for your Ruby on Rails applications.
|
@@ -1,111 +0,0 @@
|
|
1
|
-
require 'English'
|
2
|
-
require 'active_support/core_ext/string/strip'
|
3
|
-
|
4
|
-
java_import org.jruby.RubyInstanceConfig
|
5
|
-
|
6
|
-
module WebConsole
|
7
|
-
module JRuby
|
8
|
-
class << self
|
9
|
-
# Returns whether JRuby is ran in interpreted mode.
|
10
|
-
def interpreted_mode?
|
11
|
-
compile_mode = ::JRuby.runtime.instance_config.compile_mode
|
12
|
-
interpreted_mode = RubyInstanceConfig::CompileMode::OFF
|
13
|
-
|
14
|
-
compile_mode == interpreted_mode
|
15
|
-
end
|
16
|
-
|
17
|
-
# A proc to be used in Kernel#set_trace_func.
|
18
|
-
#
|
19
|
-
# It sets Exception#bindings for an error with all the bindings the
|
20
|
-
# current ThreadContext contains.
|
21
|
-
def set_exception_bindings_trace_func
|
22
|
-
proc do |event, file, line, id, binding, classname|
|
23
|
-
case event
|
24
|
-
when 'raise'
|
25
|
-
if $ERROR_INFO.bindings.empty?
|
26
|
-
# binding_of_caller will generate an improperly built binding at
|
27
|
-
# caller[1]. Every call to a non existent method, constant or a
|
28
|
-
# local variable will result in a Java NullPointerException.
|
29
|
-
#
|
30
|
-
# The binding that Kernel#set_trace_func is giving us is properly
|
31
|
-
# built, so we can use in place of the broken one.
|
32
|
-
bindings = ::Kernel.binding.callers.drop(2).unshift(binding)
|
33
|
-
$ERROR_INFO.instance_variable_set(:@bindings, bindings)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# A fake binding for JRuby in non interpreted mode.
|
41
|
-
#
|
42
|
-
# It won't actually evaluate any code, rather it will tell the user how to
|
43
|
-
# enable interpreted mode.
|
44
|
-
class FakeJRubyBinding
|
45
|
-
TURN_ON_INTERPRETED_MODE_TEXT = <<-END.strip_heredoc
|
46
|
-
JRuby needs to run in interpreted mode for introspection support.
|
47
|
-
|
48
|
-
To turn on interpreted mode, put -J-Djruby.compile.mode=OFF in the
|
49
|
-
JRUBY_OPTS environment variable.
|
50
|
-
END
|
51
|
-
|
52
|
-
def TURN_ON_INTERPRETED_MODE_TEXT.inspect
|
53
|
-
self
|
54
|
-
end
|
55
|
-
|
56
|
-
TURN_ON_INTERPRETED_MODE_TEXT.freeze
|
57
|
-
|
58
|
-
def eval(*)
|
59
|
-
TURN_ON_INTERPRETED_MODE_TEXT
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# A fake array of FakeJRubyBinding objects.
|
64
|
-
#
|
65
|
-
# It is used in Exception#bindings to make sure that when users switch
|
66
|
-
# bindings on the UI, they get a FakeJRubyBinding notifying them what to do
|
67
|
-
# if they want introspection.
|
68
|
-
class FakeJRubyBindingsArray < Array
|
69
|
-
def [](*)
|
70
|
-
FakeJRubyBinding.new
|
71
|
-
end
|
72
|
-
|
73
|
-
# For Kernel#Array and other implicit conversion API. JRuby expects it to
|
74
|
-
# return an object that is_a? an Array. This is the reasoning of
|
75
|
-
# FakeJRubyBindingsArray being a subclass of Array.
|
76
|
-
def to_ary
|
77
|
-
self
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
if WebConsole::JRuby.interpreted_mode?
|
84
|
-
::Exception.class_eval do
|
85
|
-
def bindings
|
86
|
-
@bindings || []
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
# Kernel#set_trace_func will complain about not being able to capture all the
|
91
|
-
# events without the JRuby --debug flag.
|
92
|
-
silence_warnings do
|
93
|
-
set_trace_func WebConsole::JRuby.set_exception_bindings_trace_func
|
94
|
-
end
|
95
|
-
else
|
96
|
-
::Exception.class_eval do
|
97
|
-
def bindings
|
98
|
-
WebConsole::JRuby::FakeJRubyBindingsArray.new
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
::Binding.class_eval do
|
103
|
-
def of_caller(*)
|
104
|
-
WebConsole::JRuby::FakeJRubyBinding.new
|
105
|
-
end
|
106
|
-
|
107
|
-
def callers
|
108
|
-
WebConsole::JRuby::FakeJRubyBindingsArray.new
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|