plist 3.1.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +2 -2
- data/Rakefile +22 -16
- data/lib/plist.rb +1 -1
- data/lib/plist/generator.rb +2 -9
- data/lib/plist/parser.rb +3 -4
- data/test/assets/AlbumData.xml +1 -1
- data/test/assets/Cookies.plist +1 -1
- data/test/assets/commented.plist +1 -1
- data/test/assets/example_data.plist +1 -1
- data/test/assets/test_data_elements.plist +3 -1
- data/test/assets/test_empty_key.plist +1 -1
- data/test/test_generator.rb +21 -0
- metadata +31 -50
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b76cafca96f807c09a6ab294cfbbdb7382d037e3
|
4
|
+
data.tar.gz: 6934d855210d3a9962b3810139061075eec5ef23
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 446131557d54d2a68e215ab21ff083a9181a6228e02a6e060b5307927e37c5f2c1fef85cf65317da12e633c59388502b83a85d7d3d5f3170067dd43ddeec72c9
|
7
|
+
data.tar.gz: aa7bfd8345be6d48b86f526df32837e1890114c76c8170c9c88dd1d19042a271a1d619002659badcb7a0dfd8c0a53cacdb9ba0028aedae30c8d265ab9ea2b583
|
data/README.rdoc
CHANGED
@@ -20,7 +20,7 @@ Plist is a library to manipulate Property List files, also known as plists. It
|
|
20
20
|
==== Example Property List
|
21
21
|
|
22
22
|
<?xml version="1.0" encoding="UTF-8"?>
|
23
|
-
<!DOCTYPE plist PUBLIC "-//Apple
|
23
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
24
24
|
<plist version="1.0">
|
25
25
|
<dict>
|
26
26
|
<key>FirstName</key>
|
@@ -74,7 +74,7 @@ If you've mixed in <tt>Plist::Emit</tt> (which is already done for +Array+ and +
|
|
74
74
|
This is equivalent to calling <tt>Plist::Emit.dump(obj)</tt>. Either one will yield:
|
75
75
|
|
76
76
|
<?xml version="1.0" encoding="UTF-8"?>
|
77
|
-
<!DOCTYPE plist PUBLIC "-//Apple
|
77
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
78
78
|
<plist version="1.0">
|
79
79
|
<array>
|
80
80
|
<integer>1</integer>
|
data/Rakefile
CHANGED
@@ -13,9 +13,8 @@ require 'rubygems'
|
|
13
13
|
require 'rake'
|
14
14
|
require 'rake/testtask'
|
15
15
|
require 'rake/packagetask'
|
16
|
-
require 'rake/gempackagetask'
|
17
16
|
require 'rake/contrib/rubyforgepublisher'
|
18
|
-
require '
|
17
|
+
require 'rubygems/package_task'
|
19
18
|
|
20
19
|
$:.unshift(File.dirname(__FILE__) + "/lib")
|
21
20
|
require 'plist'
|
@@ -38,7 +37,7 @@ task :default => [ :test ]
|
|
38
37
|
# Run the unit tests
|
39
38
|
Rake::TestTask.new { |t|
|
40
39
|
t.libs << "test"
|
41
|
-
t.
|
40
|
+
t.test_files = TEST_FILES
|
42
41
|
t.verbose = true
|
43
42
|
}
|
44
43
|
|
@@ -103,19 +102,25 @@ task :update_rdoc => [ :rdoc ] do
|
|
103
102
|
Rake::SshDirPublisher.new("#{RUBYFORGE_USER}@rubyforge.org", "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}", "rdoc").upload
|
104
103
|
end
|
105
104
|
|
106
|
-
|
107
|
-
|
108
|
-
rdoc.title = "All-purpose Property List manipulation library"
|
109
|
-
rdoc.main = "README.rdoc"
|
105
|
+
begin
|
106
|
+
require 'rdoc/task'
|
110
107
|
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
# Generate the RDoc documentation
|
109
|
+
RDoc::Task.new do |rdoc|
|
110
|
+
rdoc.title = "All-purpose Property List manipulation library"
|
111
|
+
rdoc.main = "README.rdoc"
|
114
112
|
|
115
|
-
|
116
|
-
'
|
117
|
-
'
|
118
|
-
|
113
|
+
rdoc.rdoc_dir = 'rdoc'
|
114
|
+
rdoc.rdoc_files.include('README.rdoc', 'LICENSE', 'CHANGELOG')
|
115
|
+
rdoc.rdoc_files.include('lib/**')
|
116
|
+
|
117
|
+
rdoc.options = [
|
118
|
+
'-H', # show hash marks on method names in comments
|
119
|
+
'-N', # show line numbers
|
120
|
+
]
|
121
|
+
end
|
122
|
+
rescue LoadError
|
123
|
+
$stderr.puts "Could not load rdoc tasks"
|
119
124
|
end
|
120
125
|
|
121
126
|
# Create compressed packages
|
@@ -128,7 +133,7 @@ spec = Gem::Specification.new do |s|
|
|
128
133
|
Plist is a library to manipulate Property List files, also known as plists. It can parse plist files into native Ruby data structures as well as generating new plist files from your Ruby objects.
|
129
134
|
EOD
|
130
135
|
|
131
|
-
s.authors = "Ben Bleything and Patrick
|
136
|
+
s.authors = "Ben Bleything and Patrick Way"
|
132
137
|
s.homepage = "http://plist.rubyforge.org"
|
133
138
|
|
134
139
|
s.rubyforge_project = RUBYFORGE_PROJECT
|
@@ -141,8 +146,9 @@ EOD
|
|
141
146
|
s.autorequire = 'plist'
|
142
147
|
end
|
143
148
|
|
144
|
-
|
149
|
+
Gem::PackageTask.new(spec) do |p|
|
145
150
|
p.gem_spec = spec
|
146
151
|
p.need_tar = true
|
147
152
|
p.need_zip = true
|
148
153
|
end
|
154
|
+
|
data/lib/plist.rb
CHANGED
data/lib/plist/generator.rb
CHANGED
@@ -78,7 +78,7 @@ module Plist::Emit
|
|
78
78
|
else
|
79
79
|
inner_tags = []
|
80
80
|
|
81
|
-
element.keys.
|
81
|
+
element.keys.sort_by{|k| k.to_s }.each do |k|
|
82
82
|
v = element[k]
|
83
83
|
inner_tags << tag('key', CGI::escapeHTML(k.to_s))
|
84
84
|
inner_tags << plist_node(v)
|
@@ -144,7 +144,7 @@ module Plist::Emit
|
|
144
144
|
output = ''
|
145
145
|
|
146
146
|
output << '<?xml version="1.0" encoding="UTF-8"?>' + "\n"
|
147
|
-
output << '<!DOCTYPE plist PUBLIC "-//Apple
|
147
|
+
output << '<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' + "\n"
|
148
148
|
output << '<plist version="1.0">' + "\n"
|
149
149
|
|
150
150
|
output << contents
|
@@ -213,13 +213,6 @@ module Plist::Emit
|
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
|
-
# we need to add this so sorting hash keys works properly
|
217
|
-
class Symbol #:nodoc:
|
218
|
-
def <=> (other)
|
219
|
-
self.to_s <=> other.to_s
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
216
|
class Array #:nodoc:
|
224
217
|
include Plist::Emit
|
225
218
|
end
|
data/lib/plist/parser.rb
CHANGED
@@ -18,7 +18,7 @@ module Plist
|
|
18
18
|
# + Date elements are returned as DateTime objects.
|
19
19
|
# + Data elements are implemented as Tempfiles
|
20
20
|
#
|
21
|
-
# Plist::parse_xml will blow up if it encounters a
|
21
|
+
# Plist::parse_xml will blow up if it encounters a Date element.
|
22
22
|
# If you encounter such an error, or if you have a Date element which
|
23
23
|
# can't be parsed into a Time object, please send your plist file to
|
24
24
|
# plist@hexane.org so that I can implement the proper support.
|
@@ -63,7 +63,7 @@ module Plist
|
|
63
63
|
def initialize( plist_data_or_file, listener )
|
64
64
|
if plist_data_or_file.respond_to? :read
|
65
65
|
@xml = plist_data_or_file.read
|
66
|
-
elsif File.
|
66
|
+
elsif File.exist? plist_data_or_file
|
67
67
|
@xml = File.read( plist_data_or_file )
|
68
68
|
else
|
69
69
|
@xml = plist_data_or_file
|
@@ -210,8 +210,7 @@ module Plist
|
|
210
210
|
require 'base64'
|
211
211
|
class PData < PTag
|
212
212
|
def to_ruby
|
213
|
-
data = Base64.decode64(text.gsub(/\s+/, ''))
|
214
|
-
|
213
|
+
data = Base64.decode64(text.gsub(/\s+/, '')) unless text.nil?
|
215
214
|
begin
|
216
215
|
return Marshal.load(data)
|
217
216
|
rescue Exception => e
|
data/test/assets/AlbumData.xml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
3
|
<plist version="1.0">
|
4
4
|
<dict>
|
5
5
|
<key>Application Version</key>
|
data/test/assets/Cookies.plist
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
3
|
<plist version="1.0">
|
4
4
|
<array>
|
5
5
|
<dict>
|
data/test/assets/commented.plist
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
3
|
<plist version="1.0">
|
4
4
|
<!-- I am a comment! -->
|
5
5
|
<!--
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
3
|
<plist version="1.0">
|
4
4
|
<dict>
|
5
5
|
<key>IMs</key>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
3
|
<plist version="1.0">
|
4
4
|
<dict>
|
5
5
|
<key>stringio</key>
|
@@ -20,5 +20,7 @@
|
|
20
20
|
<data>BAhvOhZNYXJzaGFsYWJsZU9iamVjdAY6CUBmb28iHnRoaXMgb2JqZWN0IHdh
|
21
21
|
cyBtYXJzaGFsZWQ=
|
22
22
|
</data>
|
23
|
+
<key>nodata</key>
|
24
|
+
<data/>
|
23
25
|
</dict>
|
24
26
|
</plist>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
3
|
<plist version="1.0">
|
4
4
|
<dict>
|
5
5
|
<key>key</key>
|
data/test/test_generator.rb
CHANGED
@@ -51,4 +51,25 @@ class TestGenerator < Test::Unit::TestCase
|
|
51
51
|
|
52
52
|
File.unlink('test.plist')
|
53
53
|
end
|
54
|
+
|
55
|
+
# The hash in this test was failing with 'hsh.keys.sort',
|
56
|
+
# we are making sure it works with 'hsh.keys.sort_by'.
|
57
|
+
def test_sorting_keys
|
58
|
+
hsh = {:key1 => 1, :key4 => 4, 'key2' => 2, :key3 => 3}
|
59
|
+
output = Plist::Emit.plist_node(hsh)
|
60
|
+
expected = <<-STR
|
61
|
+
<dict>
|
62
|
+
<key>key1</key>
|
63
|
+
<integer>1</integer>
|
64
|
+
<key>key2</key>
|
65
|
+
<integer>2</integer>
|
66
|
+
<key>key3</key>
|
67
|
+
<integer>3</integer>
|
68
|
+
<key>key4</key>
|
69
|
+
<integer>4</integer>
|
70
|
+
</dict>
|
71
|
+
STR
|
72
|
+
|
73
|
+
assert_equal expected, output.gsub(/[\t]/, "\s\s")
|
74
|
+
end
|
54
75
|
end
|
metadata
CHANGED
@@ -1,85 +1,66 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: plist
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 3
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 3.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.2.0
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
- Ben Bleything and Patrick
|
6
|
+
authors:
|
7
|
+
- Ben Bleything and Patrick Way
|
13
8
|
autorequire: plist
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2010-02-23 00:00:00 -08:00
|
18
|
-
default_executable:
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
19
12
|
dependencies: []
|
20
|
-
|
21
13
|
description: |
|
22
14
|
Plist is a library to manipulate Property List files, also known as plists. It can parse plist files into native Ruby data structures as well as generating new plist files from your Ruby objects.
|
23
|
-
|
24
15
|
email:
|
25
16
|
executables: []
|
26
|
-
|
27
17
|
extensions: []
|
28
|
-
|
29
18
|
extra_rdoc_files: []
|
30
|
-
|
31
|
-
files:
|
32
|
-
- Rakefile
|
33
|
-
- README.rdoc
|
19
|
+
files:
|
34
20
|
- CHANGELOG
|
35
21
|
- LICENSE
|
22
|
+
- README.rdoc
|
23
|
+
- Rakefile
|
24
|
+
- lib/plist.rb
|
36
25
|
- lib/plist/generator.rb
|
37
26
|
- lib/plist/parser.rb
|
38
|
-
- lib/plist.rb
|
39
|
-
- test/test_data_elements.rb
|
40
|
-
- test/test_generator.rb
|
41
|
-
- test/test_generator_basic_types.rb
|
42
|
-
- test/test_generator_collections.rb
|
43
|
-
- test/test_parser.rb
|
44
27
|
- test/assets/AlbumData.xml
|
45
|
-
- test/assets/commented.plist
|
46
28
|
- test/assets/Cookies.plist
|
29
|
+
- test/assets/commented.plist
|
47
30
|
- test/assets/example_data.bin
|
48
31
|
- test/assets/example_data.jpg
|
49
32
|
- test/assets/example_data.plist
|
50
33
|
- test/assets/test_data_elements.plist
|
51
34
|
- test/assets/test_empty_key.plist
|
52
|
-
|
35
|
+
- test/test_data_elements.rb
|
36
|
+
- test/test_generator.rb
|
37
|
+
- test/test_generator_basic_types.rb
|
38
|
+
- test/test_generator_collections.rb
|
39
|
+
- test/test_parser.rb
|
53
40
|
homepage: http://plist.rubyforge.org
|
54
41
|
licenses: []
|
55
|
-
|
42
|
+
metadata: {}
|
56
43
|
post_install_message:
|
57
44
|
rdoc_options: []
|
58
|
-
|
59
|
-
require_paths:
|
45
|
+
require_paths:
|
60
46
|
- lib
|
61
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
75
57
|
requirements: []
|
76
|
-
|
77
58
|
rubyforge_project: plist
|
78
|
-
rubygems_version:
|
59
|
+
rubygems_version: 2.2.2
|
79
60
|
signing_key:
|
80
|
-
specification_version:
|
61
|
+
specification_version: 4
|
81
62
|
summary: All-purpose Property List manipulation library.
|
82
|
-
test_files:
|
63
|
+
test_files:
|
83
64
|
- test/test_data_elements.rb
|
84
65
|
- test/test_generator.rb
|
85
66
|
- test/test_generator_basic_types.rb
|