plist4r 0.2.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.yardopts +11 -0
- data/LICENSE +3 -1
- data/README.rdoc +25 -122
- data/Rakefile +14 -0
- data/VERSION +1 -1
- data/bin/plist4r +2 -0
- data/ext/osx_plist/Makefile +157 -0
- data/ext/osx_plist/extconf.rb +9 -0
- data/ext/osx_plist/plist.c +606 -0
- data/ext/osx_plist/plist.o +0 -0
- data/lib/plist4r.rb +6 -3
- data/lib/plist4r/application.rb +1 -2
- data/lib/plist4r/backend.rb +102 -34
- data/lib/plist4r/backend/c_f_property_list.rb +65 -0
- data/lib/plist4r/backend/c_f_property_list/LICENSE +19 -0
- data/lib/plist4r/backend/c_f_property_list/README +34 -0
- data/lib/plist4r/backend/c_f_property_list/cfpropertylist.rb +6 -0
- data/lib/plist4r/backend/c_f_property_list/rbBinaryCFPropertyList.rb +663 -0
- data/lib/plist4r/backend/c_f_property_list/rbCFPlistError.rb +26 -0
- data/lib/plist4r/backend/c_f_property_list/rbCFPropertyList.rb +348 -0
- data/lib/plist4r/backend/c_f_property_list/rbCFTypes.rb +241 -0
- data/lib/plist4r/backend/c_f_property_list/rbXMLCFPropertyList.rb +116 -0
- data/lib/plist4r/backend/example.rb +37 -52
- data/lib/plist4r/backend/haml.rb +47 -36
- data/lib/plist4r/backend/libxml4r.rb +24 -20
- data/lib/plist4r/backend/osx_plist.rb +82 -0
- data/lib/plist4r/backend/ruby_cocoa.rb +172 -54
- data/lib/plist4r/backend/test/data_types.rb +163 -0
- data/lib/plist4r/backend/test/harness.rb +255 -0
- data/lib/plist4r/backend/test/output.rb +47 -0
- data/lib/plist4r/backend_base.rb +4 -2
- data/lib/plist4r/{options.rb → cli.rb} +2 -1
- data/lib/plist4r/commands.rb +13 -8
- data/lib/plist4r/config.rb +36 -9
- data/lib/plist4r/docs/Backends.html +59 -0
- data/lib/plist4r/docs/DeveloperGuide.rdoc +53 -0
- data/lib/plist4r/docs/EditingPlistFiles.rdoc +88 -0
- data/lib/plist4r/docs/InfoPlistExample.rdoc +33 -0
- data/lib/plist4r/docs/LaunchdPlistExample.rdoc +33 -0
- data/lib/plist4r/docs/PlistKeyNames.rdoc +47 -0
- data/lib/plist4r/mixin/array_dict.rb +61 -0
- data/lib/plist4r/mixin/data_methods.rb +178 -54
- data/lib/plist4r/mixin/haml4r.rb +4 -0
- data/lib/plist4r/mixin/haml4r/css_attributes.rb +19 -0
- data/lib/plist4r/mixin/haml4r/examples.rb +261 -0
- data/lib/plist4r/mixin/haml4r/haml_table_example.rb +79 -0
- data/lib/plist4r/mixin/haml4r/table.rb +157 -0
- data/lib/plist4r/mixin/haml4r/table_cell.rb +160 -0
- data/lib/plist4r/mixin/haml4r/table_cells.rb +485 -0
- data/lib/plist4r/mixin/haml4r/table_section.rb +101 -0
- data/lib/plist4r/mixin/ordered_hash.rb +9 -1
- data/lib/plist4r/mixin/popen4.rb +1 -1
- data/lib/plist4r/mixin/ruby_stdlib.rb +154 -1
- data/lib/plist4r/mixin/script.rb +133 -0
- data/lib/plist4r/mixin/table.rb +435 -0
- data/lib/plist4r/plist.rb +272 -94
- data/lib/plist4r/plist_cache.rb +42 -43
- data/lib/plist4r/plist_type.rb +31 -74
- data/lib/plist4r/plist_type/info.rb +157 -3
- data/lib/plist4r/plist_type/launchd.rb +54 -48
- data/lib/plist4r/plist_type/plist.rb +1 -3
- data/plist4r.gemspec +74 -14
- data/spec/{examples.rb → launchd_examples.rb} +131 -139
- data/spec/plist4r/application_spec.rb +37 -0
- data/spec/plist4r/backend_spec.rb +256 -0
- data/spec/plist4r/cli_spec.rb +25 -0
- data/spec/plist4r/commands_spec.rb +20 -0
- data/spec/plist4r/config_spec.rb +38 -0
- data/spec/plist4r/mixin/array_dict_spec.rb +120 -0
- data/spec/plist4r/mixin/data_methods_spec.rb +96 -0
- data/spec/plist4r/mixin/haml4r/examples.rb +261 -0
- data/spec/plist4r/mixin/ruby_stdlib_spec.rb +228 -0
- data/spec/plist4r/plist_cache_spec.rb +261 -0
- data/spec/plist4r/plist_spec.rb +841 -23
- data/spec/plist4r/plist_type_spec.rb +126 -0
- data/spec/plist4r_spec.rb +53 -27
- data/spec/scratchpad.rb +226 -0
- data/spec/spec_helper.rb +5 -1
- metadata +109 -23
- data/lib/plist4r/backend/plutil.rb +0 -25
- data/lib/plist4r/mixin.rb +0 -7
- data/plists/array_mini.xml +0 -14
- data/plists/example_big_binary.plist +0 -0
- data/plists/example_medium_binary_launchd.plist +0 -0
- data/plists/example_medium_launchd.xml +0 -53
- data/plists/mini.xml +0 -12
- data/test.rb +0 -40
@@ -0,0 +1,126 @@
|
|
1
|
+
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Plist4r::PlistType, "#initialize" do
|
5
|
+
before(:each) do
|
6
|
+
@plist = Plist4r::Plist.new
|
7
|
+
@plist_type = Plist4r::PlistType.new @plist
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should set @plist to the supplied plist" do
|
11
|
+
@plist_type.instance_eval { @plist }.should == @plist
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should set @hash and @orig to the supplied @plist.to_hash" do
|
15
|
+
@plist_type.instance_eval { @hash }.should == @plist.to_hash
|
16
|
+
@plist_type.instance_eval { @orig }.should == @plist.to_hash
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Plist4r::PlistType, "#hash" do
|
21
|
+
before(:each) do
|
22
|
+
@plist = Plist4r::Plist.new
|
23
|
+
@plist_type = Plist4r::PlistType.new @plist
|
24
|
+
@plist_type.instance_eval { @hash = "hash" }
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should set @hash and @orig if the supplied hash is a Plist4r::OrderedHash" do
|
28
|
+
hash = Plist4r::OrderedHash.new
|
29
|
+
@plist_type.hash(hash)
|
30
|
+
@plist_type.instance_eval { @hash }.should == hash
|
31
|
+
@plist_type.instance_eval { @orig }.should == hash
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should return @hash if there are no supplied arguments" do
|
35
|
+
@plist_type.hash.should == "hash"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should raise an error when the supplied argument is not a Plist4r::OrderedHash, or nil" do
|
39
|
+
not_a_plist4r_ordered_hash_or_nil = false
|
40
|
+
lambda { @plist_type.hash(not_a_plist4r_ordered_hash_or_nil) }.should raise_error(Exception)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe Plist4r::PlistType, "#match_stat" do
|
45
|
+
it "should follow the default calling path" do
|
46
|
+
@valid_keys_values = []
|
47
|
+
Plist4r::PlistType::ValidKeys.stub(:values).and_return(@valid_keys_values)
|
48
|
+
@type_keys = []
|
49
|
+
@valid_keys_values.stub(:flatten).and_return(@type_keys)
|
50
|
+
@valid_keys_values.should_receive(:flatten).and_return(@type_keys)
|
51
|
+
Plist4r::PlistType::ValidKeys.should_receive(:values).and_return(@valid_keys_values)
|
52
|
+
@plist_keys = []
|
53
|
+
@matches = []
|
54
|
+
@plist_keys.stub(:&).with(@type_keys).and_return(@matches)
|
55
|
+
@plist_keys.should_receive(:&).and_return(@matches)
|
56
|
+
@matches.should_receive(:size).and_return(0)
|
57
|
+
@type_keys.should_receive(:size).and_return(0)
|
58
|
+
@matches.should_receive(:size).and_return(0)
|
59
|
+
|
60
|
+
Plist4r::PlistType.match_stat @plist_keys
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe Plist4r::PlistType, "#to_s" do
|
65
|
+
before(:each) do
|
66
|
+
@plist = Plist4r::Plist.new
|
67
|
+
@plist_type = Plist4r::PlistType.new @plist
|
68
|
+
@plist_type.instance_eval { @hash = "hash" }
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should return @string if @string is not nil" do
|
72
|
+
@plist_type.instance_eval { @string = "string" }
|
73
|
+
@plist_type.to_s.should == "string"
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should follow the alternate calling path when string is nil" do
|
77
|
+
@plist_type.to_s.should == "plist_type"
|
78
|
+
@plist_type.instance_eval { @string }.should == "plist_type"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe Plist4r::PlistType, "#to_sym" do
|
83
|
+
before(:each) do
|
84
|
+
@plist = Plist4r::Plist.new
|
85
|
+
@plist_type = Plist4r::PlistType.new @plist
|
86
|
+
@plist_type.instance_eval { @hash = "hash" }
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should return @sym if @sym is not nil" do
|
90
|
+
@plist_type.instance_eval { @sym = :symbol }
|
91
|
+
@plist_type.to_sym.should == :symbol
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should call to_s" do
|
95
|
+
@string = "string"
|
96
|
+
@plist_type.stub(:to_s).and_return(@string)
|
97
|
+
@plist_type.should_receive(:to_s).and_return(@string)
|
98
|
+
@string.stub(:to_sym).and_return(:symbol)
|
99
|
+
@string.should_receive(:to_sym).and_return(:symbol)
|
100
|
+
@plist_type.to_sym.should == :symbol
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe Plist4r::PlistType, "#array_dict" do
|
105
|
+
before(:each) do
|
106
|
+
@plist = Plist4r::Plist.new
|
107
|
+
@plist_type = Plist4r::PlistType.new @plist
|
108
|
+
@plist_type.instance_eval { @hash = "hash" }
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should follow the default calling path" do
|
112
|
+
@hash = Plist4r::OrderedHash.new
|
113
|
+
@array_dict = Plist4r::ArrayDict.new @hash
|
114
|
+
Plist4r::ArrayDict.stub(:new).and_return(@array_dict)
|
115
|
+
@method_sym = :method
|
116
|
+
@result = Object.new
|
117
|
+
@array_dict.stub(@method_sym).with(:arg1,:arg2,:etc).and_return(@result)
|
118
|
+
@array_dict.stub(:hash).and_return(@hash)
|
119
|
+
@plist_type.array_dict(@method_sym,:arg1,:arg2,:etc)
|
120
|
+
@plist_type.instance_eval { @hash }.should == @hash
|
121
|
+
@plist_type.instance_eval { @orig }.should == @hash
|
122
|
+
@plist.instance_eval { @hash }.should == @hash
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
data/spec/plist4r_spec.rb
CHANGED
@@ -1,57 +1,83 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'plist4r'
|
2
3
|
|
3
|
-
describe Plist4r, "new" do
|
4
|
-
before do
|
5
|
-
|
6
|
-
|
4
|
+
describe Plist4r, "#new" do
|
5
|
+
before(:each) do
|
6
|
+
@plist = Plist4r::Plist.new
|
7
|
+
Plist4r::Plist.stub!(:new).and_return(@plist)
|
7
8
|
end
|
8
9
|
|
9
|
-
it "should
|
10
|
+
it "should return a Plist4r::Plist object" do
|
11
|
+
Plist4r.new.should be_a_kind_of(Plist4r::Plist)
|
10
12
|
end
|
11
13
|
|
12
|
-
it "should
|
13
|
-
|
14
|
+
it "should call Plist4r::Plist.new with the supplied arguments and return @plist" do
|
15
|
+
Plist4r::Plist.should_receive(:new).with(:arg1, :arg2, :arg3, :etc)
|
16
|
+
@result = Plist4r.new(:arg1, :arg2, :arg3, :etc)
|
17
|
+
@result.should == @plist
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
17
|
-
describe Plist4r, "open" do
|
18
|
-
before do
|
19
|
-
|
20
|
-
|
21
|
+
describe Plist4r, "#open" do
|
22
|
+
before(:each) do
|
23
|
+
@plist = Plist4r::Plist.new
|
24
|
+
@plist.stub!(:open).and_return(@plist)
|
25
|
+
Plist4r::Plist.stub!(:new).and_return(@plist)
|
21
26
|
end
|
22
27
|
|
23
|
-
it "should
|
28
|
+
it "should return a Plist4r::Plist object" do
|
29
|
+
Plist4r.new.should be_a_kind_of(Plist4r::Plist)
|
24
30
|
end
|
25
31
|
|
26
|
-
it "should
|
32
|
+
it "should call Plist4r::Plist.new with the supplied arguments and return @plist" do
|
33
|
+
Plist4r::Plist.should_receive(:new).with("filename", :arg2, :arg3, :etc)
|
34
|
+
Plist4r.open("filename", :arg2, :arg3, :etc).should == @plist
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should call @plist.open" do
|
38
|
+
@plist.should_receive(:open)
|
39
|
+
@result = Plist4r.open("filename", :arg2, :arg3, :etc)
|
27
40
|
end
|
28
41
|
end
|
29
42
|
|
30
|
-
describe Plist4r, "string_detect_format" do
|
31
|
-
before do
|
43
|
+
describe Plist4r, "#string_detect_format" do
|
44
|
+
before(:each) do
|
45
|
+
@plist_str_gnustep1 = " ("
|
46
|
+
@plist_str_gnustep2 = " {"
|
47
|
+
@plist_str_xml = " <?xml\n<!DOCTYPE plist"
|
48
|
+
@plist_str_binary = " bplist"
|
32
49
|
end
|
50
|
+
|
33
51
|
it "should detect the plist format of the string given" do
|
52
|
+
Plist4r::string_detect_format(@plist_str_gnustep1).should == :gnustep
|
53
|
+
Plist4r::string_detect_format(@plist_str_gnustep2).should == :gnustep
|
54
|
+
Plist4r::string_detect_format(@plist_str_xml).should == :xml
|
55
|
+
Plist4r::string_detect_format(@plist_str_binary).should == :binary
|
34
56
|
end
|
35
57
|
end
|
36
58
|
|
37
|
-
describe Plist4r, "file_detect_format" do
|
38
|
-
before do
|
59
|
+
describe Plist4r, "#file_detect_format" do
|
60
|
+
before(:each) do
|
61
|
+
File.stub!(:read).with("filename").and_return("string")
|
62
|
+
Plist4r.stub!(:string_detect_format).with("string").and_return(:plist_format)
|
63
|
+
|
39
64
|
end
|
65
|
+
|
40
66
|
it "should detect the plist format of the file given" do
|
67
|
+
Plist4r::file_detect_format("filename").should == :plist_format
|
41
68
|
end
|
42
69
|
end
|
43
70
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should run ::Plist4r.new with the supplied string (self)" do
|
71
|
+
describe String, "#to_plist" do
|
72
|
+
before(:each) do
|
73
|
+
@string = "string"
|
74
|
+
@plist = Plist4r::Plist.new
|
75
|
+
Plist4r.stub!(:new).and_return(@plist)
|
52
76
|
end
|
53
77
|
|
54
|
-
it "should return the new Plist object" do
|
78
|
+
it "should run ::Plist4r.new with the supplied string (self) and return the new Plist object" do
|
79
|
+
Plist4r.should_receive(:new).with(:from_string => @string)
|
80
|
+
@string.to_plist.should == @plist
|
55
81
|
end
|
56
82
|
end
|
57
83
|
|
data/spec/scratchpad.rb
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'lib/plist4r'
|
5
|
+
|
6
|
+
|
7
|
+
def output
|
8
|
+
require 'plist4r/backend/test/output'
|
9
|
+
o = Plist4r::Backend::Test::Output.new
|
10
|
+
puts o
|
11
|
+
o.write_html_file
|
12
|
+
end
|
13
|
+
# output
|
14
|
+
|
15
|
+
def start_irb
|
16
|
+
# cd tmp/plist4r
|
17
|
+
# irb -r 'rubygems' -r 'lib/plist4r'
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
# convert DateTime to Time
|
22
|
+
# require 'time'
|
23
|
+
# require 'date'
|
24
|
+
#
|
25
|
+
# t = Time.now
|
26
|
+
# d = DateTime.now
|
27
|
+
|
28
|
+
# dd = DateTime.parse(t.to_s)
|
29
|
+
# tt = Time.parse(d.to_s)
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
def general_test
|
34
|
+
Plist4r.new
|
35
|
+
|
36
|
+
Plist4r::Config[:raise_any_failure] = true
|
37
|
+
# Plist4r::Config[:backends].replace ["haml","libxml4r","ruby_cocoa"]
|
38
|
+
# Plist4r::Config[:backends].replace ["osx_plist"]
|
39
|
+
Plist4r::Config[:backends].replace ["c_f_property_list"]
|
40
|
+
puts `pwd`
|
41
|
+
Plist4r::Config[:default_path] = "spec/data"
|
42
|
+
# puts Plist4r::Config[:default_path]
|
43
|
+
p = Plist4r.open "manual/array_mini.xml"
|
44
|
+
p = Plist4r.open "manual/example_medium_launchd.xml"
|
45
|
+
# p = Plist4r.open "manual/example_big_binary.plist"
|
46
|
+
|
47
|
+
# Plist4r.new do
|
48
|
+
# end
|
49
|
+
|
50
|
+
# puts p.inspect
|
51
|
+
puts p.to_hash.inspect
|
52
|
+
puts p.to_xml
|
53
|
+
|
54
|
+
b = p.to_binary
|
55
|
+
puts b.inspect
|
56
|
+
|
57
|
+
|
58
|
+
p2 = b.to_plist
|
59
|
+
# puts p2.inspect
|
60
|
+
puts p2.to_xml
|
61
|
+
|
62
|
+
# puts p2.to_xml
|
63
|
+
# puts "plist type is"
|
64
|
+
# puts p2.plist_type.inspect
|
65
|
+
|
66
|
+
# p2.strict_keys false
|
67
|
+
# puts p2.strict_keys.inspect
|
68
|
+
# p2.<< do
|
69
|
+
# somekey "append"
|
70
|
+
# end
|
71
|
+
|
72
|
+
# puts p2.to_hash.inspect
|
73
|
+
# puts p2.to_xml
|
74
|
+
end
|
75
|
+
# general_test
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
def select_test
|
83
|
+
# Plist4r::Config[:backends].replace ["ruby_cocoa"]
|
84
|
+
# Plist4r::Config[:backends].replace ["osx_plist"]
|
85
|
+
|
86
|
+
# puts Plist4r::Config[:backends].inspect
|
87
|
+
# Plist4r::Config[:backends].replace ["c_f_property_list", "haml", "libxml4r", "ruby_cocoa"]
|
88
|
+
# Plist4r::Config[:backends].replace ["osx_plist", "haml", "libxml4r", "ruby_cocoa"]
|
89
|
+
|
90
|
+
|
91
|
+
plist = Plist4r.new do
|
92
|
+
key1 "value1"
|
93
|
+
key2 "value2"
|
94
|
+
|
95
|
+
# bool1 true
|
96
|
+
# bool2 false
|
97
|
+
#
|
98
|
+
# int1 1
|
99
|
+
# int2 2
|
100
|
+
#
|
101
|
+
# float1 1.01
|
102
|
+
# float2 2.02
|
103
|
+
end
|
104
|
+
|
105
|
+
# puts plist.to_xml
|
106
|
+
# puts ""
|
107
|
+
# puts plist.to_hash.hash.inspect
|
108
|
+
# puts plist.to_xml
|
109
|
+
# puts ""
|
110
|
+
|
111
|
+
# puts plist.backends.inspect
|
112
|
+
# plist.save_as "tmp.xml"
|
113
|
+
|
114
|
+
# puts plist.to_binary
|
115
|
+
# puts ""
|
116
|
+
# plist.file_format :binary
|
117
|
+
# plist.save_as "tmp.plist"
|
118
|
+
|
119
|
+
|
120
|
+
# plist.<< do
|
121
|
+
# select("zkey1", "zkey2")
|
122
|
+
# end
|
123
|
+
|
124
|
+
plist[:foo_fighters] = "too old to party?"
|
125
|
+
# plist[:foo_fighters] = "too"
|
126
|
+
# plist["HuggyBears"] = "are expensive"
|
127
|
+
plist["HuggyBears"] = "are expensive party animals"
|
128
|
+
# calls to which object?
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
# plist.unselect("zkey1", "zkey2")
|
133
|
+
|
134
|
+
# plist.select "Zkey1", "Zkey2"
|
135
|
+
|
136
|
+
# plist.select do |k,v|
|
137
|
+
# if v.to_s =~ /value/
|
138
|
+
# true
|
139
|
+
# else
|
140
|
+
# false
|
141
|
+
# end
|
142
|
+
# end
|
143
|
+
|
144
|
+
# puts plist.huggy_bearsss.inspect
|
145
|
+
|
146
|
+
plist.plist_type :info
|
147
|
+
|
148
|
+
plist.<< do
|
149
|
+
zkey1 "avalue11"
|
150
|
+
zkey2 "avalue22"
|
151
|
+
c_f_bundle_identifier "some string"
|
152
|
+
c_f_bundle_version "some string"
|
153
|
+
|
154
|
+
# c_f_bundle_identifier 1
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
plist.map do |k,v|
|
159
|
+
# [k,v]
|
160
|
+
# [k,1]
|
161
|
+
puts k.snake_case.to_sym.inspect
|
162
|
+
[k.snake_case.to_sym,(v+" and other string")]
|
163
|
+
end
|
164
|
+
|
165
|
+
p2 = Plist4r.new do
|
166
|
+
some_more_key1 "____________UNDERSCORE___________"
|
167
|
+
some_more_key2 "____________UNDERSCORE___________"
|
168
|
+
some_more_key3 "____________UNDERSCORE___________"
|
169
|
+
some_more_key4 "____________UNDERSCORE___________"
|
170
|
+
plist_type :info
|
171
|
+
end
|
172
|
+
plist.merge! p2
|
173
|
+
|
174
|
+
# plist.delete :some_more_key1
|
175
|
+
|
176
|
+
# p2.plist_type :info
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
plist.delete_if do |k,v|
|
181
|
+
# v =~ /11/
|
182
|
+
# v =~ /slslslsl/
|
183
|
+
false
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
# plist.to_hash.sort
|
188
|
+
|
189
|
+
# plist.unselect "Zkey1", "Zkey2"
|
190
|
+
# plist.delete "Zkey1", "Zkey2"
|
191
|
+
# plist.select "Zkey1", "Zkey2"
|
192
|
+
# plist.clear
|
193
|
+
# plist.foo_fighters("zkey1")
|
194
|
+
|
195
|
+
# plist.select do |k,v|
|
196
|
+
# v =~ /UNDER/
|
197
|
+
# end
|
198
|
+
|
199
|
+
|
200
|
+
# puts plist.backends.inspect
|
201
|
+
|
202
|
+
# puts plist.to_hash.inspect
|
203
|
+
|
204
|
+
puts plist.to_xml
|
205
|
+
puts ""
|
206
|
+
|
207
|
+
# puts plist.to_hash.inspect
|
208
|
+
# puts ""
|
209
|
+
|
210
|
+
# plist.from_string s
|
211
|
+
# FileUtils.rm("tmp.xml")
|
212
|
+
# plist.save_as "tmp.plist"
|
213
|
+
|
214
|
+
|
215
|
+
end
|
216
|
+
# select_test
|
217
|
+
|
218
|
+
|
219
|
+
# p = Plist4r.open("/Applications/Apps 1/Irssi.app/Contents/Info.plist")
|
220
|
+
# puts p.plist_type.inspect
|
221
|
+
#
|
222
|
+
# p.open("/Library/LaunchDaemons/com.vmware.launchd.vmware.plist")
|
223
|
+
# puts p.plist_type.inspect
|
224
|
+
|
225
|
+
|
226
|
+
|