Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation - manually tested
- Loading branch information
Showing
9 changed files
with
138 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export POW_WORKERS=1 | ||
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ]; then | ||
source "$rvm_path/scripts/rvm" | ||
source ".rvmrc" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rvm use ruby-1.9.3@rubymine_pow --create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
source 'http://rubygems.dev' # Use local rubygems proxy/mirror (see https://github.com/maksar/rubygems_proxy ) | ||
source :rubygems | ||
|
||
group :default do | ||
gem 'sinatra' | ||
#gem 'sinatra-contrib' | ||
end | ||
|
||
group :debug do | ||
# Gems required by Rubymine's debugger - download and deploy .gem files into #{APP_ROOT}/vendor/cache | ||
gem 'linecache19', '0.5.13' # http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | ||
gem 'ruby-debug-base19x', '~> 0.11.30.pre10' # http://rubygems.org/downloads/ruby-debug-base19x-0.11.30.pre10.gem | ||
gem 'ruby-debug-ide', '~> 0.4.17.beta8' # http://rubygems.org/downloads/ruby-debug-ide-0.4.17.beta14.gem | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
GEM | ||
remote: http://rubygems.dev/ | ||
remote: http://rubygems.org/ | ||
specs: | ||
archive-tar-minitar (0.5.2) | ||
columnize (0.3.6) | ||
linecache19 (0.5.13) | ||
ruby_core_source (>= 0.1.4) | ||
rack (1.4.1) | ||
rack-protection (1.2.0) | ||
rack | ||
rake (0.9.2.2) | ||
ruby-debug-base19x (0.11.30.pre10) | ||
columnize (>= 0.3.1) | ||
linecache19 (>= 0.5.11) | ||
rake (>= 0.8.1) | ||
ruby_core_source (>= 0.1.4) | ||
ruby-debug-ide (0.4.17.beta14) | ||
rake (>= 0.8.1) | ||
ruby_core_source (0.1.5) | ||
archive-tar-minitar (>= 0.5.2) | ||
sinatra (1.3.3) | ||
rack (~> 1.3, >= 1.3.6) | ||
rack-protection (~> 1.2) | ||
tilt (~> 1.3, >= 1.3.3) | ||
tilt (1.3.3) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
linecache19 (= 0.5.13) | ||
ruby-debug-base19x (~> 0.11.30.pre10) | ||
ruby-debug-ide (~> 0.4.17.beta8) | ||
sinatra |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,43 @@ | ||
rubymine_pow | ||
============ | ||
# Debugging example | ||
|
||
Super simple rubymine sinatra pow debugging example | ||
This example project is a super-simple example of how I used | ||
|
||
- [Sinatra](http://www.sinatrarb.com/) | ||
- [Pow!](http://pow.cx/) | ||
- [RubyMine](http://www.jetbrains.com/ruby/) | ||
|
||
to graphically debug a previous employer's simple web projects | ||
|
||
##### Prerequisites: | ||
|
||
* Pow installed | ||
* Customized gems installed (see Gemfile for details) | ||
|
||
##### Usage | ||
|
||
Add example preamble to config.ru of a pow-linked app | ||
|
||
`touch tmp/debug.txt` | ||
|
||
Load target project in Rubymine and construct a "Configuration" with your project name using the "Remote remote debug" defaults | ||
|
||
Ensure an appropriate Rubymine breakpoint is set somewhere in your sinatra app | ||
|
||
`touch tmp/restart.txt` | ||
|
||
Navigate a browser instance to your pow app's root (should wait - waiting for RubyMine's debugger client to connect) | ||
|
||
In Rubymine press "Debug" for the Rubymine "Configuration" you constructed above | ||
|
||
Rubymine should then halt on the pow request as required. | ||
|
||
Note: | ||
This example assumes the POW_WORKERS variable is set to 1 (one). If multiple workers are active you may get errors that ruby-debug-ide could not attach to a port already in use. | ||
|
||
Pow-worker / ruby-debug-ide / Rubymine remote debug client port mappings are therefore left as an exercise to the reader. So to, pow timeout parameters. | ||
|
||
##### Lachlan Pitts ([parameme](mailto:github@parameme.com)) | ||
|
||
- [parameme@github](https://github.com/parameme) | ||
- [@pittlsr](https://twitter.com/pittslr) | ||
- [Ennova](http://ennova.com.au) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'sinatra' | ||
|
||
class App < Sinatra::Base | ||
get '/' do | ||
'Rubymine debugging lives!' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#require 'rubygems' # ASSUMPTION: RUBY_VER > 1.9 | ||
|
||
require 'bundler' | ||
Bundler.setup | ||
|
||
if File.exists?(File.join('tmp','debug.txt')) | ||
require 'ruby-debug-ide' | ||
require 'ostruct' | ||
|
||
options = OpenStruct.new( | ||
'frame_bind' => false, | ||
'host' => nil, | ||
'load_mode' => false, | ||
'port' => 1234, | ||
'stop' => false, | ||
'tracing' => false | ||
) | ||
|
||
Debugger::PROG_SCRIPT = File.expand_path($0) | ||
|
||
# set options | ||
Debugger.debug_program(options) | ||
end | ||
|
||
require './app' | ||
run App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |