rack-debug 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +41 -0
- data/lib/rack/debug.rb +19 -0
- metadata +61 -0
data/README.rdoc
ADDED
@@ -0,0 +1,41 @@
|
|
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
|
+
require 'rack/debug'
|
17
|
+
Rack::Builder.new do
|
18
|
+
use Rack::Debug
|
19
|
+
run MyApp.new
|
20
|
+
end
|
21
|
+
|
22
|
+
Add breakpoints to your code
|
23
|
+
|
24
|
+
@user = User.find(params[:id])
|
25
|
+
debugger
|
26
|
+
render :show
|
27
|
+
|
28
|
+
Debugging:
|
29
|
+
|
30
|
+
# run the rake task,
|
31
|
+
$ rake debug
|
32
|
+
Connected.
|
33
|
+
|
34
|
+
# refresh a page in your browser, your app will break at debugger statements
|
35
|
+
(rdb:1) p @user
|
36
|
+
#<User id: 1, name: "David Dollar", email: "ddollar@gmail.com", created_at: "...", updated_at: "...">
|
37
|
+
|
38
|
+
Thanks to:
|
39
|
+
|
40
|
+
Rack::Bug for a good example of Rack middleware in Rails
|
41
|
+
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,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: 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-08-25 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: |+
|
17
|
+
|
18
|
+
Rack::Debug adds a middlerware interface to ruby-debug
|
19
|
+
http://github.com/github/rack-debug
|
20
|
+
|
21
|
+
|
22
|
+
email: ddollar@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.rdoc
|
29
|
+
files:
|
30
|
+
- lib/rack/debug.rb
|
31
|
+
- README.rdoc
|
32
|
+
has_rdoc: true
|
33
|
+
homepage: http://github.com/ddollar/rack-debug
|
34
|
+
licenses: []
|
35
|
+
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
version:
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: "0"
|
52
|
+
version:
|
53
|
+
requirements: []
|
54
|
+
|
55
|
+
rubyforge_project: rack-debug
|
56
|
+
rubygems_version: 1.3.5
|
57
|
+
signing_key:
|
58
|
+
specification_version: 3
|
59
|
+
summary: Rack::Debug adds a middlerware interface to ruby-debug
|
60
|
+
test_files: []
|
61
|
+
|