rack-webconsole 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-webconsole (0.1.0)
4
+ rack-webconsole (0.1.1)
5
5
  json
6
6
  rack
7
7
 
data/History CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.1.1 / 2011-07-27
2
+
3
+ ! Fix bug with Content-Length not being calculated appropriately. (Corin Langosch)
4
+ + Refactor JavaScript to avoid messing with prototypes (Corin Langosch)
5
+
1
6
  === 0.1.0 / 2011-07-27
2
7
 
3
8
  + The request object is now exposed in the console through #request method
@@ -41,7 +41,7 @@ module Rack
41
41
  # Inject the html, css and js code to the view
42
42
  response_body.gsub!('</body>', "#{code}</body>")
43
43
 
44
- headers['Content-Length'] = (response_body.length + 2).to_s
44
+ headers['Content-Length'] = response_body.bytesize.to_s
45
45
 
46
46
  [status, headers, [response_body]]
47
47
  end
@@ -90,7 +90,7 @@ module Rack
90
90
  response_body = {:result => result}.to_json
91
91
  headers = {}
92
92
  headers['Content-Type'] = 'application/json'
93
- headers['Content-Length'] = response_body.length.to_s
93
+ headers['Content-Length'] = response_body.bytesize.to_s
94
94
  [200, headers, [response_body]]
95
95
  end
96
96
 
@@ -2,6 +2,6 @@
2
2
  module Rack
3
3
  class Webconsole
4
4
  # rack-webconsole version number.
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
data/public/webconsole.js CHANGED
@@ -1,35 +1,17 @@
1
- $(document).ready(function() {
2
- $("#rack-webconsole").hide();
3
- $(this).keypress(function(event) {
4
- if (event.which == 96) {
5
- $("#rack-webconsole").slideToggle('fast', function() {
6
- if ($(this).is(':visible')) {
7
- $("#rack-webconsole form input").focus();
8
- $("#rack-webconsole .results_wrapper").scrollTop(
9
- $("#rack-webconsole .results").height()
10
- );
11
- } else {
12
- $("#rack-webconsole form input").blur();
13
- }
14
- });
15
- event.preventDefault();
16
- }
17
- });
18
- });
19
1
  $('#rack-webconsole form').submit(function(e){
20
- e.preventDefault();
2
+ e.preventDefault();
21
3
  });
