marcspec 1.6.1 → 1.6.3

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/CHANGES CHANGED
@@ -1,6 +1,10 @@
1
+ 1.6.3
2
+ * Fixed bad calls to logback::simple "log" object in class methods, where it wasn't available
3
+
4
+ 1.6.2
5
+ * When declaring a function using the DSL, make sure it is defined in the given module
1
6
  1.6.1
2
7
  * Change VariableField#asDSLString to reflect compact declaration of spec with subs
3
-
4
8
  1.6.0
5
9
  * Allow specs like spec('245ac'), with or without a block as well.
6
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.1
1
+ 1.6.3
data/lib/marcspec/dsl.rb CHANGED
@@ -138,6 +138,17 @@ module MARCSpec
138
138
  end
139
139
 
140
140
  def mod(constant)
141
+ # Is the module loaded?
142
+
143
+ unless defined? constant
144
+ raise ArgumentError, "Module #{constant} unknown; do you need to make sure it gets loaded?"
145
+ end
146
+
147
+ # Check to see if the functionSymbol exists
148
+ unless constant.singleton_methods.include? self.functionSymbol.to_s
149
+ raise ArgumentError, "Function #{self.functionSymbol} not defined in module #{constant}"
150
+ end
151
+
141
152
  self.module = constant
142
153
  end
143
154
 
data/lib/marcspec/map.rb CHANGED
@@ -35,14 +35,14 @@ module MARCSpec
35
35
  begin
36
36
  str = File.open(filename).read
37
37
  rescue Exception => e
38
- log.fatal "Problem opening #{filename}: #{e.message}"
38
+ Logback::Simple::Logger.fatal "Problem opening #{filename}: #{e.message}"
39
39
  raise e
40
40
  end
41
41
 
42
42
  begin
43
43
  rawmap = eval(str)
44
44
  rescue Exception => e
45
- log.fatal "Problem evaluating (with 'eval') file #{filename}: #{e.message}"
45
+ Logback::Simple::Logger.fatal "Problem evaluating (with 'eval') file #{filename}: #{e.message}"
46
46
  raise e
47
47
  end
48
48
 
@@ -59,7 +59,7 @@ module MARCSpec
59
59
  when :multi
60
60
  return MultiValueMap.new(rawmap[:mapname], rawmap[:map])
61
61
  else
62
- log.fatal "Map file #{filename} doesn't seem to be either a KV map or a MuliValueMap according to :maptype (#{rawmap[:maptype]})"
62
+ Logback::Simple::Logger.fatal "Map file #{filename} doesn't seem to be either a KV map or a MuliValueMap according to :maptype (#{rawmap[:maptype]})"
63
63
  raise ArgumentError, "File #{filename} doesn't evaluate to a valid map"
64
64
  end
65
65
 
@@ -24,12 +24,11 @@ module MARCSpec
24
24
 
25
25
  def initialize *args
26
26
  super(*args)
27
- self.optimize
27
+ self.optimize if @map and @mapname
28
28
  end
29
29
 
30
30
  def map= map
31
31
  @map = map
32
- self.optimize
33
32
  end
34
33
 
35
34
 
@@ -98,7 +97,10 @@ module MARCSpec
98
97
  kvlist << [Regexp.new(match[1]), match[2]]
99
98
  end
100
99
  end
101
- return self.new(mapname, kvlist)
100
+ rv = self.new(nil,nil) # empty; avoid the optimize
101
+ rv.mapname = mapname
102
+ rv.map = kvlist
103
+ return rv
102
104
  end
103
105
 
104
106
  # Produce a string suitable for pretty-printing. Unfortunately, we need to just plain
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 6
8
- - 1
9
- version: 1.6.1
8
+ - 3
9
+ version: 1.6.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - BillDueber
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-05 00:00:00 -04:00
17
+ date: 2010-10-08 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency