polyglot 0.2.7 → 0.2.8

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.
@@ -1,3 +1,8 @@
1
+ == 0.2.8 2009-08-18
2
+
3
+ * 1 minor fix:
4
+ * Previous fix for LoadErrors failed for cucumber.
5
+
1
6
  == 0.2.7 2009-08-17
2
7
 
3
8
  * 1 minor fix:
@@ -4,8 +4,15 @@ require 'pathname'
4
4
  module Polyglot
5
5
  @registrations ||= {} # Guard against reloading
6
6
  @loaded ||= {}
7
-
8
- class PolyglotLoadError < LoadError; end
7
+
8
+ class NestedLoadError < LoadError
9
+ def initialize le
10
+ @le = le
11
+ end
12
+ def reraise
13
+ raise @le
14
+ end
15
+ end
9
16
 
10
17
  def self.register(extension, klass)
11
18
  extension = [extension] unless Enumerable === extension
@@ -36,14 +43,18 @@ module Polyglot
36
43
  begin
37
44
  source_file, loader = Polyglot.find(file, *a[1..-1], &b)
38
45
  if (loader)
39
- loader.load(source_file)
40
- @loaded[file] = true
46
+ begin
47
+ loader.load(source_file)
48
+ @loaded[file] = true
49
+ rescue LoadError => e
50
+ raise Polyglot::NestedLoadError.new(e)
51
+ end
41
52
  else
42
53
  msg = "Failed to load #{file} using extensions #{(@registrations.keys+["rb"]).sort*", "}"
43
54
  if defined?(MissingSourceFile)
44
55
  raise MissingSourceFile.new(msg, file)
45
56
  else
46
- raise PolyglotLoadError.new(msg)
57
+ raise LoadError.new(msg)
47
58
  end
48
59
  end
49
60
  end
@@ -58,7 +69,9 @@ module Kernel
58
69
  rescue LoadError => load_error
59
70
  begin
60
71
  Polyglot.load(*a, &b)
61
- rescue Polyglot::PolyglotLoadError
72
+ rescue Polyglot::NestedLoadError => e
73
+ e.reraise
74
+ rescue LoadError
62
75
  # Raise the original exception, possibly a MissingSourceFile with a path
63
76
  raise load_error
64
77
  end
@@ -2,7 +2,7 @@ module Polyglot #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 7
5
+ TINY = 8
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyglot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clifford Heath
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-17 00:00:00 +10:00
12
+ date: 2009-08-18 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency