plist 3.6.0 → 3.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/plist/generator.rb +2 -4
- data/lib/plist/parser.rb +20 -13
- data/lib/plist/version.rb +1 -1
- data/lib/plist.rb +0 -1
- metadata +4 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bc2cb76ebcc08a5872159aab17439db694043d2960112005e0c1c2683160a65
|
4
|
+
data.tar.gz: b5893c356807e51d272e292c117b699ac8041fbd67bcc47d8ec3987af32ace81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08a326e534bf3a6281d4a03afd9eae3832d7d7f2468235b21678f5fc55121a09988c79386c5d5c7b270552695aa827c122ff4b615a5c4d7f2053da07ac664766'
|
7
|
+
data.tar.gz: de4301d201ca02df60639190c1bb721ee34ea76b42f2de2d307990e76e26bf003ddf01cd6b68851783f8dcee3469fac4ec1b2e42e4986168c089efe4fd4de5e3
|
data/lib/plist/generator.rb
CHANGED
@@ -124,11 +124,9 @@ module Plist
|
|
124
124
|
|
125
125
|
def data_tag(data, level)
|
126
126
|
# note that apple plists are wrapped at a different length then
|
127
|
-
# what ruby's
|
128
|
-
# I used #encode64 instead of #b64encode (which allows a length arg)
|
129
|
-
# because b64encode is b0rked and ignores the length arg.
|
127
|
+
# what ruby's pack wraps by default.
|
130
128
|
tag('data', nil, level) do
|
131
|
-
Base64.encode64(data)
|
129
|
+
[data].pack("m") # equivalent to Base64.encode64(data)
|
132
130
|
.gsub(/\s+/, '')
|
133
131
|
.scan(/.{1,68}/o)
|
134
132
|
.collect { |line| indent(line, level) }
|
data/lib/plist/parser.rb
CHANGED
@@ -26,8 +26,13 @@ module Plist
|
|
26
26
|
# can't be parsed into a Time object, please create an issue
|
27
27
|
# attaching your plist file at https://github.com/patsplat/plist/issues
|
28
28
|
# so folks can implement the proper support.
|
29
|
-
|
30
|
-
|
29
|
+
#
|
30
|
+
# By default, <data> will be assumed to be a marshaled Ruby object and
|
31
|
+
# interpreted with <tt>Marshal.load</tt>. Pass <tt>marshal: false</tt>
|
32
|
+
# to disable this behavior and return the raw binary data as an IO
|
33
|
+
# object instead.
|
34
|
+
def self.parse_xml(filename_or_xml, options={})
|
35
|
+
listener = Listener.new(options)
|
31
36
|
# parser = REXML::Parsers::StreamParser.new(File.new(filename), listener)
|
32
37
|
parser = StreamParser.new(filename_or_xml, listener)
|
33
38
|
parser.parse
|
@@ -39,13 +44,14 @@ module Plist
|
|
39
44
|
|
40
45
|
attr_accessor :result, :open
|
41
46
|
|
42
|
-
def initialize
|
47
|
+
def initialize(options={})
|
43
48
|
@result = nil
|
44
49
|
@open = []
|
50
|
+
@options = { :marshal => true }.merge(options).freeze
|
45
51
|
end
|
46
52
|
|
47
53
|
def tag_start(name, attributes)
|
48
|
-
@open.push PTag.mappings[name].new
|
54
|
+
@open.push PTag.mappings[name].new(@options)
|
49
55
|
end
|
50
56
|
|
51
57
|
def text(contents)
|
@@ -154,9 +160,10 @@ module Plist
|
|
154
160
|
mappings[key] = sub_class
|
155
161
|
end
|
156
162
|
|
157
|
-
attr_accessor :text, :children
|
158
|
-
def initialize
|
163
|
+
attr_accessor :text, :children, :options
|
164
|
+
def initialize(options)
|
159
165
|
@children = []
|
166
|
+
@options = options
|
160
167
|
end
|
161
168
|
|
162
169
|
def to_ruby
|
@@ -239,18 +246,18 @@ module Plist
|
|
239
246
|
end
|
240
247
|
end
|
241
248
|
|
242
|
-
require 'base64'
|
243
249
|
class PData < PTag
|
244
250
|
def to_ruby
|
245
|
-
|
251
|
+
# unpack("m")[0] is equivalent to Base64.decode64
|
252
|
+
data = text.gsub(/\s+/, '').unpack("m")[0] unless text.nil?
|
246
253
|
begin
|
247
|
-
return Marshal.load(data)
|
254
|
+
return Marshal.load(data) if options[:marshal]
|
248
255
|
rescue Exception
|
249
|
-
io = StringIO.new
|
250
|
-
io.write data
|
251
|
-
io.rewind
|
252
|
-
return io
|
253
256
|
end
|
257
|
+
io = StringIO.new
|
258
|
+
io.write data
|
259
|
+
io.rewind
|
260
|
+
io
|
254
261
|
end
|
255
262
|
end
|
256
263
|
end
|
data/lib/plist/version.rb
CHANGED
data/lib/plist.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Bleything
|
@@ -9,50 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: bundler
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.14'
|
21
|
-
type: :development
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '1.14'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rake
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '10.5'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '10.5'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: test-unit
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - "~>"
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '1.2'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - "~>"
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '1.2'
|
12
|
+
date: 2023-12-26 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
56
14
|
description: Plist is a library to manipulate Property List files, also known as plists.
|
57
15
|
It can parse plist files into native Ruby data structures as well as generating
|
58
16
|
new plist files from your Ruby objects.
|
@@ -85,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
43
|
- !ruby/object:Gem::Version
|
86
44
|
version: '0'
|
87
45
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
46
|
+
rubygems_version: 3.5.3
|
89
47
|
signing_key:
|
90
48
|
specification_version: 4
|
91
49
|
summary: All-purpose Property List manipulation library
|