rails_dt 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -21,7 +21,11 @@ In your application root, do a:
21
21
 
22
22
  Follow the instructions the generator gives you (they are listed below):
23
23
 
24
- In your `app/controllers/application_controller`, add:
24
+ In your `config/environment.rb`, add:
25
+
26
+ config.gem "rails_dt"
27
+
28
+ Inside your `ApplicationController` class, add:
25
29
 
26
30
  handles_dt
27
31
 
@@ -36,28 +40,38 @@ Somewhere at the end of your `app/views/layouts/application.html.erb` `<body>` s
36
40
  </div>
37
41
 
38
42
 
43
+ Checking Setup
44
+ --------------
45
+
46
+ Somewhere in your `app/views/layouts/application.html.erb`, add:
47
+
48
+ <% DT.p "hello, world" %>
49
+
50
+ Refresh a page that uses this layout. You should see "hello, world" beneath your main page content.
51
+
52
+
39
53
  Debugging...
40
54
  ------------
41
55
 
42
- ### ...models ###
56
+ ### ...Models ###
43
57
 
44
58
  def before_save
45
59
  DT.p "in before_save"
46
60
  end
47
61
 
48
- ### ...controllers ###
62
+ ### ...Controllers ###
49
63
 
50
64
  def action
51
65
  DT.p "hi, I'm #{action_name}"
52
66
  end
53
67
 
54
- ### ...views ###
68
+ ### ...Views ###
55
69
 
56
70
  <div class="body">
57
71
  <% DT.p "@users", @users %>
58
72
  </div>
59
73
 
60
- ### ...filters ###
74
+ ### ...Filters ###
61
75
 
62
76
  Insert debugging code:
63
77
 
@@ -73,6 +87,11 @@ See it in action:
73
87
 
74
88
  $ tail -f log/dt.log
75
89
 
90
+ ### ...Anything! ###
91
+
92
+ To conclude it, `DT.p` is the universal method you can print your debug messages with.
93
+
94
+
76
95
 
77
96
  Feedback
78
97
  --------
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 0
2
+ :patch: 1
3
3
  :major: 0
4
4
  :minor: 1
@@ -2,19 +2,22 @@
2
2
  Finalizing DT installation
3
3
  ==========================
4
4
 
5
- In your `app/controllers/application_controller` add:
5
+ In your `config/environment.rb`, add:
6
+
7
+ config.gem "rails_dt"
8
+
9
+ Inside your `ApplicationController` class, add:
6
10
 
7
11
  handles_dt
8
12
 
9
- In your `app/views/layouts/application.html.erb` `<head>` section add:
13
+ In your `app/views/layouts/application.html.erb` `<head>` section, add:
10
14
 
11
15
  <%= stylesheet_link_tag "dt" %>
12
16
 
13
- Somewhere at the end of your `app/views/layouts/application.html.erb` `<body>` section add:
17
+ Somewhere at the end of your `app/views/layouts/application.html.erb` `<body>` section, add:
14
18
 
15
19
  <div class="DT">
16
20
  <%= DT.to_html %>
17
21
  </div>
18
22
 
19
23
  Happy debugging!
20
-
data/lib/dt.rb CHANGED
@@ -35,14 +35,15 @@ module DT #:doc:
35
35
  # p @myobj
36
36
  def self.p(*args)
37
37
  # Fetch caller information.
38
- c = caller.first.split(":")
38
+ # NOTE: May be lacking file information, e.g. when in an irb session.
39
+ file, line = caller.first.split(":")
39
40
 
40
41
  # Template variables. Documented in web_prefix=.
41
42
  hc = {
42
- :file => c[0],
43
- :line => c[1],
44
- :file_base => File.basename(c[0]),
45
- :file_rel => Pathname(c[0]).relative_path_from(Rails.root).to_s,
43
+ :file => file,
44
+ :line => line,
45
+ :file_base => (begin; File.basename(file); rescue; file; end),
46
+ :file_rel => (begin; Pathname(file).relative_path_from(Rails.root).to_s; rescue; file; end),
46
47
  }
47
48
 
48
49
  ##return hc
data/rails_dt.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails_dt}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alex Fortuna"]
12
- s.date = %q{2010-02-27}
12
+ s.date = %q{2010-03-01}
13
13
  s.description = %q{Rails Debug Toolkit}
14
14
  s.email = %q{alex.r@askit.org}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_dt
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
  - Alex Fortuna
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-27 00:00:00 +03:00
12
+ date: 2010-03-01 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies: []
15
15