rack-webconsole 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +3 -2
- data/Gemfile.lock +1 -1
- data/History +4 -0
- data/lib/rack/webconsole/assets.rb +6 -3
- data/lib/rack/webconsole/version.rb +1 -1
- data/public/webconsole.js +1 -1
- data/spec/rack/webconsole/assets_spec.rb +4 -2
- metadata +9 -3
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/History
CHANGED
@@ -39,7 +39,7 @@ module Rack
|
|
39
39
|
Webconsole::Repl.request = Rack::Request.new(env)
|
40
40
|
|
41
41
|
# Inject the html, css and js code to the view
|
42
|
-
response_body.gsub!('</body>', "#{code}</body>")
|
42
|
+
response_body.gsub!('</body>', "#{code(env)}</body>")
|
43
43
|
|
44
44
|
headers['Content-Length'] = response_body.bytesize.to_s
|
45
45
|
|
@@ -53,10 +53,13 @@ module Rack
|
|
53
53
|
# secure.
|
54
54
|
#
|
55
55
|
# @return [String] the injectable code.
|
56
|
-
def code
|
56
|
+
def code(env)
|
57
57
|
html_code <<
|
58
58
|
css_code <<
|
59
|
-
render(js_code,
|
59
|
+
render(js_code,
|
60
|
+
:TOKEN => Webconsole::Repl.token,
|
61
|
+
:KEY_CODE => Webconsole.key_code,
|
62
|
+
:CONTEXT => env['SCRIPT_NAME'] || "")
|
60
63
|
end
|
61
64
|
|
62
65
|
private
|
data/public/webconsole.js
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
webconsole.history.push(webconsole.query.val());
|
25
25
|
webconsole.pointer = webconsole.history.length - 1;
|
26
26
|
$.ajax({
|
27
|
-
url: '/webconsole',
|
27
|
+
url: '$CONTEXT/webconsole',
|
28
28
|
type: 'POST',
|
29
29
|
dataType: 'json',
|
30
30
|
data: ({query: webconsole.query.val(), token: "$TOKEN"}),
|
@@ -12,16 +12,18 @@ module Rack
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#code" do
|
15
|
-
it 'injects the token and
|
15
|
+
it 'injects the token, key_code, and context path' do
|
16
16
|
Webconsole::Repl.stubs(:token).returns('fake_generated_token')
|
17
17
|
Webconsole.key_code = "96"
|
18
18
|
|
19
19
|
@assets = Webconsole::Assets.new(nil)
|
20
|
-
assets_code = @assets.code
|
20
|
+
assets_code = @assets.code('SCRIPT_NAME' => '/hambiscuit')
|
21
21
|
|
22
22
|
assets_code.must_match /fake_generated_token/
|
23
23
|
assets_code.must_match /event\.which == 96/
|
24
|
+
assets_code.must_match %r{/hambiscuit/webconsole}
|
24
25
|
end
|
26
|
+
|
25
27
|
end
|
26
28
|
|
27
29
|
describe "#call" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-webconsole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rack
|
@@ -205,15 +205,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
205
|
- - ! '>='
|
206
206
|
- !ruby/object:Gem::Version
|
207
207
|
version: '0'
|
208
|
+
segments:
|
209
|
+
- 0
|
210
|
+
hash: 1337753541622784127
|
208
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
212
|
none: false
|
210
213
|
requirements:
|
211
214
|
- - ! '>='
|
212
215
|
- !ruby/object:Gem::Version
|
213
216
|
version: '0'
|
217
|
+
segments:
|
218
|
+
- 0
|
219
|
+
hash: 1337753541622784127
|
214
220
|
requirements: []
|
215
221
|
rubyforge_project: rack-webconsole
|
216
|
-
rubygems_version: 1.8.
|
222
|
+
rubygems_version: 1.8.24
|
217
223
|
signing_key:
|
218
224
|
specification_version: 3
|
219
225
|
summary: Rack-based console inside your web applications
|