Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

updating rdoc, removing binfile

  • Loading branch information...
commit d943f41a503d189af075a4e8095ee20fc485fa52 1 parent f758844
Aaron Patterson authored
1  Manifest.txt
@@ -3,7 +3,6 @@ CHANGELOG.rdoc
3 3
 Manifest.txt
4 4
 README.rdoc
5 5
 Rakefile
6  
-bin/never_say_die
7 6
 ext/neversaydie/extconf.rb
8 7
 ext/neversaydie/neversaydie.c
9 8
 lib/neversaydie.rb
39  README.rdoc
Source Rendered
... ...
@@ -1,32 +1,57 @@
1 1
 = never_say_die
2 2
 
3  
-* FIX (url)
  3
+* http://seattlerb.rubyforge.org
  4
+* http://github.com/tenderlove/neversaydie
4 5
 
5 6
 == DESCRIPTION:
6 7
 
7  
-FIX (describe your package)
  8
+NEVER SAY DIE lets you rescue from segmentation faults.  Got a SEGV, don't
  9
+worry about it anymore!  Just rescue an exception and get on with life.
8 10
 
9 11
 == FEATURES/PROBLEMS:
10 12
 
11  
-* FIX (list of features or problems)
  13
+* Oh so many problems...
  14
+* Portability...
  15
+* Not solving the root cause..
  16
+* Just to name a few
12 17
 
13 18
 == SYNOPSIS:
14 19
 
15  
-  FIX (code sample of usage)
  20
+I will let the (passing) test speak for itself:
  21
+
  22
+  assert_raises NeverSayDie do
  23
+    NeverSayDie.segv
  24
+  end
  25
+
  26
+Here is the source of the segv method:
  27
+
  28
+  static VALUE segv(VALUE self)
  29
+  {
  30
+    int *ptr = NULL;
  31
+    *ptr = 1;
  32
+  
  33
+    return self;
  34
+  }
16 35
 
17 36
 == REQUIREMENTS:
18 37
 
19  
-* FIX (list of requirements)
  38
+* libsigsegv
20 39
 
21 40
 == INSTALL:
22 41
 
23  
-* FIX (sudo gem install, anything else)
  42
+First, install libsigsegv.  If you're on OS X, do this:
  43
+
  44
+  $ sudo port install libsigsegv
  45
+
  46
+I'm not sure about other platforms.  Then install the gem:
  47
+
  48
+  $ sudo gem install neversaydie
24 49
 
25 50
 == LICENSE:
26 51
 
27 52
 (The MIT License)
28 53
 
29  
-Copyright (c) 2009 FIX
  54
+Copyright (c) 2009 Aaron Patterson
30 55
 
31 56
 Permission is hereby granted, free of charge, to any person obtaining
32 57
 a copy of this software and associated documentation files (the
1  Rakefile
@@ -11,6 +11,7 @@ HOE = Hoe.spec name do
11 11
   self.readme_file   = 'README.rdoc'
12 12
   self.history_file  = 'CHANGELOG.rdoc'
13 13
   self.extra_rdoc_files  = FileList['*.rdoc']
  14
+  spec_extras[:extensions] = "ext/nokogiri/extconf.rb"
14 15
 end
15 16
 
16 17
 RET = Rake::ExtensionTask.new(name, HOE.spec) do |ext|
3  bin/never_say_die
... ...
@@ -1,3 +0,0 @@
1  
-#!/usr/bin/env ruby
2  
-
3  
-abort "you need to write me"
19  ext/neversaydie/neversaydie.c
@@ -10,8 +10,23 @@ static VALUE segv(VALUE self)
10 10
   return self;
11 11
 }
12 12
 
  13
+VALUE cNeverSayDie;
  14
+
  15
+void continuation(void * a, void * b, void * c)
  16
+{
  17
+  rb_raise(cNeverSayDie, "segfault at %ld", (int)a);
  18
+}
  19
+
  20
+int handler(void * fault_address, int serious)
  21
+{
  22
+  sigsegv_leave_handler(&continuation, fault_address, NULL, NULL);
  23
+  return 1;
  24
+}
  25
+
13 26
 void Init_neversaydie()
14 27
 {
15  
-  VALUE klass = rb_define_class("NeverSayDie", rb_eRuntimeError);
16  
-  rb_define_singleton_method(klass, "segv", segv, 0);
  28
+  cNeverSayDie = rb_define_class("NeverSayDie", rb_eRuntimeError);
  29
+  rb_define_singleton_method(cNeverSayDie, "segv", segv, 0);
  30
+
  31
+  sigsegv_install_handler(&handler);
17 32
 }
3  lib/never_say_die.rb
... ...
@@ -1,3 +0,0 @@
1  
-class NeverSayDie
2  
-  VERSION = '1.0.0'
3  
-end
2  test/test_never_say_die.rb
@@ -2,7 +2,7 @@
2 2
 require "neversaydie"
3 3
 
4 4
 class TestNeverSayDie < Test::Unit::TestCase
5  
-  def test_called
  5
+  def test_recovers
6 6
     assert_raises NeverSayDie do
7 7
       NeverSayDie.segv
8 8
     end

0 notes on commit d943f41

Please sign in to comment.
Something went wrong with that request. Please try again.