rack-webconsole 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-webconsole (0.1.1)
4
+ rack-webconsole (0.1.2)
5
5
  json
6
6
  rack
7
7
 
data/History CHANGED
@@ -1,3 +1,10 @@
1
+ === 0.1.2 / 2011-08-01
2
+
3
+ + Change field name to avoid conflicts with other forms (Chris Apolzon)
4
+ + Prevent visual flash of unstyled content (Rob Cameron)
5
+ + Fix minor styling issues (Jeff Kreeftmeijer)
6
+ + Avoid conflicts with libraries other than JQuery (Jo Liss)
7
+
1
8
  === 0.1.1 / 2011-07-27
2
9
 
3
10
  ! Fix bug with Content-Length not being calculated appropriately. (Corin Langosch)
data/Readme.md CHANGED
@@ -27,7 +27,9 @@ protect against cross-site request forgery.
27
27
 
28
28
  In your Gemfile:
29
29
 
30
- gem 'rack-webconsole'
30
+ ```ruby
31
+ gem 'rack-webconsole'
32
+ ```
31
33
 
32
34
  Rack-webconsole **needs JQuery**. If you are using Rails 3, JQuery is loaded by
33
35
  default. In case you don't want to use JQuery in your application,
@@ -35,7 +37,9 @@ default. In case you don't want to use JQuery in your application,
35
37
  should put this line somewhere in your application (a Rails initializer, or
36
38
  some configuration file):
37
39
 
38
- Rack::Webconsole.inject_jquery = true
40
+ ```ruby
41
+ Rack::Webconsole.inject_jquery = true
42
+ ```
39
43
 
40
44
  ##Usage with Rails 3
41
45
 
@@ -48,24 +52,34 @@ the console will show :)
48
52
  With Sinatra and Padrino you have to tell your application to use the
49
53
  middleware:
50
54
 
51
- require 'sinatra'
52
- require 'rack/webconsole'
55
+ ```ruby
56
+ require 'sinatra'
57
+ require 'rack/webconsole'
53
58
 
54
- class MySinatraApp < Sinatra::Application
55
- use Rack::Webconsole
56
- # . . .
57
- end
59
+ class MySinatraApp < Sinatra::Application
60
+ use Rack::Webconsole
61
+ # . . .
62
+ end
58
63
 
59
- class SamplePadrino < Padrino::Application
60
- use Rack::Webconsole
61
- # . . .
62
- end
64
+ class SamplePadrino < Padrino::Application
65
+ use Rack::Webconsole
66
+ # . . .
67
+ end
68
+ ```
63
69
 
64
70
  NOTE: If you are using Bundler and initializing it from config.ru, you don't
65
71
  have to `require 'rack/webconsole'` manually, otherwise you have to.
66
72
 
