CFPropertyList 2.1.1 → 2.1.2

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.
Binary file
@@ -0,0 +1,11 @@
1
+ $:.push('.')
2
+ require 'rbCFPropertyList'
3
+ ahash = {"SALTED-SHA512"=> "\214\351\005 \250\224\204\2510M\231\004\312YH\336yk\v\372\313\v\236\372u\255g\177\343\234$wh\221\001\220@/\343:\227\270\203\214g\320\361%'\315J/\t\317\354\275\017\000\241\225\302\322G\026& \205\344"}
4
+ ahash["SALTED-SHA512"].blob = true
5
+ bpl = CFPropertyList::List.new
6
+ bpl.value = CFPropertyList.guess(ahash)
7
+ results = bpl.to_str
8
+
9
+ fd = File.open("lala.plist", "wb")
10
+ fd.write results
11
+ fd.close
@@ -43,6 +43,10 @@ require 'time'
43
43
  # Copyright:: Copyright (c) 2010
44
44
  # License:: MIT License
45
45
  module CFPropertyList
46
+ class << self
47
+ attr_accessor :xml_parser_interface
48
+ end
49
+
46
50
  # interface class for PList parsers
47
51
  class ParserInterface
48
52
  # load a plist
@@ -107,16 +111,20 @@ end
107
111
 
108
112
  begin
109
113
  require dirname + '/rbLibXMLParser.rb'
114
+ temp = LibXML::XML::Parser::Options::NOBLANKS; # check if we have a version with parser options
110
115
  try_nokogiri = false
111
- rescue LoadError => e
116
+ CFPropertyList.xml_parser_interface = CFPropertyList::LibXMLParser
117
+ rescue LoadError, NameError
112
118
  try_nokogiri = true
113
119
  end
114
120
 
115
121
  if try_nokogiri then
116
122
  begin
117
123
  require dirname + '/rbNokogiriParser.rb'
124
+ CFPropertyList.xml_parser_interface = CFPropertyList::NokogiriXMLParser
118
125
  rescue LoadError => e
119
126
  require dirname + '/rbREXMLParser.rb'
127
+ CFPropertyList.xml_parser_interface = CFPropertyList::ReXMLParser
120
128
  end
121
129
  end
122
130
 
@@ -220,7 +228,7 @@ module CFPropertyList
220
228
  # Format constant for automatic format recognizing
221
229
  FORMAT_AUTO = 0
222
230
 
223
- @@parsers = [Binary,XML]
231
+ @@parsers = [Binary, CFPropertyList.xml_parser_interface]
224
232
 
225
233
  # Path of PropertyList
226
234
  attr_accessor :filename
@@ -291,7 +299,7 @@ module CFPropertyList
291
299
  raise CFFormatError.new("Wong file version #{version}") unless version == "00"
292
300
  prsr = Binary.new
293
301
  else
294
- prsr = XML.new
302
+ prsr = CFPropertyList.xml_parser_interface.new
295
303
  end
296
304
 
297
305
  @value = prsr.load({:data => str})
@@ -323,7 +331,7 @@ module CFPropertyList
323
331
  raise CFFormatError.new("Wong file version #{version}") unless version == "00"
324
332
  prsr = Binary.new
325
333
  else
326
- prsr = XML.new
334
+ prsr = CFPropertyList.xml_parser_interface.new
327
335
  end
328
336
 
329
337
  @value = prsr.load({:file => file})
@@ -366,6 +374,7 @@ module CFPropertyList
366
374
  end
367
375
  end
368
376
 
377
+
369
378
  class Array
370
379
  # convert an array to plist format
371
380
  def to_plist(options={})
@@ -4,7 +4,7 @@ require 'libxml'
4
4
 
5
5
  module CFPropertyList
6
6
  # XML parser
7
- class XML < XMLParserInterface
7
+ class LibXMLParser < XMLParserInterface
8
8
  # read a XML file
9
9
  # opts::
10
10
  # * :file - The filename of the file to load
@@ -4,7 +4,7 @@ require 'nokogiri'
4
4
 
5
5
  module CFPropertyList
6
6
  # XML parser
7
- class XML < ParserInterface
7
+ class NokogiriXMLParser < ParserInterface
8
8
  # read a XML file
9
9
  # opts::
10
10
  # * :file - The filename of the file to load
@@ -4,7 +4,7 @@ require 'rexml/document'
4
4
 
5
5
  module CFPropertyList
6
6
  # XML parser
7
- class XML < ParserInterface
7
+ class ReXMLParser < ParserInterface
8
8
  # read a XML file
9
9
  # opts::
10
10
  # * :file - The filename of the file to load
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CFPropertyList
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-07 00:00:00.000000000 Z
12
+ date: 2012-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &6863720 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,12 @@ dependencies:
21
21
  version: 0.7.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *6863720
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.7.0
25
30
  description: This is a module to read, write and manipulate both binary and XML property
26
31
  lists as defined by apple.
27
32
  email: cjk@wwwtech.de
@@ -30,14 +35,16 @@ extensions: []
30
35
  extra_rdoc_files:
31
36
  - README
32
37
  files:
38
+ - lib/cfpropertylist.rb
39
+ - lib/lala.plist
40
+ - lib/my_test.rb
33
41
  - lib/rbBinaryCFPropertyList.rb
34
- - lib/rbREXMLParser.rb
35
42
  - lib/rbCFPlistError.rb
36
- - lib/rbLibXMLParser.rb
43
+ - lib/rbCFPropertyList.rb
37
44
  - lib/rbCFTypes.rb
45
+ - lib/rbLibXMLParser.rb
38
46
  - lib/rbNokogiriParser.rb
39
- - lib/rbCFPropertyList.rb
40
- - lib/cfpropertylist.rb
47
+ - lib/rbREXMLParser.rb
41
48
  - README
42
49
  homepage: http://github.com/ckruse/CFPropertyList
43
50
  licenses: []
@@ -59,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
66
  version: '0'
60
67
  requirements: []
61
68
  rubyforge_project:
62
- rubygems_version: 1.8.15
69
+ rubygems_version: 1.8.23
63
70
  signing_key:
64
71
  specification_version: 3
65
72
  summary: Read, write and manipulate both binary and XML property lists as defined