CFPropertyList 2.3.6 → 3.0.5

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,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8ee90589694090934993f07e976e2a3b3d963b0c
4
- data.tar.gz: 4724d0d07877da7f55cd4d1670a2f76443c5389f
2
+ SHA256:
3
+ metadata.gz: 8c0a5cbb9e2df1216733df683ea384fc16c6bc4cf391ba5d5a211d503fa81b39
4
+ data.tar.gz: ccb49926da5d6c487cf60b55824fdc1f1c58d58dff1f6a2ef0bc68420899efa2
5
5
  SHA512:
6
- metadata.gz: 5897d5931e85e448f9f8899925971420085af1b78af282161c08890044003f1270080da3937674fce5dad24419dc4662803422b7de51075b419e16798b9e80f4
7
- data.tar.gz: 94b561dd3c6b0c0ddfdbec0ea6918183c54e3cda1ca00d80ea05916dc56c3e200aeb65d76f7738782380e0ffd06a874937545ecf27c4f43d26e8baacd08d5234
6
+ metadata.gz: d44a547b9efb6e3dc36cb3c78a1c4735c62ec242c12ea01158a85ee10033ae391f325663253ae8e0df90347a40ac92ca626df39308b150a327581ffd1aef842c
7
+ data.tar.gz: c95903238e74197c99628fc7bfd9263a09a93c33184da8b39a03e49adeaf77ba693d64c5fca62a5bdb305933b1edbaec4fb19075a54b5bd47a6633a26e868dda
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ CFPropertyList implementation
2
+ class to read, manipulate and write both XML and binary property list
3
+ files (plist(5)) as defined by Apple. Have a look at CFPropertyList::List
4
+ for more documentation.
5
+
6
+ # Caution!
7
+
8
+ In version 3.0.0 we dropped Ruby 1.8 compatibility. If you are using
9
+ Ruby 1.8 consider to update Ruby; if you can't upgrade, don't upgrade
10
+ CFPropertyList.
11
+
12
+ # Installation
13
+
14
+ You could either use ruby gems and install it via
15
+
16
+ ```bash
17
+ gem install CFPropertyList
18
+ ```
19
+
20
+ or you could clone this repository and place it somewhere in your load path.
21
+
22
+ Example:
23
+ ```ruby
24
+ require 'cfpropertylist'
25
+ ```
26
+
27
+ If you're using Rails, you can add it into your Gemfile
28
+
29
+ ```ruby
30
+ gem 'CFPropertyList'
31
+ ```
32
+
33
+ # Usage
34
+
35
+ ## create a arbitrary data structure of basic data types
36
+
37
+ ```ruby
38
+ data = {
39
+ 'name' => 'John Doe',
40
+ 'missing' => true,
41
+ 'last_seen' => Time.now,
42
+ 'friends' => ['Jane Doe','Julian Doe'],
43
+ 'likes' => {
44
+ 'me' => false
45
+ }
46
+ }
47
+ ```
48
+
49
+ ## create CFPropertyList::List object
50
+
51
+ ```ruby
52
+ plist = CFPropertyList::List.new
53
+ ```
54
+
55
+ ## call CFPropertyList.guess() to create corresponding CFType values
56
+
57
+ ```ruby
58
+ plist.value = CFPropertyList.guess(data)
59
+ ```
60
+
61
+ ## write plist to file
62
+ ```ruby
63
+ plist.save("example.plist", CFPropertyList::List::FORMAT_BINARY)
64
+ ```
65
+
66
+ ## … later, read it again
67
+ ```ruby
68
+ plist = CFPropertyList::List.new(:file => "example.plist")
69
+ data = CFPropertyList.native_types(plist.value)
70
+ ```
71
+
72
+ # Author and license
73
+
74
+ **Author:** Christian Kruse (mailto:cjk@wwwtech.de)
75
+
76
+ **Copyright:** Copyright (c) 2010
77
+
78
+ **License:** MIT License
79
+
@@ -41,4 +41,3 @@ or you could clone this repository and place it somewhere in your load path.
41
41
  Author:: Christian Kruse (mailto:cjk@wwwtech.de)
42
42
  Copyright:: Copyright (c) 2010
43
43
  License:: MIT License
44
-
@@ -72,28 +72,12 @@ module CFPropertyList
72
72
  end
73
73
  end
74
74
 
75
- class String
76
- unless("".respond_to?(:bytesize)) then
77
- def bytesize
78
- self.length
79
- end
80
- end
81
- end
82
-
83
75
  dirname = File.dirname(__FILE__)
84
76
  require dirname + '/rbCFPlistError.rb'
85
77
  require dirname + '/rbCFTypes.rb'
86
78
  require dirname + '/rbBinaryCFPropertyList.rb'
87
79
  require dirname + '/rbPlainCFPropertyList.rb'
88
80
 
89
- require 'iconv' unless "".respond_to?("encode")
90
-
91
- # ensure that the module and class exist
92
- module Enumerable
93
- class Enumerator
94
- end
95
- end
96
-
97
81
  begin
98
82
  require dirname + '/rbLibXMLParser.rb'
99
83
  temp = LibXML::XML::Parser::Options::NOBLANKS # check if we have a version with parser options
