web-console 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +1 -1
- data/lib/web_console.rb +1 -0
- data/lib/web_console/exception_mapper.rb +33 -0
- data/lib/web_console/session.rb +4 -8
- data/lib/web_console/version.rb +1 -1
- metadata +3 -3
- data/lib/web_console/mapper.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf5732bddc2528664e5567694ec06c4c4a6c0fab
|
4
|
+
data.tar.gz: 302c11d030141cde9b568ff1a5c50f6f3cdbead9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd24a5c51ea68a52e01adb457a16a716b5b3d608f9e817f1bc8c0123ed688029f54363cebcca80eafe2d11e300cae467880d3536e89d21ca088e8513b78b95f0
|
7
|
+
data.tar.gz: 36b4e435412d84bbea06f5a3cda46a90a3cb440a0e6eb2f603649042be804d2760fa043e3ab319b3a060b12a46f83d064e10d7263eeea9cdc3ab58d9f9d4719c
|
data/README.markdown
CHANGED
data/lib/web_console.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
module WebConsole
|
2
|
+
class ExceptionMapper
|
3
|
+
def initialize(exception)
|
4
|
+
@backtrace = exception.backtrace
|
5
|
+
@bindings = exception.bindings
|
6
|
+
end
|
7
|
+
|
8
|
+
def first
|
9
|
+
guess_the_first_application_binding || @bindings.first
|
10
|
+
end
|
11
|
+
|
12
|
+
def [](index)
|
13
|
+
guess_binding_for_index(index) || @bindings[index]
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def guess_binding_for_index(index)
|
19
|
+
file, line = @backtrace[index].to_s.split(':')
|
20
|
+
line = line.to_i
|
21
|
+
|
22
|
+
@bindings.find do |binding|
|
23
|
+
binding.eval('__FILE__') == file && binding.eval('__LINE__') == line
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def guess_the_first_application_binding
|
28
|
+
@bindings.find do |binding|
|
29
|
+
binding.eval('__FILE__').to_s.start_with?(Rails.root.to_s)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/web_console/session.rb
CHANGED
@@ -30,9 +30,9 @@ module WebConsole
|
|
30
30
|
# storage.
|
31
31
|
def from(storage)
|
32
32
|
if exc = storage[:__web_console_exception]
|
33
|
-
new(exc
|
33
|
+
new(ExceptionMapper.new(exc))
|
34
34
|
elsif binding = storage[:__web_console_binding]
|
35
|
-
new(binding)
|
35
|
+
new([binding])
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -42,8 +42,8 @@ module WebConsole
|
|
42
42
|
|
43
43
|
def initialize(bindings)
|
44
44
|
@id = SecureRandom.hex(16)
|
45
|
-
@bindings =
|
46
|
-
@evaluator = Evaluator.new(
|
45
|
+
@bindings = bindings
|
46
|
+
@evaluator = Evaluator.new(bindings.first)
|
47
47
|
|
48
48
|
store_into_memory
|
49
49
|
end
|
@@ -64,10 +64,6 @@ module WebConsole
|
|
64
64
|
|
65
65
|
private
|
66
66
|
|
67
|
-
def application_binding
|
68
|
-
@bindings.find { |b| b.eval('__FILE__').to_s.start_with?(Rails.root.to_s) }
|
69
|
-
end
|
70
|
-
|
71
67
|
def store_into_memory
|
72
68
|
inmemory_storage[id] = self
|
73
69
|
end
|
data/lib/web_console/version.rb
CHANGED
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: 3.
|
4
|
+
version: 3.3.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: 2016-06-
|
14
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: railties
|
@@ -73,12 +73,12 @@ files:
|
|
73
73
|
- lib/web_console.rb
|
74
74
|
- lib/web_console/errors.rb
|
75
75
|
- lib/web_console/evaluator.rb
|
76
|
+
- lib/web_console/exception_mapper.rb
|
76
77
|
- lib/web_console/extensions.rb
|
77
78
|
- lib/web_console/integration.rb
|
78
79
|
- lib/web_console/integration/cruby.rb
|
79
80
|
- lib/web_console/integration/rubinius.rb
|
80
81
|
- lib/web_console/locales/en.yml
|
81
|
-
- lib/web_console/mapper.rb
|
82
82
|
- lib/web_console/middleware.rb
|
83
83
|
- lib/web_console/railtie.rb
|
84
84
|
- lib/web_console/request.rb
|
data/lib/web_console/mapper.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module WebConsole
|
2
|
-
class Mapper
|
3
|
-
def initialize(exception)
|
4
|
-
@exception = exception
|
5
|
-
@bindings = exception.bindings
|
6
|
-
end
|
7
|
-
|
8
|
-
def [](index)
|
9
|
-
trace = @exception.backtrace[index]
|
10
|
-
file, line = trace.to_s.strip(':')
|
11
|
-
@bindings.find { |b| b.eval('__FILE__') == file && b.eval('__LINE__') == line }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|