rconsole 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5308fb25a24e1518c04da5afe10620bd20661818
4
- data.tar.gz: 6f5eed2802219b004f805273e8bc0beb59445299
3
+ metadata.gz: bcd5ecc7e227b5fe16e113c26d569118fb7e0c89
4
+ data.tar.gz: 0f34657ac86e5c1e16f9d97349a5746ccb6a25ee
5
5
  SHA512:
6
- metadata.gz: 69ef0459617c51621d361f76e0a6ea0916010bc63c69c1aace575f74bb854f90b8c18498e86a385dafc2822720c865bf83b44147b698c012f87e70d962b28361
7
- data.tar.gz: 3f0346b120701edad2486522e59a6be1573d0fefefd09cb9701bc57be8affd03487b8548ee89c4c545d366e8bb4574fbb2299bd95e8540417ca6edd5c8ef40e1
6
+ metadata.gz: 3c72a85429baa82ec87bd4d11306892cd05deabecbea097b271d6f1b1aab60e3c2de2f088c975d4a4fa363d947f16d9585f85d0ad3fc30e2b73fa57d293bde1c
7
+ data.tar.gz: f7299cdb3158a5252213a7acdb6e05b2ba4b56b21c911ccc104f819a3a8d5af486e4dfdc46ca55a7d0a9155137ef554c35a3fef4cb69a387daa229d49b5d7049
data/README.md CHANGED
@@ -9,8 +9,8 @@ browser console.
9
9
  First add the following lines to your application `Gemfile`:
10
10
 
11
11
  ``` ruby
12
- group :development
13
- gem 'rconsole', '~> 0.1.0'
12
+ group :development do
13
+ gem 'rconsole', '~> 0.1.1'
14
14
  end
15
15
  ```
16
16
 
@@ -23,6 +23,12 @@ your layout view:
23
23
  javascript_include_tag(:rconsole) if Rails.env.development?
24
24
  ```
25
25
 
26
+ or simply (only for Rails):
27
+
28
+ ```ruby
29
+ javascript_include_rconsole_tag
30
+ ```
31
+
26
32
  Really easy!
27
33
 
28
34
  ## Usage
@@ -44,10 +50,6 @@ Then you will see the message on your browser console. Just like this:
44
50
 
45
51
  Enjoy!
46
52
 
47
- ## Contributors
48
-
49
- + [Sergey Rezvanov](http://github.com/rezwyi)
50
-
51
53
  ## Copyright
52
54
 
53
- See LICENSE file.
55
+ See LICENSE file.
@@ -0,0 +1,5 @@
1
+ module RconsoleHelper
2
+ def javascript_include_rconsole_tag
3
+ javascript_include_tag(:rconsole) if Rails.env.development?
4
+ end
5
+ end
@@ -3,7 +3,7 @@ module Rconsole
3
3
  initializer 'rconsole.middleware' do |app|
4
4
  app.middleware.use Rconsole::Middleware
5
5
  end
6
-
6
+
7
7
  initializer 'rconsole.include_helpers' do
8
8
  ActiveSupport.on_load :action_controller do
9
9
  ActionController::Base.send :include, Rconsole::Helpers
@@ -1,3 +1,3 @@
1
1
  module Rconsole
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -1,23 +1,29 @@
1
- var Rconsole = {};
2
- XMLHttpRequest.prototype.originOpen = XMLHttpRequest.prototype.open;
1
+ if (console && console.log) {
2
+ var Rconsole = {};
3
+ XMLHttpRequest.prototype.originOpen = XMLHttpRequest.prototype.open;
3
4
 
4
- (Rconsole.dump = function() {
5
- var xhr = new XMLHttpRequest()
6
- dump = []
7
- i = 0;
8
-
9
- xhr.originOpen('get', '/rconsole.json', false);
10
- xhr.send();
11
-
12
- if (xhr.readyState === 4 && xhr.status === 200) {
13
- dump = JSON.parse(xhr.responseText);
14
- for (i; i < dump.length; i++) console.log(dump[i]);
15
- }
16
- })();
5
+ (Rconsole.dump = function() {
6
+ var xhr = new XMLHttpRequest(),
7
+ dump = [],
8
+ i = 0;
17
9
 
18
- XMLHttpRequest.prototype.open = function() {
19
- this.addEventListener('readystatechange', function(){
20
- if (this.readyState === 4 && this.status === 200) Rconsole.dump();
21
- });
22
- XMLHttpRequest.prototype.originOpen.apply(this, arguments);
10
+ xhr.originOpen('get', '/rconsole.json', false);
11
+ xhr.send();
12
+
13
+ if (xhr.readyState === 4 && xhr.status === 200) {
14
+ dump = JSON.parse(xhr.responseText);
15
+ for (i; i < dump.length; i++) {
16
+ console.log(dump[i]);
17
+ }
18
+ }
19
+ })();
20
+
21
+ XMLHttpRequest.prototype.open = function() {
22
+ this.addEventListener('readystatechange', function(){
23
+ if (this.readyState === 4 && this.status === 200) {
24
+ Rconsole.dump();
25
+ }
26
+ });
27
+ XMLHttpRequest.prototype.originOpen.apply(this, arguments);
28
+ };
23
29
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rconsole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Rezvanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-08 00:00:00.000000000 Z
11
+ date: 2013-11-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Simple way to print debug messages from ruby code directly to browser
14
14
  console
@@ -22,6 +22,7 @@ files:
22
22
  - LICENSE
23
23
  - README.md
24
24
  - app/controllers/rconsole_controller.rb
25
+ - app/helpers/rconsole_helper.rb
25
26
  - config/routes.rb
26
27
  - lib/rconsole.rb
27
28
  - lib/rconsole/base.rb
@@ -51,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
52
  version: '0'
52
53
  requirements: []
53
54
  rubyforge_project:
54
- rubygems_version: 2.0.3
55
+ rubygems_version: 2.0.6
55
56
  signing_key:
56
57
  specification_version: 4
57
58
  summary: Simple way to print debug messages from ruby code directly to browser console