ddollar-rack-debug 1.0.2
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.rdoc +40 -0
- data/lib/rack/debug.rb +19 -0
- metadata +55 -0
data/README.rdoc
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
Rails Plugin
|
2
|
+
|
3
|
+
# install
|
4
|
+
$ script/plugin install git://github.com/ddollar/rack-debug.git
|
5
|
+
|
6
|
+
# config/environments/development.rb
|
7
|
+
config.middleware.use "Rack::Debug"
|
8
|
+
|
9
|
+
Gem
|
10
|
+
|
11
|
+
# install
|
12
|
+
$ gem source add http://gems.github.com
|
13
|
+
$ gem install ddollar-rack-debug
|
14
|
+
|
15
|
+
# add a use line to your builder
|
16
|
+
Rack::Builder.new do
|
17
|
+
use Rack::Debug
|
18
|
+
run MyApp.new
|
19
|
+
end
|
20
|
+
|
21
|
+
Add breakpoints to your code
|
22
|
+
|
23
|
+
@user = User.find(params[:id])
|
24
|
+
debugger
|
25
|
+
render :show
|
26
|
+
|
27
|
+
Debugging:
|
28
|
+
|
29
|
+
# run the rake task,
|
30
|
+
$ rake debug
|
31
|
+
Connected.
|
32
|
+
|
33
|
+
# refresh a page in your browser, your app will break at debugger statements
|
34
|
+
(rdb:1) p @user
|
35
|
+
#<User id: 1, name: "David Dollar", email: "ddollar@gmail.com", created_at: "...", updated_at: "...">
|
36
|
+
|
37
|
+
Thanks to:
|
38
|
+
|
39
|
+
Rack::Bug for a good example of Rack middleware in Rails
|
40
|
+
Ben Scofield for making me want to build some Rack middleware
|
data/lib/rack/debug.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rack'
|
2
|
+
|
3
|
+
class Rack::Debug
|
4
|
+
|
5
|
+
VERSION = '0.1.0'
|
6
|
+
|
7
|
+
attr_reader :app
|
8
|
+
|
9
|
+
def initialize(app, options={})
|
10
|
+
@app = app
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(env)
|
14
|
+
LineCache::clear_file_cache
|
15
|
+
Debugger.start_unix_socket_remote
|
16
|
+
app.call(env)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ddollar-rack-debug
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Dollar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-16 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Rack::Debug adds a middlerware interface to ruby-debug http://github.com/github/rack-debug
|
17
|
+
email: ddollar@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
files:
|
25
|
+
- lib/rack
|
26
|
+
- lib/rack/debug.rb
|
27
|
+
- README.rdoc
|
28
|
+
has_rdoc: true
|
29
|
+
homepage: http://github.com/ddollar/rack-debug
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
|
33
|
+
require_paths:
|
34
|
+
- lib
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: "0"
|
40
|
+
version:
|
41
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
version:
|
47
|
+
requirements: []
|
48
|
+
|
49
|
+
rubyforge_project: rack-debug
|
50
|
+
rubygems_version: 1.2.0
|
51
|
+
signing_key:
|
52
|
+
specification_version: 2
|
53
|
+
summary: Rack::Debug adds a middlerware interface to ruby-debug
|
54
|
+
test_files: []
|
55
|
+
|