plist 0.4.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleDevelopmentRegion</key>
6
- <string>English</string>
7
- <key>CFBundleIdentifier</key>
8
- <string>com.apple.dictionary.MySample</string>
9
- <key>CFBundleName</key>
10
- <string>MyDictionary</string>
11
- <key>CFBundleShortVersionString</key>
12
- <string>1.0</string>
13
- <key>DCSDictionaryCopyright</key>
14
- <string>Copyright © 2007 Apple Inc.</string>
15
- <key>DCSDictionaryManufacturerName</key>
16
- <string>Apple Inc.</string>
17
- <key>DCSDictionaryFrontMatterReferenceID</key>
18
- <string>front_back_matter</string>
19
- <key>DCSDictionaryPrefsHTML</key>
20
- <string>MyDictionary_prefs.html</string>
21
- <key>DCSDictionaryXSL</key>
22
- <string>MyDictionary.xsl</string>
23
- <key>DCSDictionaryDefaultPrefs</key>
24
- <dict>
25
- <key>pronunciation</key>
26
- <string>0</string>
27
- <key>display-column</key>
28
- <string>1</string>
29
- <key>display-picture</key>
30
- <string>1</string>
31
- <key>version</key>
32
- <string>1</string>
33
- </dict>
34
- </dict>
35
- </plist>
@@ -1,45 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>OptionsLabel</key>
6
- <string>Product</string>
7
- <key>PopupMenu</key>
8
- <array>
9
- <dict>
10
- <key>Key</key>
11
- <string>iPhone</string>
12
- <key>Title</key>
13
- <string>iPhone</string>
14
- </dict>
15
- <dict>
16
- <key>Key</key>
17
- <string>iPad</string>
18
- <key>Title</key>
19
- <string>iPad</string>
20
- </dict>
21
- <dict>
22
- <key>Key</key>
23
- <string>
24
- <![CDATA[
25
- #import &lt;Cocoa/Cocoa.h&gt;
26
-
27
- #import &lt;MacRuby/MacRuby.h&gt;
28
-
29
- int main(int argc, char *argv[])
30
- {
31
- return macruby_main("rb_main.rb", argc, argv);
32
- }
33
- ]]>
34
- </string>
35
- </dict>
36
- </array>
37
- <key>TemplateSelection</key>
38
- <dict>
39
- <key>iPhone</key>
40
- <string>Tab Bar iPhone Application</string>
41
- <key>iPad</key>
42
- <string>Tab Bar iPad Application</string>
43
- </dict>
44
- </dict>
45
- </plist>
@@ -1,28 +0,0 @@
1
- /**
2
- * tests for base64 encoding and decoding, used in <data> elements
3
- */
4
-
5
- var path = require('path')
6
- , plist = require('../');
7
-
8
- exports.testDecodeBase64 = function(test) {
9
- var file = path.join(__dirname, 'utf8data.xml');
10
- var p = plist.parseFileSync(file);
11
- test.equal(p['Smart Info'], '✓ à la mode');
12
- test.done();
13
- }
14
-
15
- exports.testDecodeBase64WithNewlines = function(test) {
16
- var file = path.join(__dirname, 'utf8data.xml');
17
- var p = plist.parseFileSync(file);
18
- test.equal(p['Newlines'], '✓ à la mode');
19
- test.done();
20
- }
21
-
22
- exports.testBase64Encode = function(test) {
23
- var to_write = { yay: '✓ à la mode' };
24
- var out = plist.build(to_write);
25
- var p = plist.parseStringSync(out);
26
- test.equal(p['yay'], '✓ à la mode');
27
- test.done();
28
- }
@@ -1,28 +0,0 @@
1
- var path = require('path')
2
- , plist = require('../')
3
- , file = path.join(__dirname, 'iTunes-BIG.xml')
4
- , startTime = new Date();
5
-
6
- exports.textBigXML = function(test) {
7
- plist.parseFile(file, function(err, dicts) {
8
- var dict = dicts[0];
9
-
10
- test.ifError(err);
11
-
12
- test.equal(dicts.length, 1);
13
- test.equal(dict['Application Version'], '9.2.1');
14
- test.deepEqual(Object.keys(dict), [
15
- 'Major Version'
16
- , 'Minor Version'
17
- , 'Application Version'
18
- , 'Features'
19
- , 'Show Content Ratings'
20
- , 'Music Folder'
21
- , 'Library Persistent ID'
22
- , 'Tracks'
23
- , 'Playlists'
24
- ]);
25
-
26
- test.done();
27
- });
28
- }
@@ -1,171 +0,0 @@
1
- var path = require('path')
2
- , fs = require('fs')
3
- , plist = require('../');
4
-
5
- /*
6
- // TODO These assertions fail because CDATA entities get converted in the process
7
- exports.testBuildFromPlistFile = function(test) {
8
- var file = path.join(__dirname, 'sample2.plist');
9
-
10
- plist.parseFile(file, function(err, dicts) {
11
- var dict = dicts[0];
12
- test.ifError(err);
13
-
14
- // Try re-stringifying and re-parsing
15
- plist.parseString(plist.build(dict), function(err, dicts2) {
16
- test.ifError(err);
17
- test.deepEqual(dicts,dicts2);
18
- test.done();
19
- });
20
- });
21
- }
22
- */
23
-
24
-
25
- exports.testNonBase64StringsAsData = function(test) {
26
- var test_object = { 'a': 'test stringy thingy', 'b': 'this contains non base64 ✔ ' };
27
-
28
- var result = plist.build(test_object);
29
- var DOMParser = require('xmldom').DOMParser;
30
- var doc = new DOMParser().parseFromString(result);
31
-
32
- test.equal('a', doc.documentElement.childNodes[1].childNodes[1].childNodes[0].nodeValue);
33
- test.equal('string', doc.documentElement.childNodes[1].childNodes[3].nodeName);
34
- test.equal('test stringy thingy', doc.documentElement.childNodes[1].childNodes[3].childNodes[0].nodeValue);
35
-
36
- test.equal('b', doc.documentElement.childNodes[1].childNodes[5].childNodes[0].nodeValue);
37
- test.equal ('string', doc.documentElement.childNodes[1].childNodes[7].nodeName);
38
- test.equal ('this contains non base64 ✔ ', doc.documentElement.childNodes[1].childNodes[7].childNodes[0].nodeValue);
39
-
40
- test.done();
41
- }
42
-
43
-
44
-
45
- exports.testBuildFromObjectWithFunctions = function(test) {
46
- var test_object = { 'a': 'test stringy thingy', 'b': function(c, d){ return 'neat'; } };
47
-
48
- // Try stringifying
49
- plist.parseString(plist.build(test_object), function(err, dicts) {
50
- test.equal(dicts[0].b, undefined);
51
- test.equal(dicts[0].a, 'test stringy thingy');
52
- test.done();
53
- });
54
- }
55
-
56
-
57
- exports.testBuildFromSmallItunesXML = function(test) {
58
- var file = path.join(__dirname, 'iTunes-small.xml');
59
- plist.parseFile(file, function(err, dicts) {
60
- var dict = dicts[0];
61
-
62
- test.ifError(err);
63
-
64
- // Try re-stringifying and re-parsing
65
- plist.parseString(plist.build(dict), function(err, dicts2) {
66
- test.ifError(err);
67
- test.deepEqual(dicts,dicts2);
68
- test.done();
69
- });
70
- });
71
- }
72
-
73
- exports.testBuildAirplayXML = function(test) {
74
- var file = path.join(__dirname, 'airplay.xml');
75
-
76
- plist.parseFile(file, function(err, dicts) {
77
- var dict = dicts[0];
78
- test.ifError(err);
79
-
80
- // Try re-stringifying and re-parsing
81
- plist.parseString(plist.build(dict), function(err, dicts2) {
82
- test.ifError(err);
83
- test.deepEqual(dicts,dicts2);
84
- test.done();
85
- });
86
- });
87
- }
88
-
89
- exports.testCordovaPlist = function(test) {
90
- var file = path.join(__dirname, 'Cordova.plist');
91
-
92
- plist.parseFile(file, function(err, dicts) {
93
- var dict = dicts[0];
94
- test.ifError(err);
95
- test.equal(dict['TopActivityIndicator'], 'gray');
96
- test.equal(dict['Plugins']['Device'], 'CDVDevice');
97
-
98
- // Try re-stringifying and re-parsing
99
- plist.parseString(plist.build(dict), function(err, dicts2) {
100
- test.ifError(err);
101
- test.deepEqual(dicts,dicts2);
102
- test.done();
103
- });
104
- });
105
- }
106
-
107
- exports.testBuildPhoneGapPlist = function(test) {
108
- var file = path.join(__dirname, 'Xcode-PhoneGap.plist');
109
-
110
- plist.parseFile(file, function(err, dicts) {
111
- var dict = dicts[0];
112
- test.ifError(err);
113
-
114
- test.equal(dict['ExternalHosts'][0], "*");
115
- test.equal(dict['Plugins']['com.phonegap.accelerometer'], "PGAccelerometer");
116
-
117
- //console.log('like they were', dict);
118
- //console.log('hmm', plist.build(dict));
119
- // Try re-stringifying and re-parsing
120
- plist.parseString(plist.build(dict), function(err, dicts2) {
121
- test.ifError(err);
122
- test.deepEqual(dicts,dicts2);
123
- test.done();
124
- });
125
- });
126
- }
127
-
128
- exports.testBuildXcodeInfoPlist = function(test) {
129
- var file = path.join(__dirname, 'Xcode-Info.plist');
130
-
131
- plist.parseFile(file, function(err, dicts) {
132
- var dict = dicts[0];
133
- test.ifError(err);
134
-
135
- test.equal(dict['CFBundleAllowMixedLocalizations'], true);
136
- test.equal(dict['CFBundleExecutable'], "${EXECUTABLE_NAME}");
137
- test.equal(dict['UISupportedInterfaceOrientations~ipad'][0], "UIInterfaceOrientationPortrait");
138
-
139
- // Try re-stringifying and re-parsing
140
- plist.parseString(plist.build(dict), function(err, dicts2) {
141
- test.ifError(err);
142
- test.deepEqual(dicts,dicts2);
143
- test.done();
144
- });
145
- });
146
- }
147
-
148
-
149
- // this code does a string to string comparison. It's not very useful right
150
- // now because CDATA sections arent supported. save for later I guess
151
- /*
152
- function flattenXMLForAssert(instr) {
153
- return instr.replace(/\s/g,'');
154
- }
155
-
156
- // Builder test B - build plist from JS object, then compare flattened XML against original plist *file* content
157
- function testBuildAgainstFile(test, dict, infile) {
158
- var doc = plist.build(dict)
159
- , fileContent = fs.readFileSync(infile)
160
- , s1 = flattenXMLForAssert(doc.toString())
161
- , s2 = flattenXMLForAssert(fileContent.toString())
162
- , mismatch = '';
163
-
164
- for (var i=0;i<s1.length; i++) {
165
- if (s1[i]!==s2[i]) {
166
- mismatch = '" at char '+ i;
167
- break;
168
- }
169
- }
170
- test.equal(s1, s2, 'file mismatch in "' + infile + mismatch);
171
- }*/
@@ -1,52 +0,0 @@
1
- var path = require('path')
2
- , plist = require('../');
3
-
4
- exports.testParseFileSmallItunesXML = function(test) {
5
- var file = path.join(__dirname, 'iTunes-small.xml');
6
- plist.parseFile(file, function(err, dicts) {
7
- var dict = dicts[0];
8
-
9
- test.ifError(err);
10
- test.equal(dict['Application Version'], '9.0.3');
11
- test.equal(dict['Library Persistent ID'], '6F81D37F95101437');
12
-
13
- test.done();
14
- });
15
- }
16
-
17
- exports.testParseFile = function(test) {
18
- var file = path.join(__dirname, 'sample2.plist');
19
-
20
- plist.parseFile(file, function(err, dicts) {
21
- var dict = dicts[0];
22
- test.ifError(err);
23
-
24
- test.equal(dict['PopupMenu'][2]['Key'], "\n \n #import &lt;Cocoa/Cocoa.h&gt;\n\n#import &lt;MacRuby/MacRuby.h&gt;\n\nint main(int argc, char *argv[])\n{\n return macruby_main(\"rb_main.rb\", argc, argv);\n}\n\n");
25
-
26
- test.done();
27
- });
28
- }
29
-
30
- exports.testParseFileSync = function(test) {
31
- var file = path.join(__dirname, 'sample2.plist');
32
- test.doesNotThrow(function(){
33
- var dict = plist.parseFileSync(file);
34
- test.equal(dict['PopupMenu'][2]['Key'], "\n \n #import &lt;Cocoa/Cocoa.h&gt;\n\n#import &lt;MacRuby/MacRuby.h&gt;\n\nint main(int argc, char *argv[])\n{\n return macruby_main(\"rb_main.rb\", argc, argv);\n}\n\n");
35
- });
36
- test.done();
37
- }
38
-
39
- exports.testParseFileAirplayXML = function(test) {
40
- var file = path.join(__dirname, 'airplay.xml');
41
-
42
- plist.parseFile(file, function(err, dicts) {
43
- var dict;
44
- test.ifError(err);
45
- dict = dicts[0];
46
-
47
- test.equal(dict['duration'], 5555.0495000000001);
48
- test.equal(dict['position'], 4.6269989039999997);
49
-
50
- test.done();
51
- });
52
- }
@@ -1,45 +0,0 @@
1
- var plist = require('../');
2
-
3
- exports.testString = function(test) {
4
- plist.parseString('<string>Hello World!</string>', function(err, res) {
5
- test.ifError(err);
6
- test.equal(res, 'Hello World!');
7
- test.done();
8
- });
9
- }
10
-
11
- exports.testParseStringSync = function(test) {
12
- test.doesNotThrow(function(){
13
- var res = plist.parseStringSync('<plist><dict><key>test</key><integer>101</integer></dict></plist>');
14
- test.equal(Object.keys(res)[0], 'test');
15
- test.equal(res.test, 101);
16
- test.done();
17
- });
18
- }
19
-
20
- exports.testParseStringSyncFailsOnInvalidXML = function(test) {
21
- test.throws(function(){
22
- var res = plist.parseStringSync('<string>Hello World!</string>');
23
- });
24
- test.done();
25
- }
26
-
27
- exports.testDict = function(test) {
28
- plist.parseString('<plist><dict><key>test</key><integer>101</integer></dict></plist>', function(err, res) {
29
- test.ifError(err);
30
-
31
- test.ok(Array.isArray(res));
32
- test.equal(res.length, 1);
33
- test.equal(Object.keys(res[0])[0], 'test');
34
- test.equal(res[0].test, 101);
35
- test.done();
36
- });
37
- }
38
-
39
- exports.testCDATA = function(test) {
40
- plist.parseString('<string><![CDATA[Hello World!&lt;M]]></string>', function(err, res) {
41
- test.ifError(err);
42
- test.equal(res, 'Hello World!&lt;M');
43
- test.done();
44
- });
45
- }
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>Smart Info</key>
6
- <data>4pyTIMOgIGxhIG1vZGU=</data>
7
- <key>Newlines</key>
8
- <data>4pyTIMOgIGxhIG1vZGU=</data>
9
- </dict>
10
- </plist>