Merge pull request #2563 from reitermarkus/plist
Update `plist` to 3.3.0.
This commit is contained in:
commit
b067700fd7
2
Library/Homebrew/vendor/README.md
vendored
2
Library/Homebrew/vendor/README.md
vendored
@ -1,7 +1,7 @@
|
||||
Vendored Dependencies
|
||||
=====================
|
||||
|
||||
* [plist](https://github.com/bleything/plist), version 3.1.0
|
||||
* [plist](https://github.com/patsplat/plist), version 3.3.0
|
||||
|
||||
* [ruby-macho](https://github.com/Homebrew/ruby-macho), version 1.1.0
|
||||
|
||||
|
||||
6
Library/Homebrew/vendor/plist/plist.rb
vendored
6
Library/Homebrew/vendor/plist/plist.rb
vendored
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
#
|
||||
# encoding: utf-8
|
||||
|
||||
# = plist
|
||||
#
|
||||
# This is the main file for plist. Everything interesting happens in
|
||||
@ -15,7 +15,7 @@ require 'stringio'
|
||||
|
||||
require_relative 'plist/generator'
|
||||
require_relative 'plist/parser'
|
||||
require_relative 'plist/version'
|
||||
|
||||
module Plist
|
||||
VERSION = '3.1.0'
|
||||
end
|
||||
|
||||
10
Library/Homebrew/vendor/plist/plist/generator.rb
vendored
Normal file → Executable file
10
Library/Homebrew/vendor/plist/plist/generator.rb
vendored
Normal file → Executable file
@ -1,12 +1,12 @@
|
||||
#!/usr/bin/env ruby
|
||||
#
|
||||
# encoding: utf-8
|
||||
|
||||
# = plist
|
||||
#
|
||||
# Copyright 2006-2010 Ben Bleything and Patrick May
|
||||
# Distributed under the MIT License
|
||||
#
|
||||
|
||||
module Plist ; end
|
||||
module Plist; end
|
||||
|
||||
# === Create a plist
|
||||
# You can dump an object to a plist in one of two ways:
|
||||
@ -94,7 +94,7 @@ module Plist::Emit
|
||||
output << tag('date', element.utc.strftime('%Y-%m-%dT%H:%M:%SZ'))
|
||||
when Date # also catches DateTime
|
||||
output << tag('date', element.strftime('%Y-%m-%dT%H:%M:%SZ'))
|
||||
when String, Symbol, Fixnum, Bignum, Integer, Float
|
||||
when String, Symbol, Integer, Float
|
||||
output << tag(element_type(element), CGI::escapeHTML(element.to_s))
|
||||
when IO, StringIO
|
||||
element.rewind
|
||||
@ -159,7 +159,7 @@ module Plist::Emit
|
||||
when String, Symbol
|
||||
'string'
|
||||
|
||||
when Fixnum, Bignum, Integer
|
||||
when Integer
|
||||
'integer'
|
||||
|
||||
when Float
|
||||
|
||||
42
Library/Homebrew/vendor/plist/plist/parser.rb
vendored
42
Library/Homebrew/vendor/plist/plist/parser.rb
vendored
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env ruby
|
||||
#
|
||||
# encoding: utf-8
|
||||
|
||||
# = plist
|
||||
#
|
||||
# Copyright 2006-2010 Ben Bleything and Patrick May
|
||||
@ -69,19 +69,14 @@ module Plist
|
||||
@xml = plist_data_or_file
|
||||
end
|
||||
|
||||
# TODO: Update vendored `plist` parser when
|
||||
# https://github.com/patsplat/plist/pull/38
|
||||
# is merged.
|
||||
@xml.force_encoding("UTF-8")
|
||||
|
||||
@listener = listener
|
||||
end
|
||||
|
||||
TEXT = /([^<]+)/
|
||||
XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>*/um
|
||||
DOCTYPE_PATTERN = /\s*<!DOCTYPE\s+(.*?)(\[|>)/um
|
||||
COMMENT_START = /\A<!--/u
|
||||
COMMENT_END = /.*?-->/um
|
||||
XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>*/m
|
||||
DOCTYPE_PATTERN = /\s*<!DOCTYPE\s+(.*?)(\[|>)/m
|
||||
COMMENT_START = /\A<!--/
|
||||
COMMENT_END = /.*?-->/m
|
||||
|
||||
|
||||
def parse
|
||||
@ -96,7 +91,14 @@ module Plist
|
||||
if @scanner.scan(COMMENT_START)
|
||||
@scanner.scan(COMMENT_END)
|
||||
elsif @scanner.scan(XMLDECL_PATTERN)
|
||||
encoding = parse_encoding_from_xml_declaration(@scanner[1])
|
||||
next if encoding.nil?
|
||||
|
||||
# use the specified encoding for the rest of the file
|
||||
next unless String.method_defined?(:force_encoding)
|
||||
@scanner.string = @scanner.rest.force_encoding(encoding)
|
||||
elsif @scanner.scan(DOCTYPE_PATTERN)
|
||||
next
|
||||
elsif @scanner.scan(start_tag)
|
||||
@listener.tag_start(@scanner[1], nil)
|
||||
if (@scanner[2] =~ /\/$/)
|
||||
@ -111,6 +113,22 @@ module Plist
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def parse_encoding_from_xml_declaration(xml_declaration)
|
||||
return unless defined?(Encoding)
|
||||
|
||||
xml_encoding = xml_declaration.match(/(?:\A|\s)encoding=(?:"(.*?)"|'(.*?)')(?:\s|\Z)/)
|
||||
|
||||
return if xml_encoding.nil?
|
||||
|
||||
begin
|
||||
Encoding.find(xml_encoding[1])
|
||||
rescue ArgumentError
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class PTag
|
||||
@ -218,7 +236,7 @@ module Plist
|
||||
data = Base64.decode64(text.gsub(/\s+/, '')) unless text.nil?
|
||||
begin
|
||||
return Marshal.load(data)
|
||||
rescue Exception => e
|
||||
rescue Exception
|
||||
io = StringIO.new
|
||||
io.write data
|
||||
io.rewind
|
||||
|
||||
5
Library/Homebrew/vendor/plist/plist/version.rb
vendored
Executable file
5
Library/Homebrew/vendor/plist/plist/version.rb
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
# encoding: utf-8
|
||||
|
||||
module Plist
|
||||
VERSION = '3.3.0'.freeze
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user