nestegg 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 0.0.2 2007-06-26
2
+
3
+ * Minor tweaks to backtrace formatting and addition of example code.
4
+
1
5
  == 0.0.1 2007-06-24
2
6
 
3
7
  * 1 major enhancement:
@@ -3,6 +3,7 @@ License.txt
3
3
  Manifest.txt
4
4
  README.txt
5
5
  Rakefile
6
+ examples/nestegg_example.rb
6
7
  lib/nestegg.rb
7
8
  lib/nestegg/nesting_exception.rb
8
9
  lib/nestegg/version.rb
data/README.txt CHANGED
@@ -1,3 +1,4 @@
1
1
  README for nestegg
2
2
  ==================
3
3
 
4
+ For examples and more, see http://nestegg.rubyforge.org/.
data/Rakefile CHANGED
@@ -13,8 +13,8 @@ include FileUtils
13
13
  require File.join(File.dirname(__FILE__), 'lib', 'nestegg', 'version')
14
14
 
15
15
  AUTHOR = 'John D. Hume' # can also be an array of Authors
16
- EMAIL = ""
17
- DESCRIPTION = "Nestegg provides a facility for nesting exceptions in Ruby"
16
+ EMAIL = "duelin dot markers at gmail"
17
+ DESCRIPTION = "Nestegg provides a facility for nesting exceptions in Ruby."
18
18
  GEM_NAME = 'nestegg' # what ppl will type to install your gem
19
19
 
20
20
  @config_file = "~/.rubyforge/user-config.yml"
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'nestegg'
3
+
4
+ class ConfigurationError < StandardError
5
+ include Nestegg::NestingException
6
+ end
7
+
8
+ def read_config_file
9
+ File.open('missing_config_file') do |f|
10
+ f.readlines
11
+ end
12
+ end
13
+
14
+ def load_config
15
+ begin
16
+ lines = read_config_file
17
+ # ... then use it to do stuff
18
+ # ... stuff that might fail for other reasons
19
+ rescue
20
+ raise ConfigurationError
21
+ end
22
+ end
23
+
24
+ load_config
@@ -16,7 +16,7 @@ module Nestegg
16
16
  break
17
17
  end
18
18
  end
19
- bt << "Caused by: #{cause}"
19
+ bt << "cause: #{cause.class.name}: #{cause}"
20
20
  bt.concat cause.backtrace
21
21
  end
22
22
  super bt
@@ -2,7 +2,7 @@ module Nestegg #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -24,14 +24,14 @@ class NestingExceptionTest < Test::Unit::TestCase
24
24
  test "includes cause in backtrace" do
25
25
  cause = create_cause(StandardError)
26
26
  with_exception TestNestingError.new("some message", cause) do |e|
27
- assert_true e.backtrace.include?("Caused by: #{cause.to_s}")
27
+ assert_true e.backtrace.include?("cause: StandardError: #{cause.message}")
28
28
  end
29
29
  end
30
30
 
31
31
  test "includes cause and its backtrace in backtrace" do
32
32
  cause = create_cause(StandardError)
33
33
  with_exception TestNestingError.new("some message", cause) do |e|
34
- assert_equal ["Caused by: #{cause.to_s}", "line_one", "line_two"], e.backtrace[-3..-1]
34
+ assert_equal ["cause: StandardError: #{cause.message}", "line_one", "line_two"], e.backtrace[-3..-1]
35
35
  end
36
36
  end
37
37
 
@@ -42,7 +42,7 @@ class NestingExceptionTest < Test::Unit::TestCase
42
42
  raise TestNestingError.new("msg", cause)
43
43
  rescue TestNestingError => e
