backtracer 0.2.4 → 0.3.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/Rakefile CHANGED
@@ -7,7 +7,8 @@ begin
7
7
  # gemspec.homepage = "http://github.com/technicalpickles/the-perfect-gem"
8
8
  # gemspec.description = "TODO"
9
9
  # gemspec.authors = ["Josh Nichols"]
10
- gemspec.add_dependency 'sane'
10
+ gemspec.add_dependency 'sane', '>= 0.9.1'
11
+ gemspec.add_dependency 'xray'
11
12
  end
12
13
  rescue LoadError
13
14
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.3.0
data/bin/backtracer ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # gems will fill this in for me
3
+
4
+ if true # (ARGV.include? '-h') || (ARGV.include? '--help')
5
+ dir = File.dirname(__FILE__) + '/../lib'
6
+ puts 'options: ( -r filename) '
7
+ for file in Dir[dir + '/*.rb']
8
+ puts File.basename(file)
9
+ end
10
+ end
data/bin/backtracer~ ADDED
@@ -0,0 +1,7 @@
1
+ if (ARGV.include? '-h') || (ARGV.include? '--help')
2
+ dir = File.dirname(__FILE__) + '/../lib'
3
+ puts 'options:'
4
+ for file in Dir[dir + '/*']
5
+ puts File.basename(file)
6
+ end
7
+ end
data/lib/backtracer.rb CHANGED
@@ -25,6 +25,6 @@ at_exit {
25
25
  else
26
26
  puts "(no exception found to backtrace)"
27
27
  end
28
-
28
+ # exit! TODO I guess do this once ours isn't *so* ugly
29
29
  # TODO compare with that fella xray
30
30
  }
@@ -1,4 +1,10 @@
1
1
  require 'pp'
2
+ require 'sane/os'
3
+
4
+ def xray
5
+ require 'xray'
6
+ proc { Process.kill "QUIT", Process.pid; '' }
7
+ end
2
8
 
3
9
  if Thread.current.respond_to? :backtrace
4
10
  fella = proc {
@@ -9,17 +15,34 @@ if Thread.current.respond_to? :backtrace
9
15
  out
10
16
  }
11
17
  elsif respond_to? :caller_for_all_threads
12
- fella = proc {
13
- caller_for_all_threads
14
- }
18
+ if OS.windows?
19
+ fella = proc {
20
+ caller_for_all_threads
21
+ }
22
+ else
23
+ fella = xray
24
+ end
15
25
  else
16
- raise 'appears no caller for all threads or Thread#backtrace in your current system'
26
+ # weak sauce for the old school users :)
27
+ if OS.windows?
28
+
29
+ trap("ILL") { puts "All threads:" + Thread.list.inspect, "Current thread:" + Thread.current.to_s, caller } # puts current thread caller
30
+ fella = proc { Process.kill "ILL", Process.pid } # send myself a signal
31
+ else
32
+ fella = xray
33
+ end
34
+
17
35
  end
18
36
 
19
37
  time = $ping_interval || 5 # seconds
38
+ time = 1 if $0 == __FILE__
20
39
  Thread.new {
21
40
  loop {
22
41
  sleep time
23
42
  pp fella.call
24
43
  }
25
44
  }
45
+
46
+ if $0 == __FILE__ # a test
47
+ sleep
48
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backtracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors: []
7
7
 
@@ -16,6 +16,16 @@ dependencies:
16
16
  name: sane
17
17
  type: :runtime
18
18
  version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: xray
27
+ type: :runtime
28
+ version_requirement:
19
29
  version_requirements: !ruby/object:Gem::Requirement
20
30
  requirements:
21
31
  - - ">="
@@ -24,8 +34,9 @@ dependencies:
24
34
  version:
25
35
  description: Quality backtraces for ruby
26
36
  email: rogerdpack@gmail.com
27
- executables: []
28
-
37
+ executables:
38
+ - backtracer
39
+ - backtracer~
29
40
  extensions: []
30
41
 
31
42
  extra_rdoc_files:
@@ -34,6 +45,7 @@ files:
34
45
  - README
35
46
  - Rakefile
36
47
  - VERSION
48
+ - bin/backtracer
37
49
  - examples/crash.rb
38
50
  - examples/crash_longer.rb
39
51
  - examples/example_test_all_output