rconsole 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -7
- data/lib/rconsole/engine.rb +21 -1
- data/lib/rconsole/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7400193dd4cc33b7726d9ebd1afbdff3837caab8
|
4
|
+
data.tar.gz: e0882a8378be8d6650532525835cb0ea883217b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e0e30fd627ee36e9f78b90ae0045b3252429f4dc5a1c04247212b1511556080c18fcda214001004ac52c91678b6a3a121415b0d6e0a9613147308495deec678
|
7
|
+
data.tar.gz: e7f4e02781891a8c1a43d24df9b60eab0ab10bceb0eb92b80b41dedf2b0bc0411de0b42ad4705e89c0f7a5aa1929629ca34117417077b66de3a792d1a947bb4f
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
Rconsole
|
2
2
|
========
|
3
3
|
|
4
|
-
Rconsole is a Rails plugin which allows you to output debug messages from ruby code to the
|
5
|
-
browser console.
|
4
|
+
Rconsole is a Rails plugin which allows you to output debug messages from ruby code to the browser console.
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
@@ -10,20 +9,20 @@ First add the following lines to your application `Gemfile`:
|
|
10
9
|
|
11
10
|
``` ruby
|
12
11
|
group :development do
|
13
|
-
gem 'rconsole', '~> 0.1.
|
12
|
+
gem 'rconsole', '~> 0.1.2'
|
14
13
|
end
|
15
14
|
```
|
16
15
|
|
17
16
|
Then run `bundle install` to update your's gems bundle.
|
18
17
|
|
19
18
|
Now you need include `rconsole.js` asset file by adding the following lines to
|
20
|
-
your layout view:
|
19
|
+
your layout view (Rails only):
|
21
20
|
|
22
21
|
``` ruby
|
23
22
|
javascript_include_tag(:rconsole) if Rails.env.development?
|
24
23
|
```
|
25
24
|
|
26
|
-
or simply
|
25
|
+
or simply:
|
27
26
|
|
28
27
|
```ruby
|
29
28
|
javascript_include_rconsole_tag
|
@@ -37,6 +36,8 @@ Just use `rconsole.log` anywhere you need, e.g:
|
|
37
36
|
|
38
37
|
``` ruby
|
39
38
|
class HomeController < ActionController::Base
|
39
|
+
respond_to :html
|
40
|
+
|
40
41
|
def index
|
41
42
|
rconsole.log 'Hello from Ruby!'
|
42
43
|
respond_with({})
|
@@ -46,10 +47,15 @@ end
|
|
46
47
|
|
47
48
|
Then you will see the message on your browser console. Just like this:
|
48
49
|
|
49
|
-
![Hello from Ruby!](https://dl.dropboxusercontent.com/u/11845683/
|
50
|
+
![Hello from Ruby!](https://dl.dropboxusercontent.com/u/11845683/assets/hello-from-ruby.png)
|
50
51
|
|
51
52
|
Enjoy!
|
52
53
|
|
54
|
+
|
55
|
+
## Versioning
|
56
|
+
|
57
|
+
Rconsole uses RubyGems Rational Versioning Policy.
|
58
|
+
|
53
59
|
## Copyright
|
54
60
|
|
55
|
-
See LICENSE file.
|
61
|
+
See LICENSE file.
|
data/lib/rconsole/engine.rb
CHANGED
@@ -1,7 +1,27 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
1
3
|
module Rconsole
|
2
4
|
class Engine < ::Rails::Engine
|
3
5
|
initializer 'rconsole.middleware' do |app|
|
4
6
|
app.middleware.use Rconsole::Middleware
|
7
|
+
|
8
|
+
Rails::Rack::Logger.class_eval do
|
9
|
+
def call_with_rconsole(env)
|
10
|
+
begin
|
11
|
+
key = :'rconsole.old_rails_logger_level'
|
12
|
+
|
13
|
+
if env['PATH_INFO'] =~ /\/rconsole\.js(on)?/
|
14
|
+
env[key] = Rails.logger.level
|
15
|
+
Rails.logger.level = Logger::ERROR
|
16
|
+
end
|
17
|
+
|
18
|
+
call_without_rconsole env
|
19
|
+
ensure
|
20
|
+
Rails.logger.level = env[key] if env[key]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
alias_method_chain :call, :rconsole
|
24
|
+
end
|
5
25
|
end
|
6
26
|
|
7
27
|
initializer 'rconsole.include_helpers' do
|
@@ -18,4 +38,4 @@ module Rconsole
|
|
18
38
|
end
|
19
39
|
end
|
20
40
|
end
|
21
|
-
end
|
41
|
+
end
|
data/lib/rconsole/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Rezvanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-19 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
|
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
54
|
rubyforge_project:
|
55
|
-
rubygems_version: 2.
|
55
|
+
rubygems_version: 2.2.2
|
56
56
|
signing_key:
|
57
57
|
specification_version: 4
|
58
58
|
summary: Simple way to print debug messages from ruby code directly to browser console
|