44
44
  assert_match(/#{__FILE__}:\d+:in `test_.+'$/, e.backtrace[0])
45
- assert_equal "Caused by: msg", e.backtrace[1]
45
+ assert_equal "cause: StandardError: msg", e.backtrace[1]
46
46
  end
47
47
  end
48
48
 
@@ -2,9 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper.rb')
2
2
 
3
3
  class NesteggTest < Test::Unit::TestCase
4
4
 
5
- def setup
6
- end
7
-
8
5
  def test_truth
9
6
  puts "HEY! delete #{__FILE__} if the module is just a namespace, or else test that it requires the right stuff"
10
7
  end
@@ -5,7 +5,7 @@
5
5
  <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
6
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
7
  <title>
8
- nestegg
8
+ Nestegg
9
9
  </title>
10
10
  <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
11
  <style>
@@ -30,10 +30,10 @@
30
30
  <body>
31
31
  <div id="main">
32
32
 
33
- <h1>nestegg</h1>
33
+ <h1>Nestegg</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/nestegg"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/nestegg" class="numbers">0.0.1</a>
36
+ <a href="http://rubyforge.org/projects/nestegg" class="numbers">0.0.2</a>
37
37
  </div>
38
38
  <h1>&#x2192; &#8216;nestegg&#8217;</h1>
39
39
 
@@ -47,30 +47,54 @@
47
47
  <h2>Installing</h2>
48
48
 
49
49
 
50
- <pre syntax="ruby">sudo gem install nestegg</pre>
50
+ <pre>sudo gem install nestegg</pre>
51
51
 
52
52
  <h2>The basics</h2>
53
53
 
54
54
 
55
- <p><span class="caps">TODO</span></p>
55
+ <p>Sometimes exceptions cause other exceptions. Nestegg aims to make it easier to raise exceptions with useful contextual information without loss of detail about the underlying exception.</p>
56
56
 
57
57
 
58
58
  <h2>Demonstration of usage</h2>
59
59
 
60
60
 
61
- <p><span class="caps">TODO</span></p>
61
+ <pre syntax="ruby">require 'rubygems'
62
+ require 'nestegg'
62
63
 
64
+ class ConfigurationError &lt; StandardError
65
+ include Nestegg::NestingException
66
+ end
63
67
 
64
- <h2>Forum</h2>
68
+ def read_config_file
69
+ File.open('missing_config_file') do |f|
70
+ f.readlines
71
+ end
72
+ end
65
73
 
74
+ def load_config
75
+ begin
76
+ lines = read_config_file
77
+ # ... then use it to do stuff
78
+ # ... stuff that might fail for other reasons
79
+ rescue
80
+ raise ConfigurationError
81
+ end
82
+ end
66
83
 
67
- <p><a href="http://rubyforge.org/forum/?group_id=3908">Forums at RubyForge</a></p>
84
+ load_config</pre>
68
85
 
86
+ <p>outputs</p>
69
87
 
70
- <h2>How to submit patches</h2>
71
88
 
89
+ <pre>nestegg_example.rb:20:in `load_config': ConfigurationError (ConfigurationError)
90
+ from cause: Errno::ENOENT: No such file or directory - missing_config_file
91
+ from nestegg_example.rb:9:in `initialize'
92
+ from nestegg_example.rb:9:in `open'
93
+ from nestegg_example.rb:9:in `read_config_file'
94
+ from nestegg_example.rb:16:in `load_config'
95
+ from nestegg_example.rb:24</pre>
72
96
 
73
- <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a></p>
97
+ <h2>Code</h2>
74
98
 
75
99
 
76
100
  <p>The trunk repository is <code>svn://rubyforge.org/var/svn/nestegg/trunk</code> for anonymous access.</p>
@@ -85,9 +109,10 @@
85
109
  <h2>Contact</h2>
86
110
 
87
111
 
88
- <p>Comments are welcome. Contact me via <a href="http://elhumidor.blogspot.com/">my blog</a> or on the forums.</p>
112
+ <p>Comments are welcome. Contact me via <a href="http://elhumidor.blogspot.com/">my blog</a> or email.</p>
89
113
  <p class="coda">
90
- <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 25th June 2007<br>
114
+ Last modified 26th June 2007<br>
115
+ This website generated by the <a href="http://newgem.rubyforge.org/">New Gem Generator</a> by <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a><br>
91
116
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
92
117
  </p>
93
118
  </div>
@@ -1,4 +1,4 @@
1
- h1. nestegg
1
+ h1. Nestegg
2
2
 
3
3
  h1. &#x2192; 'nestegg'
4
4
 
@@ -9,23 +9,50 @@ Nestegg provides a nested exception facility for Ruby.
9
9
 
10
10
  h2. Installing
11
11
 
12
- <pre syntax="ruby">sudo gem install nestegg</pre>
12
+ <pre>sudo gem install nestegg</pre>
13
13
 
14
14
  h2. The basics
15
15
 
16
- TODO
16
+ Sometimes exceptions cause other exceptions. Nestegg aims to make it easier to raise exceptions with useful contextual information without loss of detail about the underlying exception.
17
17
 
18
18
  h2. Demonstration of usage
19
19
 
20
- TODO
20
+ <pre syntax="ruby">require 'rubygems'
21
+ require 'nestegg'
21
22
 
22
- h2. Forum
23
+ class ConfigurationError < StandardError
24
+ include Nestegg::NestingException
25
+ end
23
26
 
24
- "Forums at RubyForge":http://rubyforge.org/forum/?group_id=3908
27
+ def read_config_file
28
+ File.open('missing_config_file') do |f|
29
+ f.readlines
30
+ end
31
+ end
25
32
 
26
- h2. How to submit patches
33
+ def load_config
34
+ begin
35
+ lines = read_config_file
36
+ # ... then use it to do stuff
37
+ # ... stuff that might fail for other reasons
38
+ rescue
39
+ raise ConfigurationError
40
+ end
41
+ end
27
42
 
28
- Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/
43
+ load_config</pre>
44
+
45
+ outputs
46
+
47
+ <pre>nestegg_example.rb:20:in `load_config': ConfigurationError (ConfigurationError)
48
+ from cause: Errno::ENOENT: No such file or directory - missing_config_file
49
+ from nestegg_example.rb:9:in `initialize'
50
+ from nestegg_example.rb:9:in `open'
51
+ from nestegg_example.rb:9:in `read_config_file'
52
+ from nestegg_example.rb:16:in `load_config'
53
+ from nestegg_example.rb:24</pre>
54
+
55
+ h2. Code
29
56
 
30
57
  The trunk repository is <code>svn://rubyforge.org/var/svn/nestegg/trunk</code> for anonymous access.
31
58
 
@@ -35,6 +62,5 @@ This code is free to use under the terms of the MIT license.
35
62
 
36
63
  h2. Contact
37
64
 
38
- Comments are welcome. Contact me via "my blog":http://elhumidor.blogspot.com/ or on the forums.
65
+ Comments are welcome. Contact me via "my blog":http://elhumidor.blogspot.com/ or email.
39
66
 
40
- This site generated by newgem.
@@ -37,7 +37,8 @@
37
37
  </div>
38
38
  <%= body %>
39
39
  <p class="coda">
40
- <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, <%= modified.pretty %><br>
40
+ Last modified <%= modified.pretty %><br>
41
+ This website generated by the <a href="http://newgem.rubyforge.org/">New Gem Generator</a> by <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a><br>
41
42
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
42
43
  </p>
43
44
  </div>
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: nestegg
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
6
+ version: 0.0.2
7
7
  date: 2007-06-26 00:00:00 -04:00
8
- summary: Nestegg provides a facility for nesting exceptions in Ruby
8
+ summary: Nestegg provides a facility for nesting exceptions in Ruby.
9
9
  require_paths:
10
10
  - lib
11
- email: ""
11
+ email: duelin dot markers at gmail
12
12
  homepage: http://nestegg.rubyforge.org
13
13
  rubyforge_project: nestegg
14
- description: Nestegg provides a facility for nesting exceptions in Ruby
14
+ description: Nestegg provides a facility for nesting exceptions in Ruby.
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -34,6 +34,7 @@ files:
34
34
  - Manifest.txt
35
35
  - README.txt
36
36
  - Rakefile
37
+ - examples/nestegg_example.rb
37
38
  - lib/nestegg.rb
38
39
  - lib/nestegg/nesting_exception.rb
39
40
  - lib/nestegg/version.rb