@@ -144,7 +128,7 @@ module CFPropertyList
144
128
  when Time, DateTime, Date
145
129
  CFDate.new(object)
146
130
 
147
- when Array, Enumerator, Enumerable::Enumerator
131
+ when Array, Enumerator
148
132
  ary = Array.new
149
133
  object.each do |o|
150
134
  ary.push CFPropertyList.guess(o, options)
@@ -213,7 +197,7 @@ module CFPropertyList
213
197
 
214
198
  module_function :guess, :native_types
215
199
 
216
- # Class representing a CFPropertyList. Instanciate with #new
200
+ # Class representing a CFPropertyList. Instantiate with #new
217
201
  class List
218
202
  # Format constant for binary format
219
203
  FORMAT_BINARY = 1
@@ -5,6 +5,8 @@ require 'libxml'
5
5
  module CFPropertyList
6
6
  # XML parser
7
7
  class LibXMLParser < XMLParserInterface
8
+ LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER)
9
+ PARSER_OPTIONS = LibXML::XML::Parser::Options::NOBLANKS|LibXML::XML::Parser::Options::NONET
8
10
  # read a XML file
9
11
  # opts::
10
12
  # * :file - The filename of the file to load
@@ -13,9 +15,9 @@ module CFPropertyList
13
15
  doc = nil
14
16
 
15
17
  if(opts.has_key?(:file)) then
16
- doc = LibXML::XML::Document.file(opts[:file],:options => LibXML::XML::Parser::Options::NOBLANKS|LibXML::XML::Parser::Options::NOENT)
18
+ doc = LibXML::XML::Document.file(opts[:file],:options => PARSER_OPTIONS)
17
19
  else
18
- doc = LibXML::XML::Document.string(opts[:data],:options => LibXML::XML::Parser::Options::NOBLANKS|LibXML::XML::Parser::Options::NOENT)
20
+ doc = LibXML::XML::Document.string(opts[:data],:options => PARSER_OPTIONS)
19
21
  end
20
22
 
21
23
  if doc
@@ -5,6 +5,7 @@ require 'nokogiri'
5
5
  module CFPropertyList
6
6
  # XML parser
7
7
  class NokogiriXMLParser < ParserInterface
8
+ PARSER_OPTIONS = Nokogiri::XML::ParseOptions::NOBLANKS|Nokogiri::XML::ParseOptions::NONET
8
9
  # read a XML file
9
10
  # opts::
10
11
  # * :file - The filename of the file to load
@@ -12,9 +13,9 @@ module CFPropertyList
12
13
  def load(opts)
13
14
  doc = nil
14
15
  if(opts.has_key?(:file)) then
15
- File.open(opts[:file], "rb") { |fd| doc = Nokogiri::XML::Document.parse(fd, nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS|Nokogiri::XML::ParseOptions::NOENT) }
16
+ File.open(opts[:file], "rb") { |fd| doc = Nokogiri::XML::Document.parse(fd, nil, nil, PARSER_OPTIONS) }
16
17
  else
17
- doc = Nokogiri::XML::Document.parse(opts[:data], nil, nil, Nokogiri::XML::ParseOptions::NOBLANKS|Nokogiri::XML::ParseOptions::NOENT)
18
+ doc = Nokogiri::XML::Document.parse(opts[:data], nil, nil, PARSER_OPTIONS)
18
19
  end
19
20
 
20
21
  if doc
metadata CHANGED
@@ -1,15 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CFPropertyList
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.6
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Kruse
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2021-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rexml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: libxml-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: nokogiri
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
13
69
  - !ruby/object:Gem::Dependency
14
70
  name: rake
15
71
  requirement: !ruby/object:Gem::Requirement
@@ -30,10 +86,11 @@ email: cjk@defunct.ch
30
86
  executables: []
31
87
  extensions: []
32
88
  extra_rdoc_files:
33
- - README
89
+ - README.rdoc
34
90
  files:
35
91
  - LICENSE
36
- - README
92
+ - README.md
93
+ - README.rdoc
37
94
  - THANKS
38
95
  - lib/cfpropertylist.rb
39
96
  - lib/cfpropertylist/rbBinaryCFPropertyList.rb
@@ -44,11 +101,11 @@ files:
44
101
  - lib/cfpropertylist/rbNokogiriParser.rb
45
102
  - lib/cfpropertylist/rbPlainCFPropertyList.rb
46
103
  - lib/cfpropertylist/rbREXMLParser.rb
47
- homepage: http://github.com/ckruse/CFPropertyList
104
+ homepage: https://github.com/ckruse/CFPropertyList
48
105
  licenses:
49
106
  - MIT
50
107
  metadata: {}
51
- post_install_message:
108
+ post_install_message:
52
109
  rdoc_options: []
53
110
  require_paths:
54
111
  - lib
@@ -63,9 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
120
  - !ruby/object:Gem::Version
64
121
  version: '0'
65
122
  requirements: []
66
- rubyforge_project:
67
- rubygems_version: 2.6.14
68
- signing_key:
123
+ rubygems_version: 3.2.22
124
+ signing_key:
69
125
  specification_version: 4
70
126
  summary: Read, write and manipulate both binary and XML property lists as defined
71
127
  by apple