ginjo-rfm 3.0.1 → 3.0.4

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDkwZmQwZTdjNWVjZmQwYTc3NGZjYjFlMTI3OTAzMWRiMzBhYzZlOQ==
4
+ NmQyNjY1ZmFlZWQyMjdiYTRiMDE5NWNiY2VhMjNjOGMwNzJhZTMwMA==
5
5
  data.tar.gz: !binary |-
6
- YjMyYTRmNWFjYWUzN2ZlNmJmN2E5MWE3MDFhM2E1ZmRlMGFlNWUyZQ==
6
+ ZjYzOWNlMzAyNDRiNmZmNmM1ODczYTgyNmFjZDdlZDAyZGRhZWNkZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGFhODQ1Mjk0M2YzY2ZhNjhmYTY4NWRiNzZlYTlhZjU1YTE2MjE2NmFiZTIz
10
- NGVmYTA5YzEyMmYzNDg2NWQ5YTY0Yjk3ZGI5ZDI5ODBhMmI0ZWIzYmVlY2Vi
11
- OGVlZDE4ODk1ZDU2NDQ3YzZkNmU4NmM1OGQyNWEwNWI4MWM4ZjI=
9
+ ZjgxYThhYjcxM2E2OTE5ZTJmNjk2NGYyZmQ4ZWNlYWQ2OTAxN2RmN2ZmNjBl
10
+ OTg1NWEzZWVkYzhiODNlMTg2NzEwYWQ4MjNhZjg5MjYwZWZiMzEwNGY5OWQ3
11
+ ZjUyZTExNDVhNGVkZmE5YWM1OTFlNGVmOGFmMzJhZGFhZmU0OGE=
12
12
  data.tar.gz: !binary |-
13
- ODhiMjg0Njk1Y2UzMzk2NWY3MDRiMTA5Yzc5MmZmNzkzODQ4ZTIyYzA2YTI4
14
- ZGY0MGE4NGNkNjFlMTQ3MzZmZTQyY2YyYjNjNDc3N2I3YjQwYTBjOWRhYmVl
15
- NGU0YWMwMjgyNzQxNjNmYzJmODM0Y2Y1NDQ5MGEwMTYwYWU2YTA=
13
+ ODNmN2M4ODgzZWVmNWM2NGZhYjhlMWIxMDk5NzAyNTlhMTU3N2QyOTZkM2Q2
14
+ Zjg3MjBiMDZkYzc1MTUyY2RjYjVkMmEwMjc0M2E3YTNiNmEwZTI1YzE3OTRi
15
+ ZjRlNDQxYjVhMWMzZjg3OGVhMzM0MTAxNzY5YTNjMDhjOTUyMTQ=
data/CHANGELOG.md CHANGED
@@ -1,9 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## Ginjo-Rfm 3.0.4
4
+
5
+ * Corrected reference to @meta in fmpxmllayout.yml. Specs now passing for Layout#load\_layout.
6
+ * Added error checking to Layout#load\_layout.
7
+ * Fixed setting/saving of repeating fields. Added spec to verify.
8
+ * Fixed rspec rake task, fixed rake spec\_multi.
9
+ * Changed Ox default parse option to not encode special characters. This is now in tune with other parsers' defaults.
10
+ This fixes (among other things) URLs returned from container fields.
11
+ * Fixed error in gemspec preventing sax templates from being included in gem build.
12
+
3
13
  ## Ginjo-Rfm 3.0.0
4
14
 
5
15
  * Disabled default port in Connection (was 80), as it was tripping up connections where the port wasn't specified for a :use\_ssl connection on older Rubies.
6
- * Enabled :ignore\_portals option.
16
+ * Fixes to :ignore\_portals option.
7
17
  * Removed runtime dependency on activesupport from gemspec.
8
18
  * Added check in Field#coerce to make sure a '?' is in a string before splitting on '?'. This was breaking repeating container fields.
9
19
  * Fixed case mismatch in hash key in Factory classes. Added logging of parsing template to logging of parsing backend.
@@ -17,8 +27,6 @@
17
27
  * Refined multiple :use handling in Config.
18
28
  * Using rspec 2
19
29
  * Removed SubLayout.
20
- * Added field-mapping awareness to :sort\_field query option.
21
- * Relaxed requirement that query option keys be symbols - can now be strings.
22
30
  * Record.new now automatically creats models based on layout name. Should there be an option to disable this?
