pow-debug 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +35 -0
- data/Rakefile +2 -0
- data/lib/pow-debug.rb +2 -0
- data/lib/pow-debug/debug.rb +52 -0
- data/lib/pow-debug/engine.rb +11 -0
- data/lib/pow-debug/version.rb +3 -0
- data/pow-debug.gemspec +17 -0
- metadata +57 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Sasha Koss
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# pow-debug gem
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
``` ruby
|
9
|
+
group :development, :test do
|
10
|
+
# If you want to activate pry (more info: http://pryrepl.org/)
|
11
|
+
# gem 'pry-remote'
|
12
|
+
|
13
|
+
# If you want to activate rdebug with Ruby >= 1.9.2
|
14
|
+
# gem 'debugger'
|
15
|
+
|
16
|
+
# Or use standart ruby-debug gem
|
17
|
+
# gem 'ruby-debug'
|
18
|
+
|
19
|
+
gem 'pow-debug'
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
``` sh
|
26
|
+
touch tmp/debug.txt
|
27
|
+
touch tmp/restart.txt
|
28
|
+
open project.dev
|
29
|
+
|
30
|
+
# If you are using pry-remote
|
31
|
+
bundle exec pry-remote
|
32
|
+
|
33
|
+
# If you are using debugger or ruby-debug
|
34
|
+
bundle exec rdebug -c
|
35
|
+
```
|
data/Rakefile
ADDED
data/lib/pow-debug.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
module PowDebug
|
2
|
+
module Debug
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def activate!
|
6
|
+
debug_indicator = Rails.root + 'tmp/debug.txt'
|
7
|
+
|
8
|
+
if debug_indicator.exist?
|
9
|
+
debug_with = debug_indicator.read.strip
|
10
|
+
debug_indicator.delete
|
11
|
+
|
12
|
+
begin
|
13
|
+
if debug_with.empty?
|
14
|
+
activate_pry_debug
|
15
|
+
else
|
16
|
+
self.send 'activate_' + debug_with
|
17
|
+
end
|
18
|
+
rescue LoadError
|
19
|
+
activate_ruby_debug
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
def activate_pry_debug
|
27
|
+
require 'pry-remote'
|
28
|
+
binding.remote_pry
|
29
|
+
end
|
30
|
+
|
31
|
+
def activate_debugger
|
32
|
+
require 'debugger'
|
33
|
+
start_ruby_debug
|
34
|
+
end
|
35
|
+
|
36
|
+
def activate_ruby_debug
|
37
|
+
begin
|
38
|
+
activate_debugger if RUBY_VERSION.to_f >= 1.9
|
39
|
+
rescue LoadError
|
40
|
+
require 'ruby-debug'
|
41
|
+
start_ruby_debug
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def start_ruby_debug
|
46
|
+
Debugger.wait_connection = true
|
47
|
+
Debugger.start_remote
|
48
|
+
debugger
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/pow-debug.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/pow-debug/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ['Sasha Koss']
|
6
|
+
gem.email = ['koss@nocorp.me']
|
7
|
+
gem.description = 'Easy debug with Pow'
|
8
|
+
gem.summary = 'Easy debug with Pow. It supports ruby-debug, debugger (ruby-debug19 fork) and pry.'
|
9
|
+
gem.homepage = ''
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = 'pow-debug'
|
15
|
+
gem.require_paths = ['lib']
|
16
|
+
gem.version = PowDebug::VERSION
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pow-debug
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sasha Koss
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-23 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Easy debug with Pow
|
15
|
+
email:
|
16
|
+
- koss@nocorp.me
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/pow-debug.rb
|
27
|
+
- lib/pow-debug/debug.rb
|
28
|
+
- lib/pow-debug/engine.rb
|
29
|
+
- lib/pow-debug/version.rb
|
30
|
+
- pow-debug.gemspec
|
31
|
+
homepage: ''
|
32
|
+
licenses: []
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 1.8.11
|
52
|
+
signing_key:
|
53
|
+
specification_version: 3
|
54
|
+
summary: Easy debug with Pow. It supports ruby-debug, debugger (ruby-debug19 fork)
|
55
|
+
and pry.
|
56
|
+
test_files: []
|
57
|
+
has_rdoc:
|