ruby-debug-passenger 0.0.1 → 0.1.0

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
@@ -1,62 +1,83 @@
1
- # ruby-debug-passenger
2
-
3
- ## Background
4
- I wanted to use Phusion Passenger as an Apache module (not standalone) but still
5
- be able to use the interactive Ruby debugger.
6
-
7
- Thanks to
8
- [Adam Meehan](http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger)
9
- I was able to do that, and I decided to make it into a reusable Gem.
10
-
11
- ## Requirements
12
- This is been tested on:
13
-
14
- * Rails 3.2.2
15
- * Ruby (MRI) 1.9.2
16
- * Ruby Debugger 0.11.6
17
- * Phusion Passenger 3.0.11
18
-
19
- It will probably work on other versions, but not on Rails 2.
20
-
21
- It may or may not work on Ruby 1.8.
22
-
23
- ## Installation
24
- Add this to your `Gemfile` (assuming you are on Ruby 1.9):
25
-
26
- ```ruby
27
- gem "ruby-debug19", require: "ruby-debug"
28
- gem "ruby-debug-passenger"
29
- ```
30
-
31
- Or if you're using Ruby 1.8 you can try the following, but it hasn't been tested!
32
-
33
- ```ruby
34
- gem "ruby-debug"
35
- gem "ruby-debug-passenger"
36
- ```
37
-
38
- Then run `bundle install` to install it.
39
-
40
- ## Usage
41
- Add `debugger` anywhere in your Ruby code that you want to invoke the debugger.
42
- (Or in an ERB template add `<% debugger %>`.)
43
-
44
- Run `rake debug` to restart Phusion Passenger and connect to the debugger. (You
45
- will be prompted to reload the app in your browser.)
46
-
47
- ## Suggested configuration
48
- I recommend putting this in your `~/.rdebugrc`:
49
-
50
- ```ruby
51
- set autolist
52
- set autoeval
53
- set autoreload
54
- ```
55
-
56
- ## Recommended reading
57
- * [ruby-debug documentation](http://bashdb.sourceforge.net/ruby-debug.html)
58
- * [RailsCast #54](http://railscasts.com/episodes/54-debugging-with-ruby-debug)
59
- (the setup steps are out of date, but it shows why ruby-debug can be useful)
60
-
61
- ## License
62
- MIT License - see `LICENSE.txt`.
1
+ # ruby-debug-passenger
2
+
3
+ ## Background
4
+ I wanted to use Phusion Passenger as an Apache module (not standalone) but still
5
+ be able to use the interactive Ruby debugger.
6
+
7
+ Thanks to
8
+ [Adam Meehan](http://duckpunching.com/passenger-mod_rails-for-development-now-with-debugger)
9
+ I was able to do that, and I decided to make it into a reusable Gem.
10
+
11
+ ## Requirements
12
+ This is been tested on:
13
+
14
+ * Rails 3.2.2
15
+ * Ruby (MRI) 1.9.2
16
+ * Old Ruby Debugger 0.11.6
17
+ * Phusion Passenger 3.0.11
18
+
19
+ and
20
+
21
+ * Rails 3.0.14
22
+ * Ruby (MRI) 1.9.3-p125
23
+ * Debugger gem 1.1.4
24
+ * Phusion Passenger 3.0.12 and 3.0.13
25
+
26
+ It will probably work on other versions, but not on Rails 2.
27
+
28
+ It may or may not work on Ruby 1.8.
29
+
30
+ ## Installation
31
+ Add this to your `Gemfile` (assuming you are on Ruby 1.9):
32
+
33
+ ```ruby
34
+ gem "debugger"
35
+ gem "ruby-debug-passenger"
36
+ ```
37
+
38
+ or use the old ruby-debug gem:
39
+
40
+ ```ruby
41
+ gem "ruby-debug19", require: "ruby-debug"
42
+ gem "ruby-debug-passenger"
43
+ ```
44
+
45
+ Or if you're using Ruby 1.8 you can try the following, but it hasn't been tested!
46
+
47
+ ```ruby
48
+ gem "ruby-debug"
49
+ gem "ruby-debug-passenger"
50
+ ```
51
+
52
+ Then run `bundle install` to install it.
53
+
54
+ ## Usage
55
+ Add `debugger` anywhere in your Ruby code that you want to invoke the debugger.
56
+ (Or in an ERB template add `<% debugger %>`.)
57
+
58
+ Run `rake debug` to restart Phusion Passenger and connect to the debugger. (You
59
+ will be prompted to reload the app in your browser.)
60
+
61
+ ## Suggested configuration
62
+ I recommend putting this in your `~/.rdebugrc`:
63
+
64
+ ```ruby
65
+ set autolist
66
+ set autoeval
67
+ set autoreload
68
+ ```
69
+
70
+ ## Recommended reading
71
+ * [ruby-debug documentation](http://bashdb.sourceforge.net/ruby-debug.html)
72
+ * [RailsCast #54](http://railscasts.com/episodes/54-debugging-with-ruby-debug)
73
+ (the setup steps are out of date, but it shows why ruby-debug can be useful)
74
+
75
+ ## Changelog
76
+ ### 0.1.0
77
+ * Support for `debugger` gem (Kai Middleton) #1
78
+
79
+ ### 0.0.1
80
+ * Initial release
81
+
82
+ ## License
83
+ MIT License - see `LICENSE.txt`.
@@ -1,3 +1,3 @@
1
1
  module RubyDebugPassenger
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -11,7 +11,15 @@ module RubyDebugPassenger
11
11
  # ever run in the development environment (for safety more than anything
12
12
  # else).
13
13
  if Rails.env.development? && File.exists?(File.join(Rails.root, 'tmp', 'debug.txt'))
14
- require 'ruby-debug'
14
+ begin
15
+ require 'debugger'
16
+ rescue LoadError
17
+ begin
18
+ require 'ruby-debug'
19
+ rescue LoadError
20
+ raise "One of the gems 'debugger' or 'ruby-debug' must be present when using the gem 'ruby-debug-passenger'"
21
+ end
22
+ end
15
23
  File.delete(File.join(Rails.root, 'tmp', 'debug.txt'))
16
24
  Debugger.wait_connection = true
17
25
  Debugger.start_remote
data/lib/tasks/debug.rake CHANGED
@@ -1,34 +1,43 @@
1
- desc "Restart the app with debugging enabled, then launch the debugger"
2
- task :debug do
3
-
4
- require 'ruby-debug'
5
-
6
- # This instructs the app to wait for the debugger to connect after loading
7
- # See config/environments/development.rb
8
- FileUtils.touch(File.join(Rails.root, 'tmp', 'debug.txt'))
9
-
10
- # Instruct Phusion Passenger to restart the app
11
- FileUtils.touch(File.join(Rails.root, 'tmp', 'restart.txt'))
12
-
13
- # Wait for it to restart (requires the user to load a page)
14
- puts "Waiting for restart (please reload the app in your web browser)..."
15
- begin
16
- while File.exists?(File.join(Rails.root, 'tmp', 'debug.txt'))
17
- sleep 0.5
18
- end
19
- sleep 1
20
- rescue Interrupt
21
- File.delete(File.join(Rails.root, 'tmp', 'debug.txt'))
22
- puts "\rCancelled."
23
- exit 1
24
- end
25
-
26
- puts "Loading debugger..."
27
- begin
28
- Debugger.start_client
29
- rescue Interrupt
30
- # Clear the "^C" that is displayed when you press Ctrl-C
31
- puts "\r\e[0KDisconnected."
32
- end
33
-
34
- end
1
+ desc "Restart the app with debugging enabled, then launch the debugger"
2
+ task :debug do
3
+
4
+ begin
5
+ require 'debugger'
6
+ rescue LoadError
7
+ begin
8
+ require 'ruby-debug'
9
+ rescue LoadError
10
+ puts "One of the gems 'debugger' or 'ruby-debug' must be present for this task to work"
11
+ exit 1
12
+ end
13
+ end
14
+
15
+ # This instructs the app to wait for the debugger to connect after loading
16
+ # See config/environments/development.rb
17
+ FileUtils.touch(File.join(Rails.root, 'tmp', 'debug.txt'))
18
+
19
+ # Instruct Phusion Passenger to restart the app
20
+ FileUtils.touch(File.join(Rails.root, 'tmp', 'restart.txt'))
21
+
22
+ # Wait for it to restart (requires the user to load a page)
23
+ puts "Waiting for restart (please reload the app in your web browser)..."
24
+ begin
25
+ while File.exists?(File.join(Rails.root, 'tmp', 'debug.txt'))
26
+ sleep 0.5
27
+ end
28
+ sleep 1
29
+ rescue Interrupt
30
+ File.delete(File.join(Rails.root, 'tmp', 'debug.txt'))
31
+ puts "\rCancelled."
32
+ exit 1
33
+ end
34
+
35
+ puts "Loading debugger..."
36
+ begin
37
+ Debugger.start_client
38
+ rescue Interrupt
39
+ # Clear the "^C" that is displayed when you press Ctrl-C
40
+ puts "\r\e[0KDisconnected."
41
+ end
42
+
43
+ end
@@ -10,10 +10,11 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "https://github.com/davejamesmiller/ruby-debug-passenger"
11
11
  s.summary = %q{Adds a 'rake debug' task to Rails to restart Phusion Passenger with a debugger connected}
12
12
  s.description = <<-EOF
13
- Adds an initializer that loads 'ruby-debug' and starts the debugger, and a
14
- 'rake debug' task that tells Phusion Passenger to restart with debugging
15
- enabled. This makes it possible to do interactive debugging when using the
16
- Phusion Passenger Apache module - it does not require the standalone server.
13
+ Adds an initializer that loads 'ruby-debug' or 'debugger' and starts the
14
+ debugger, and a 'rake debug' task that tells Phusion Passenger to restart
15
+ with debugging enabled. This makes it possible to do interactive debugging
16
+ when using the Phusion Passenger Apache module - it does not require the
17
+ standalone server.
17
18
  EOF
18
19
  s.license = 'MIT'
19
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-debug-passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,13 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-11 00:00:00.000000000Z
12
+ date: 2012-07-01 00:00:00.000000000Z
13
13
  dependencies: []
14
- description: ! " Adds an initializer that loads 'ruby-debug' and starts the debugger,
15
- and a\n 'rake debug' task that tells Phusion Passenger to restart with debugging\n
16
- \ enabled. This makes it possible to do interactive debugging when using the\n
17
- \ Phusion Passenger Apache module - it does not require the standalone server.\n"
14
+ description: ! " Adds an initializer that loads 'ruby-debug' or 'debugger' and
15
+ starts the\n debugger, and a 'rake debug' task that tells Phusion Passenger to
16
+ restart\n with debugging enabled. This makes it possible to do interactive debugging\n
17
+ \ when using the Phusion Passenger Apache module - it does not require the\n standalone
18
+ server.\n"
18
19
  email:
19
20
  - dave@davejamesmiller.com
20
21
  executables: []