CFPropertyList 2.0.7 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README +4 -2
- data/lib/cfpropertylist.rb +6 -0
- data/lib/rbBinaryCFPropertyList.rb +1 -7
- data/lib/rbCFPlistError.rb +8 -1
- data/lib/rbCFPropertyList.rb +20 -7
- data/lib/rbCFTypes.rb +1 -1
- data/lib/rbXMLCFPropertyList.rb +0 -6
- metadata +37 -12
data/README
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
CFPropertyList implementation
|
2
2
|
class to read, manipulate and write both XML and binary property list
|
3
|
-
files (plist(5)) as defined by Apple
|
3
|
+
files (plist(5)) as defined by Apple. Have a look at CFPropertyList::List
|
4
|
+
for more documentation.
|
4
5
|
|
5
6
|
== Example
|
7
|
+
require 'cfpropertylist'
|
6
8
|
|
7
9
|
# create a arbitrary data structure of basic data types
|
8
10
|
data = {
|
@@ -30,5 +32,5 @@ files (plist(5)) as defined by Apple
|
|
30
32
|
|
31
33
|
Author:: Christian Kruse (mailto:cjk@wwwtech.de)
|
32
34
|
Copyright:: Copyright (c) 2010
|
33
|
-
License::
|
35
|
+
License:: MIT License
|
34
36
|
|
@@ -1,13 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# CFPropertyList implementation
|
4
|
-
# parser class to read, manipulate and write binary property list files (plist(5)) as defined by Apple
|
5
|
-
#
|
6
|
-
# Author:: Christian Kruse (mailto:cjk@wwwtech.de)
|
7
|
-
# Copyright:: Copyright (c) 2010
|
8
|
-
# License:: Distributes under the same terms as Ruby
|
9
2
|
|
10
3
|
module CFPropertyList
|
4
|
+
# Binary PList parser class
|
11
5
|
class Binary
|
12
6
|
# Read a binary plist file
|
13
7
|
def load(opts)
|
data/lib/rbCFPlistError.rb
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
#
|
3
|
+
# Exceptions used:
|
4
|
+
# CFPlistError:: General base exception
|
5
|
+
# CFFormatError:: Format error
|
6
|
+
# CFTypeError:: Type error
|
7
|
+
#
|
8
|
+
# Easy and simple :-)
|
4
9
|
#
|
5
10
|
# Author:: Christian Kruse (mailto:cjk@wwwtech.de)
|
6
11
|
# Copyright:: Copyright (c) 2010
|
7
12
|
# License:: MIT License
|
8
13
|
|
14
|
+
# general plist error. All exceptions thrown are derived from this class.
|
9
15
|
class CFPlistError < Exception
|
10
16
|
end
|
11
17
|
|
@@ -13,6 +19,7 @@ end
|
|
13
19
|
class CFFormatError < CFPlistError
|
14
20
|
end
|
15
21
|
|
22
|
+
# Exception thrown when type errors occur
|
16
23
|
class CFTypeError < CFPlistError
|
17
24
|
end
|
18
25
|
|
data/lib/rbCFPropertyList.rb
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'libxml'
|
4
|
+
require 'kconv'
|
5
|
+
require 'date'
|
6
|
+
|
2
7
|
#
|
3
8
|
# CFPropertyList implementation
|
9
|
+
#
|
4
10
|
# class to read, manipulate and write both XML and binary property list
|
5
|
-
# files (plist(5)) as defined by Apple
|
11
|
+
# files (plist(5)) as defined by Apple. Have a look at CFPropertyList::List
|
12
|
+
# for more documentation.
|
6
13
|
#
|
7
14
|
# == Example
|
15
|
+
# require 'cfpropertylist'
|
8
16
|
#
|
9
17
|
# # create a arbitrary data structure of basic data types
|
10
18
|
# data = {
|
@@ -33,12 +41,7 @@
|
|
33
41
|
#
|
34
42
|
# Author:: Christian Kruse (mailto:cjk@wwwtech.de)
|
35
43
|
# Copyright:: Copyright (c) 2010
|
36
|
-
# License::
|
37
|
-
|
38
|
-
require 'libxml'
|
39
|
-
require 'kconv'
|
40
|
-
require 'date'
|
41
|
-
|
44
|
+
# License:: MIT License
|
42
45
|
module CFPropertyList
|
43
46
|
# interface class for PList parsers
|
44
47
|
class ParserInterface
|
@@ -144,6 +147,7 @@ module CFPropertyList
|
|
144
147
|
|
145
148
|
module_function :guess, :native_types
|
146
149
|
|
150
|
+
# Class representing a CFPropertyList. Instanciate with #new
|
147
151
|
class List
|
148
152
|
# Format constant for binary format
|
149
153
|
FORMAT_BINARY = 1
|
@@ -163,6 +167,13 @@ module CFPropertyList
|
|
163
167
|
# the root value in the plist file
|
164
168
|
attr_accessor :value
|
165
169
|
|
170
|
+
# initialize a new CFPropertyList, arguments are:
|
171
|
+
#
|
172
|
+
# :file:: Parse a file
|
173
|
+
# :format:: Format is one of FORMAT_BINARY or FORMAT_XML. Defaults to FORMAT_AUTO
|
174
|
+
# :data:: Parse a string
|
175
|
+
#
|
176
|
+
# All arguments are optional
|
166
177
|
def initialize(opts={})
|
167
178
|
@filename = opts[:file]
|
168
179
|
@format = opts[:format] || FORMAT_AUTO
|
@@ -294,6 +305,7 @@ module CFPropertyList
|
|
294
305
|
end
|
295
306
|
|
296
307
|
class Array
|
308
|
+
# convert an array to plist format
|
297
309
|
def to_plist(options={})
|
298
310
|
options[:plist_format] ||= CFPropertyList::List::FORMAT_BINARY
|
299
311
|
|
@@ -304,6 +316,7 @@ class Array
|
|
304
316
|
end
|
305
317
|
|
306
318
|
class Hash
|
319
|
+
# convert a hash to plist format
|
307
320
|
def to_plist(options={})
|
308
321
|
options[:plist_format] ||= CFPropertyList::List::FORMAT_BINARY
|
309
322
|
|
data/lib/rbCFTypes.rb
CHANGED
data/lib/rbXMLCFPropertyList.rb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# CFPropertyList implementation
|
3
|
-
# parser class to read, manipulate and write XML property list files (plist(5)) as defined by Apple
|
4
|
-
#
|
5
|
-
# Author:: Christian Kruse (mailto:cjk@wwwtech.de)
|
6
|
-
# Copyright:: Copyright (c) 2010
|
7
|
-
# License:: Distributes under the same terms as Ruby
|
8
2
|
|
9
3
|
module CFPropertyList
|
10
4
|
# XML parser
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CFPropertyList
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
- 8
|
10
|
+
version: 2.0.8
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Christian Kruse
|
@@ -14,24 +20,36 @@ default_executable:
|
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: libxml-ruby
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 19
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 1
|
33
|
+
- 0
|
23
34
|
version: 1.1.0
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
- !ruby/object:Gem::Dependency
|
26
38
|
name: rake
|
27
|
-
|
28
|
-
|
29
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
30
42
|
requirements:
|
31
43
|
- - ">="
|
32
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 7
|
49
|
+
- 0
|
33
50
|
version: 0.7.0
|
34
|
-
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
35
53
|
description: This is a module to read, write and manipulate both binary and XML property lists as defined by apple.
|
36
54
|
email: cjk@wwwtech.de
|
37
55
|
executables: []
|
@@ -41,6 +59,7 @@ extensions: []
|
|
41
59
|
extra_rdoc_files:
|
42
60
|
- README
|
43
61
|
files:
|
62
|
+
- lib/cfpropertylist.rb
|
44
63
|
- lib/rbBinaryCFPropertyList.rb
|
45
64
|
- lib/rbCFPlistError.rb
|
46
65
|
- lib/rbCFPropertyList.rb
|
@@ -57,21 +76,27 @@ rdoc_options: []
|
|
57
76
|
require_paths:
|
58
77
|
- lib
|
59
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
60
80
|
requirements:
|
61
81
|
- - ">="
|
62
82
|
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
63
86
|
version: "0"
|
64
|
-
version:
|
65
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
66
89
|
requirements:
|
67
90
|
- - ">="
|
68
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
69
95
|
version: "0"
|
70
|
-
version:
|
71
96
|
requirements: []
|
72
97
|
|
73
98
|
rubyforge_project: cfpropertylist
|
74
|
-
rubygems_version: 1.3.
|
99
|
+
rubygems_version: 1.3.7
|
75
100
|
signing_key:
|
76
101
|
specification_version: 3
|
77
102
|
summary: Read, write and manipulate both binary and XML property lists as defined by apple
|