console.log 0.1.0 → 0.2.0

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: 02193d327eb1d5ac7bc40a1af5bebbf334d94598
4
- data.tar.gz: feb75e59ff9ed442b6a46d135bc072bd5f9b30d4
3
+ metadata.gz: abbc34ca5d758827282059135a30646b65cbb984
4
+ data.tar.gz: 2c0b8f5ed9c23e255ca67855b391ccf5378d2c37
5
5
  SHA512:
6
- metadata.gz: 13f63320930b0e5aee79030b3951bd45143a01740857c5aadfb1c7a105b4ebef0072f2eb9c544354d8a078bf2e9711ad7d820d318ecab4cb0906c3ffa7c3c935
7
- data.tar.gz: 0c7d4ad09a219fe749bea274b0a0366922c8be05e33a9fc06fbcd564bd54a2b9a311f8ccabcde31ae2a8de4cc413cfca10a3f6d7300594581fae3c77a04889af
6
+ metadata.gz: a61786517d3769a7cc2057ea896368c04594d070a93d188806ad915fb7215beb6bdc7a2f6e017c2ab3291d54a739ca51fcc777c50abcf2da83eb627d17d3f4cd
7
+ data.tar.gz: 2599adc2194f1bf35fc7f7893dba60b7a7be49fff42374062dd83f33c2b30cf8d05eebd9b992ebf31065afe2344d131a58ecdb52ba72683c1a98fc4e6c9ac54a
data/README.md CHANGED
@@ -1,37 +1,38 @@
1
- The `console.log` gem allows you to use `console.log` in your Ruby on Rails apps.
1
+ The `console.log` gem allows you to log to the Javascript console from ruby/rails apps.
2
2
 
3
- I wrote it to solve 2 problems:
4
- 1. It's hard to use rails logs for debugging because their either noisy, or completely hidden. Using
5
- `console.log` lets you easily see only log messages in this request.
6
- 1. When working on the js for [Bugsnag](https://bugsnag.com/) I kept accidentally typing `console.log`
7
- into Rails. Now that works!
3
+ ## Usage
4
+
5
+ 1. Call `console.log` in rails.
6
+
7
+ ```ruby
8
+ def load_user
9
+ user = User.where(email: 'foo@bar.com')
10
+ console.log "User: ", user
11
+ user
12
+ end
13
+ ```
14
+
15
+ 2. Open your browser's developer console.
16
+
17
+ ![Screen shot](http://i.imgur.com/QJjjmjf.png)
18
+
19
+ 3. (optional) Scream with delight!
8
20
 
9
21
  ## Installation
10
22
 
11
23
  1. Add `gem "console.log"` to your Gemfile.
24
+
12
25
  ```ruby
13
26
  gem "console.log" # makes console.log available in ruby
14
27
  ```
28
+
15
29
  2. Bundle install
30
+
16
31
  ```shell
17
32
  bundle install
18
33
  ```
19
34
 
20
- ## Usage
21
-
22
- In rails you can now use console.log for debugging. This means you don't need
23
- to have the rails logs open (which is hard with servers like Pow), because log
24
- messages will go to your browser console.
25
-
26
- ```ruby
27
- def load_user
28
- user = User.where(email: 'foo@bar.com')
29
- console.log user
30
- user
31
- end
32
- ```
33
-
34
- ![Screen shot](http://i.imgur.com/QJjjmjf.png)
35
+ ## Reference
35
36
 
36
37
  ### `console.log`
37
38
 
@@ -47,6 +48,15 @@ If you want a little yellow triangle beside your message, call `console.warn` in
47
48
 
48
49
  If you want your text to be bright red, call `console.error` instead of `console.log`.
49
50
 
51
+ ## Why??
52
+
53
+ I wrote it to solve 2 problems:
54
+
55
+ 1. It's hard to use rails logs for debugging because they're noisy, or (if you use something like pow)
56
+ completely hidden. Using `console.log` lets you easily see only log messages in this request.
57
+ 1. When working on the js for [Bugsnag](https://bugsnag.com/) I kept accidentally typing `console.log`
58
+ into Rails. Now that works!
59
+
50
60
  ## License
51
61
 
52
62
  `console.log` is licensed under the MIT license, see LICENSE.MIT for details.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "console.log"
3
- s.version = "0.1.0"
3
+ s.version = "0.2.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.author = "Conrad Irwin"
6
6
  s.email = "conrad.irwin@gmail.com"
@@ -1,7 +1,13 @@
1
1
  module ConsoleLog
2
2
  module CoreExt
3
- def console
4
- LSpace[:console] ||= Console.new
3
+ # This is a method_missing because `be rails c` does
4
+ # wierd stuff with console methods.
5
+ def method_missing(name)
6
+ if name.to_s == "console"
7
+ LSpace[:console] ||= Console.new
8
+ else
9
+ super
10
+ end
5
11
  end
6
12
  end
7
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: console.log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conrad Irwin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-15 00:00:00.000000000 Z
11
+ date: 2014-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lspace