22
- String.prototype.escapeHTML = function () {
23
- return(
24
- this.replace(/&/g,'&amp;').
25
- replace(/>/g,'&gt;').
26
- replace(/</g,'&lt;').
27
- replace(/"/g,'&quot;')
28
- );
29
- };
30
4
 
31
5
  $("#rack-webconsole form input").keyup(function(event) {
32
- if(event.which == 13) {
6
+ function escapeHTML(string) {
7
+ return(string.replace(/&/g,'&amp;').
8
+ replace(/>/g,'&gt;').
9
+ replace(/</g,'&lt;').
10
+ replace(/"/g,'&quot;')
11
+ );
12
+ };
13
+
14
+ if (event.which == 13) {
33
15
  /*$.post('/webconsole', $("#rack-webconsole form").serialize());*/
34
16
  var query = $("#query").val();
35
17
  $.ajax({
@@ -38,14 +20,34 @@ $("#rack-webconsole form input").keyup(function(event) {
38
20
  dataType: 'json',
39
21
  data: ({query: query, token: "TOKEN"}),
40
22
  success: function (data) {
41
- var q = "<div class='query'>>> " + query.escapeHTML() + "</div>";
42
- var r = "<div class='result'>=> " + data.result.escapeHTML() + "</div>";
23
+ var q = "<div class='query'>" + escapeHTML(">> " + query) + "</div>";
24
+ var r = "<div class='result'>" + escapeHTML("=> " + data.result) + "</div>";
43
25
  $("#rack-webconsole .results").append(q + r);
44
26
  $("#rack-webconsole .results_wrapper").scrollTop(
45
27
  $("#rack-webconsole .results").height()
46
- );
28
+ );
47
29
  $("#query").val('');
48
30
  }
49
31
  });
50
32
  }
51
33
  });
34
+
35
+ $(document).ready(function() {
36
+ $("#rack-webconsole").hide();
37
+ $(this).keypress(function(event) {
38
+ if (event.which == 96) {
39
+ $("#rack-webconsole").slideToggle('fast', function() {
40
+ if ($(this).is(':visible')) {
41
+ $("#rack-webconsole form input").focus();
42
+ $("#rack-webconsole .results_wrapper").scrollTop(
43
+ $("#rack-webconsole .results").height()
44
+ );
45
+ } else {
46
+ $("#rack-webconsole form input").blur();
47
+ }
48
+ });
49
+ event.preventDefault();
50
+ }
51
+ });
52
+ });
53
+
metadata CHANGED
@@ -1,147 +1,114 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rack-webconsole
3
- version: !ruby/object:Gem::Version
4
- hash: 27
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Josep M. Bach
14
9
  - Josep Jaume Rey
15
10
  - Oriol Gual
16
11
  autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
-
20
- date: 2011-07-27 00:00:00 +02:00
14
+ date: 2011-07-27 00:00:00.000000000 +02:00
21
15
  default_executable:
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
33
- prerelease: false
34
- type: :runtime
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
35
18
  name: rack
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- requirement: &id002 !ruby/object:Gem::Requirement
19
+ requirement: &2170028480 !ruby/object:Gem::Requirement
39
20
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
47
- prerelease: false
21
+ requirements:
22
+ - - ! '>='
23
+ - !ruby/object:Gem::Version
24
+ version: '0'
48
25
  type: :runtime
26
+ prerelease: false
27
+ version_requirements: *2170028480
28
+ - !ruby/object:Gem::Dependency
49
29
  name: json
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- requirement: &id003 !ruby/object:Gem::Requirement
30
+ requirement: &2170027860 !ruby/object:Gem::Requirement
53
31
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ type: :runtime
61
37
  prerelease: false
62
- type: :development
38
+ version_requirements: *2170027860
39
+ - !ruby/object:Gem::Dependency
63
40
  name: minitest
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- requirement: &id004 !ruby/object:Gem::Requirement
41
+ requirement: &2170027360 !ruby/object:Gem::Requirement
67
42
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
75
- prerelease: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
76
47
  type: :development
48
+ prerelease: false
49
+ version_requirements: *2170027360
50
+ - !ruby/object:Gem::Dependency
77
51
  name: purdytest
78
- version_requirements: *id004
79
- - !ruby/object:Gem::Dependency
80
- requirement: &id005 !ruby/object:Gem::Requirement
52
+ requirement: &2170026920 !ruby/object:Gem::Requirement
81
53
  none: false
82
- requirements:
83
- - - ">="
84
- - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
- version: "0"
89
- prerelease: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
90
58
  type: :development
59
+ prerelease: false
60
+ version_requirements: *2170026920
61
+ - !ruby/object:Gem::Dependency
91
62
  name: mocha
92
- version_requirements: *id005
93
- - !ruby/object:Gem::Dependency
94
- requirement: &id006 !ruby/object:Gem::Requirement
63
+ requirement: &2170026420 !ruby/object:Gem::Requirement
95
64
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
- version: "0"
103
- prerelease: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
104
69
  type: :development
70
+ prerelease: false
71
+ version_requirements: *2170026420
72
+ - !ruby/object:Gem::Dependency
105
73
  name: yard
106
- version_requirements: *id006
107
- - !ruby/object:Gem::Dependency
108
- requirement: &id007 !ruby/object:Gem::Requirement
74
+ requirement: &2170025580 !ruby/object:Gem::Requirement
109
75
  none: false
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
- version: "0"
117
- prerelease: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
118
80
  type: :development
81
+ prerelease: false
82
+ version_requirements: *2170025580
83
+ - !ruby/object:Gem::Dependency
119
84
  name: bluecloth
120
- version_requirements: *id007
121
- - !ruby/object:Gem::Dependency
122
- requirement: &id008 !ruby/object:Gem::Requirement
85
+ requirement: &2170023940 !ruby/object:Gem::Requirement
123
86
  none: false
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- hash: 3
128
- segments:
129
- - 0
130
- version: "0"
131
- prerelease: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
132
91
  type: :development
92
+ prerelease: false
93
+ version_requirements: *2170023940
94
+ - !ruby/object:Gem::Dependency
133
95
  name: rake
134
- version_requirements: *id008
96
+ requirement: &2170022320 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: *2170022320
135
105
  description: Rack-based console inside your web applications
136
- email:
106
+ email:
137
107
  - info@codegram.com
138
108
  executables: []
139
-
140
109
  extensions: []
141
-
142
110
  extra_rdoc_files: []
143
-
144
- files:
111
+ files:
145
112
  - .gitignore
146
113
  - .rvmrc
147
114
  - .travis.yml
@@ -172,38 +139,35 @@ files:
172
139
  has_rdoc: true
173
140
  homepage: http://github.com/codegram/rack-webconsole
174
141
  licenses: []
175
-
176
142
  post_install_message:
177
143
  rdoc_options: []
178
-
179
- require_paths:
144
+ require_paths:
180
145
  - lib
181
- required_ruby_version: !ruby/object:Gem::Requirement
146
+ required_ruby_version: !ruby/object:Gem::Requirement
182
147
  none: false
183
- requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- hash: 3
187
- segments:
148
+ requirements:
149
+ - - ! '>='
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ segments:
188
153
  - 0
189
- version: "0"
190
- required_rubygems_version: !ruby/object:Gem::Requirement
154
+ hash: -4524250854472631456
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
156
  none: false
192
- requirements:
193
- - - ">="
194
- - !ruby/object:Gem::Version
195
- hash: 3
196
- segments:
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ segments:
197
162
  - 0
198
- version: "0"
163
+ hash: -4524250854472631456
199
164
  requirements: []
200
-
201
165
  rubyforge_project: rack-webconsole
202
- rubygems_version: 1.6.0
166
+ rubygems_version: 1.6.2
203
167
  signing_key:
204
168
  specification_version: 3
205
169
  summary: Rack-based console inside your web applications
206
- test_files:
170
+ test_files:
207
171
  - spec/rack/webconsole/asset_helpers_spec.rb
208
172
  - spec/rack/webconsole/assets_spec.rb
209
173
  - spec/rack/webconsole/repl_spec.rb