67
73
  And it works! Fire up the server, go to any page and press the ` ` ` key.
68
74
 
75
+ ##Usage with Rails 2
76
+
77
+ You need to add the following code to an intializer (i.e. config/initializers/webconsole.rb):
78
+
79
+ ```ruby
80
+ require 'rack/webconsole'
81
+ ActionController::Dispatcher.middleware.insert_after 1, Rack::Webconsole
82
+ ```
69
83
 
70
84
  ##Commands
71
85
 
@@ -88,9 +102,9 @@ You can also build the documentation with the following command:
88
102
 
89
103
  * Fork the project.
90
104
  * Make your feature addition or bug fix.
91
- * Add tests for it. This is important so I don't break it in a
105
+ * Add tests for it. This is important so we don't break it in a
92
106
  future version unintentionally.
93
- * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
107
+ * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself we can ignore when we pull)
94
108
  * Send us a pull request. Bonus points for topic branches.
95
109
 
96
110
  ## Copyright
@@ -2,6 +2,6 @@
2
2
  module Rack
3
3
  class Webconsole
4
4
  # rack-webconsole version number.
5
- VERSION = "0.1.1"
5
+ VERSION = "0.1.2"
6
6
  end
7
7
  end
@@ -38,14 +38,14 @@
38
38
  color: #FFF;
39
39
  }
40
40
  #rack-webconsole form div.results_wrapper{
41
- height: 100%;
42
41
  width: 100%;
43
42
  position: absolute;
44
43
  overflow-x: auto;
44
+ top: 0;
45
+ bottom: 40px;
45
46
  }
46
47
  #rack-webconsole form div.results{
47
48
  padding: 10px;
48
- padding-bottom: 40px;
49
49
  }
50
50
  #rack-webconsole .prompt{
51
51
  width: 30px;
@@ -59,8 +59,6 @@
59
59
  width: 100%;
60
60
  position: absolute;
61
61
  bottom: 0px;
62
- height: 30px;
63
- padding-top: 10px;
64
62
  background: #000;
65
63
  }
66
64
  #rack-webconsole form div.input input{
@@ -69,6 +67,7 @@
69
67
  box-sizing: border-box;
70
68
  margin-top: 0px;
71
69
  margin-bottom: 0px;
70
+ padding: 0px;
72
71
  width: 100%;
73
72
  font-size: 14px;
74
73
  background: transparent;
@@ -1,4 +1,4 @@
1
- <div id="rack-webconsole">
1
+ <div id="rack-webconsole" style="display:none">
2
2
  <form accept-charset="UTF-8" action="/webconsole" method="post">
3
3
  <input name="utf8" type="hidden" value="✓"/>
4
4
  <div class="results_wrapper">
@@ -8,7 +8,7 @@
8
8
  <div class="input">
9
9
  <span class="prompt">>></span>
10
10
  <span class="input_box">
11
- <input id="query" name="query" type="text" />
11
+ <input id="webconsole_query" name="webconsole_query" type="text" />
12
12
  </div>
13
13
  </div>
14
14
  </form>
@@ -1,53 +1,53 @@
1
- $('#rack-webconsole form').submit(function(e){
2
- e.preventDefault();
3
- });
4
-
5
- $("#rack-webconsole form input").keyup(function(event) {
6
- function escapeHTML(string) {
7
- return(string.replace(/&/g,'&amp;').
8
- replace(/>/g,'&gt;').
9
- replace(/</g,'&lt;').
10
- replace(/"/g,'&quot;')
11
- );
12
- };
1
+ (function($) {
2
+ $('#rack-webconsole form').submit(function(e){
3
+ e.preventDefault();
4
+ });
13
5
 
14
- if (event.which == 13) {
15
- /*$.post('/webconsole', $("#rack-webconsole form").serialize());*/
16
- var query = $("#query").val();
17
- $.ajax({
18
- url: '/webconsole',
19
- type: 'POST',
20
- dataType: 'json',
21
- data: ({query: query, token: "TOKEN"}),
22
- success: function (data) {
23
- var q = "<div class='query'>" + escapeHTML(">> " + query) + "</div>";
24
- var r = "<div class='result'>" + escapeHTML("=> " + data.result) + "</div>";
25
- $("#rack-webconsole .results").append(q + r);
26
- $("#rack-webconsole .results_wrapper").scrollTop(
27
- $("#rack-webconsole .results").height()
28
- );
29
- $("#query").val('');
30
- }
31
- });
32
- }
33
- });
6
+ $("#rack-webconsole form input").keyup(function(event) {
7
+ function escapeHTML(string) {
8
+ return(string.replace(/&/g,'&amp;').
9
+ replace(/>/g,'&gt;').
10
+ replace(/</g,'&lt;').
11
+ replace(/"/g,'&quot;')
12
+ );
13
+ };
34
14
 
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();
15
+ if (event.which == 13) {
16
+ /*$.post('/webconsole', $("#rack-webconsole form").serialize());*/
17
+ var query = $("#webconsole_query").val();
18
+ $.ajax({
19
+ url: '/webconsole',
20
+ type: 'POST',
21
+ dataType: 'json',
22
+ data: ({query: query, token: "TOKEN"}),
23
+ success: function (data) {
24
+ var q = "<div class='query'>" + escapeHTML(">> " + query) + "</div>";
25
+ var r = "<div class='result'>" + escapeHTML("=> " + data.result) + "</div>";
26
+ $("#rack-webconsole .results").append(q + r);
42
27
  $("#rack-webconsole .results_wrapper").scrollTop(
43
28
  $("#rack-webconsole .results").height()
44
29
  );
45
- } else {
46
- $("#rack-webconsole form input").blur();
30
+ $("#webconsole_query").val('');
47
31
  }
48
32
  });
49
- event.preventDefault();
50
33
  }
51
34
  });
52
- });
53
35
 
36
+ $(document).ready(function() {
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
+ })(jQuery);
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.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,12 +11,12 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-07-27 00:00:00.000000000 +02:00
14
+ date: 2011-08-01 00:00:00.000000000 +02:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rack
19
- requirement: &2170028480 !ruby/object:Gem::Requirement
19
+ requirement: &2156017340 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ! '>='
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: '0'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *2170028480
27
+ version_requirements: *2156017340
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: json
30
- requirement: &2170027860 !ruby/object:Gem::Requirement
30
+ requirement: &2156016220 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ! '>='
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: '0'
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *2170027860
38
+ version_requirements: *2156016220
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: minitest
41
- requirement: &2170027360 !ruby/object:Gem::Requirement
41
+ requirement: &2156015160 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ! '>='
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: '0'
47
47
  type: :development
48
48
  prerelease: false
49
- version_requirements: *2170027360
49
+ version_requirements: *2156015160
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: purdytest
52
- requirement: &2170026920 !ruby/object:Gem::Requirement
52
+ requirement: &2156012860 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ! '>='
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: '0'
58
58
  type: :development
59
59
  prerelease: false
60
- version_requirements: *2170026920
60
+ version_requirements: *2156012860
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: mocha
63
- requirement: &2170026420 !ruby/object:Gem::Requirement
63
+ requirement: &2156010800 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ! '>='
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: '0'
69
69
  type: :development
70
70
  prerelease: false
71
- version_requirements: *2170026420
71
+ version_requirements: *2156010800
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: yard
74
- requirement: &2170025580 !ruby/object:Gem::Requirement
74
+ requirement: &2156009780 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ! '>='
@@ -79,10 +79,10 @@ dependencies:
79
79
  version: '0'
80
80
  type: :development
81
81
  prerelease: false
82
- version_requirements: *2170025580
82
+ version_requirements: *2156009780
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bluecloth
85
- requirement: &2170023940 !ruby/object:Gem::Requirement
85
+ requirement: &2156008200 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ! '>='
@@ -90,10 +90,10 @@ dependencies:
90
90
  version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
- version_requirements: *2170023940
93
+ version_requirements: *2156008200
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: rake
96
- requirement: &2170022320 !ruby/object:Gem::Requirement
96
+ requirement: &2156007060 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ! '>='
@@ -101,7 +101,7 @@ dependencies:
101
101
  version: '0'
102
102
  type: :development
103
103
  prerelease: false
104
- version_requirements: *2170022320
104
+ version_requirements: *2156007060
105
105
  description: Rack-based console inside your web applications
106
106
  email:
107
107
  - info@codegram.com
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: -4524250854472631456
154
+ hash: 1863180217222437049
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  none: false
157
157
  requirements:
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  segments:
162
162
  - 0
163
- hash: -4524250854472631456
163
+ hash: 1863180217222437049
164
164
  requirements: []
165
165
  rubyforge_project: rack-webconsole
166
166
  rubygems_version: 1.6.2