23
31
  * Removed ActiveSupport requirement (of course, ActiveSupport will load if ActiveModle is used, but that is the users' choice).
24
32
  * Removed XmlMini, XmlParser, and related code & specs.
@@ -34,6 +42,11 @@
34
42
  * Added connection.rb and moved some methods from Server to Connection.
35
43
  * Sax parsing rewrite.
36
44
 
45
+ ## Ginjo-Rfm 2.1.7
46
+
47
+ * Added field\_mapping awareness to :sort\_field query option.
48
+ * Relaxed requirement that query option keys be symbols - can now be strings.
49
+
37
50
  ## Ginjo-Rfm 2.1.6
38
51
 
39
52
  * Fixed typo in Rfm::Record#[]=
@@ -65,9 +78,9 @@
65
78
 
66
79
  ## Ginjo-Rfm 2.1.0
67
80
 
68
- * Removed `:include\_portals` query option in favor of `:ignore\_portals`.
81
+ * Removed `:include_portals` query option in favor of `:ignore_portals`.
69
82
 
70
- * Added `:max\_portal\_rows` query option.
83
+ * Added `:max_portal_rows` query option.
71
84
 
72
85
  * Added field-remapping framework to allow model fields with different names than Filemaker fields.
73
86
 
@@ -192,7 +205,7 @@
192
205
 
193
206
  Example:
194
207
 
195
- result = fm\_server('layout').find({:username => "==#{username}"}, {:include\_portals => true})
208
+ result = fm_server('layout').find({:username => "==#{username}"}, {:include_portals => true})
196
209
  # => This will fetch all records with portal records attached.
197
210
 
198
211
  result.first.portals
data/lib/rfm/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.1
1
+ 3.0.4
data/lib/rfm/layout.rb CHANGED
@@ -303,10 +303,22 @@ module Rfm
303
303
  prms = params.merge(extra_params)
304
304
  map = field_mapping.invert
305
305
  options.merge!({:field_mapping => map}) if map && !map.empty?
306
- # TODO: Make this part handle string AND symbol keys.
306
+ # TODO: Make this part handle string AND symbol keys. (isn't this already done?)
307
307
  #map.each{|k,v| prms[k]=prms.delete(v) if prms[v]}
308
- prms.dup.each_key{|k| prms[map[k.to_s]]=prms.delete(k) if map[k.to_s]}
309
-
308
+
309
+ #prms.dup.each_key{|k| prms[map[k.to_s]]=prms.delete(k) if map[k.to_s]}
310
+ prms.dup.each_key do |k|
311
+ new_key = map[k.to_s] || k
312
+ if prms[new_key].is_a? Array
313
+ prms[new_key].each_with_index do |v, i|
314
+ prms["#{new_key}(#{i+1})"]=v
315
+ end
316
+ prms.delete new_key
317
+ else
318
+ prms[new_key]=prms.delete(k) if new_key != k
319
+ end
320
+ end
321
+
310
322
  #c = Connection.new(action, prms, options, state.merge(:parent=>self))
311
323
  c = Connection.new(action, prms, options, self)
312
324
  rslt = c.parse(template || :fmresultset, Rfm::Resultset.new(self, self))
@@ -374,14 +386,24 @@ module Rfm
374
386
  ### Utility ###
375
387
 
376
388
  def load_layout
377
- @loaded = true # This is first so parsing call to 'meta' wont cause infinite loop.
389
+ #@loaded = true # This is first so parsing call to 'meta' wont cause infinite loop,
390
+ # but I changed parsing template to refer directly to inst var instead of accessor method.
378
391
  connection = Connection.new('-view', {'-db' => state[:database], '-lay' => name}, {:grammar=>'FMPXMLLAYOUT'}, self)
379
- rslt = connection.parse(:fmpxmllayout, self)
380
- #puts ["LAYOUT#load_layout result", rslt.class].join(', ')
381
- # @loaded = true
392
+ begin
393
+ connection.parse(:fmpxmllayout, self)
394
+ @loaded = true
395
+ rescue
396
+ @meta.clear
397
+ raise $!
398
+ end
382
399
  @meta
383
400
  end
384
401
 
402
+ def check_for_errors(code=@meta['error'].to_i, raise_401=state[:raise_401])
403
+ #puts ["\nRESULTSET#check_for_errors", code, raise_401]
404
+ raise Rfm::Error.getError(code) if code != 0 && (code != 401 || raise_401)
405
+ end
406
+
385
407
  def field_mapping
386
408
  @field_mapping ||= load_field_mapping(state[:field_mapping])
387
409
  end
@@ -417,7 +439,7 @@ module Rfm
417
439
  end
418
440
 
419
441
 
420
- private :load_layout, :get_records, :params
442
+ private :load_layout, :get_records, :params, :check_for_errors
421
443
 
422
444
 
423
445
  end # Layout
@@ -14,8 +14,7 @@ elements:
14
14
  attach: none
15
15
  - name: errorcode
16
16
  attach: none
17
- # TODO: Build check_for_errors method in Layout class.
18
- #before_close: 'check_for_errors'
17
+ before_close: 'check_for_errors'
19
18
  attributes:
20
19
  - name: text
21
20
  as_name: error
@@ -29,7 +28,9 @@ elements:
29
28
  - name: NAME
30
29
  as_name: name
31
30
  - name: field
32
- handler: [object.meta, handle_new_field_control, _attributes]
31
+ # Used to be 'object.meta', but that required sloppy 'loaded' indicator handling (or infinite loop),
32
+ # so now just referring to raw inst var @meta, instead of method .meta.
33
+ handler: [object.instance_variable_get('@meta'), handle_new_field_control, _attributes]
33
34
  attach_attributes: private
34
35
  elements:
35
36
  - name: style
@@ -711,10 +711,11 @@ module Rfm
711
711
  include Handler
712
712
 
713
713
  def run_parser(io)
714
+ options={:convert_special=>true}
714
715
  case
715
- when (io.is_a?(File) or io.is_a?(StringIO)); Ox.sax_parse self, io
716
- when io.to_s[/^</]; StringIO.open(io){|f| Ox.sax_parse self, f}
717
- else File.open(io){|f| Ox.sax_parse self, f}
716
+ when (io.is_a?(File) or io.is_a?(StringIO)); Ox.sax_parse self, io, options
717
+ when io.to_s[/^</]; StringIO.open(io){|f| Ox.sax_parse self, f, options}
718
+ else File.open(io){|f| Ox.sax_parse self, f, options}
718
719
  end
719
720
  end
720
721
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ginjo-rfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoff Coffey
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-07-07 00:00:00.000000000 Z
15
+ date: 2014-07-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activemodel
@@ -112,6 +112,20 @@ dependencies:
112
112
  - - ! '>='
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
+ - !ruby/object:Gem::Dependency
116
+ name: ruby-prof
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ! '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
115
129
  - !ruby/object:Gem::Dependency
116
130
  name: libxml-ruby
117
131
  requirement: !ruby/object:Gem::Requirement