plist 1.1.0 → 1.2.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.
- package/.travis.yml +2 -0
- package/History.md +10 -0
- package/dist/plist-build.js +3082 -11696
- package/dist/plist-parse.js +1144 -717
- package/dist/plist.js +4298 -11231
- package/lib/build.js +4 -2
- package/package.json +9 -8
- package/test/build.js +0 -133
- package/test/parse.js +0 -448
package/lib/build.js
CHANGED
|
@@ -92,7 +92,9 @@ function walk_obj(next, next_child) {
|
|
|
92
92
|
var tag_type, i, prop;
|
|
93
93
|
var name = type(next);
|
|
94
94
|
|
|
95
|
-
if (
|
|
95
|
+
if ('Undefined' == name) {
|
|
96
|
+
return;
|
|
97
|
+
} else if (Array.isArray(next)) {
|
|
96
98
|
next_child = next_child.ele('array');
|
|
97
99
|
for (i = 0; i < next.length; i++) {
|
|
98
100
|
walk_obj(next[i], next_child);
|
|
@@ -128,7 +130,7 @@ function walk_obj(next, next_child) {
|
|
|
128
130
|
} else if ('ArrayBuffer' == name) {
|
|
129
131
|
next_child.ele('data').raw(base64.fromByteArray(next));
|
|
130
132
|
|
|
131
|
-
} else if (next.buffer && 'ArrayBuffer' == type(next.buffer)) {
|
|
133
|
+
} else if (next && next.buffer && 'ArrayBuffer' == type(next.buffer)) {
|
|
132
134
|
// a typed array
|
|
133
135
|
next_child.ele('data').raw(base64.fromByteArray(new Uint8Array(next.buffer), next_child));
|
|
134
136
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "plist",
|
|
3
3
|
"description": "Mac OS X Plist parser/builder for Node.js and browsers",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"author": "Nathan Rajlich <nathan@tootallnate.net>",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Hans Huebner <hans.huebner@gmail.com>",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git://github.com/TooTallNate/node-plist.git"
|
|
16
16
|
},
|
|
17
|
+
"license": "MIT",
|
|
17
18
|
"keywords": [
|
|
18
19
|
"apple",
|
|
19
20
|
"browser",
|
|
@@ -24,16 +25,16 @@
|
|
|
24
25
|
],
|
|
25
26
|
"main": "lib/plist.js",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"base64-js": "0.0.
|
|
28
|
-
"xmlbuilder": "
|
|
28
|
+
"base64-js": "0.0.8",
|
|
29
|
+
"xmlbuilder": "4.0.0",
|
|
29
30
|
"xmldom": "0.1.x",
|
|
30
|
-
"util-deprecate": "1.0.
|
|
31
|
+
"util-deprecate": "1.0.2"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"browserify": "
|
|
34
|
-
"mocha": "
|
|
35
|
-
"multiline": "0.
|
|
36
|
-
"zuul": "
|
|
34
|
+
"browserify": "12.0.1",
|
|
35
|
+
"mocha": "2.3.3",
|
|
36
|
+
"multiline": "1.0.2",
|
|
37
|
+
"zuul": "3.7.2"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
40
|
"test": "make test"
|
package/test/build.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var assert = require('assert');
|
|
3
|
-
var build = require('../').build;
|
|
4
|
-
var multiline = require('multiline');
|
|
5
|
-
|
|
6
|
-
describe('plist', function () {
|
|
7
|
-
|
|
8
|
-
describe('build()', function () {
|
|
9
|
-
|
|
10
|
-
it('should create a plist XML string from a String', function () {
|
|
11
|
-
var xml = build('test');
|
|
12
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
13
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
14
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
15
|
-
<plist version="1.0">
|
|
16
|
-
<string>test</string>
|
|
17
|
-
</plist>
|
|
18
|
-
*/}));
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should create a plist XML integer from a whole Number', function () {
|
|
22
|
-
var xml = build(3);
|
|
23
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
24
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
25
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
26
|
-
<plist version="1.0">
|
|
27
|
-
<integer>3</integer>
|
|
28
|
-
</plist>
|
|
29
|
-
*/}));
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should create a plist XML real from a fractional Number', function () {
|
|
33
|
-
var xml = build(Math.PI);
|
|
34
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
35
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
36
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
37
|
-
<plist version="1.0">
|
|
38
|
-
<real>3.141592653589793</real>
|
|
39
|
-
</plist>
|
|
40
|
-
*/}));
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should create a plist XML date from a Date', function () {
|
|
44
|
-
var xml = build(new Date('2010-02-08T21:41:23Z'));
|
|
45
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
46
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
47
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
48
|
-
<plist version="1.0">
|
|
49
|
-
<date>2010-02-08T21:41:23Z</date>
|
|
50
|
-
</plist>
|
|
51
|
-
*/}));
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should create a plist XML date from a Buffer', function () {
|
|
55
|
-
var xml = build(new Buffer('☃'));
|
|
56
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
57
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
58
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
59
|
-
<plist version="1.0">
|
|
60
|
-
<data>4piD</data>
|
|
61
|
-
</plist>
|
|
62
|
-
*/}));
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should create a plist XML true from a `true` Boolean', function () {
|
|
66
|
-
var xml = build(true);
|
|
67
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
68
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
69
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
70
|
-
<plist version="1.0">
|
|
71
|
-
<true/>
|
|
72
|
-
</plist>
|
|
73
|
-
*/}));
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('should create a plist XML false from a `false` Boolean', function () {
|
|
77
|
-
var xml = build(false);
|
|
78
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
79
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
80
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
81
|
-
<plist version="1.0">
|
|
82
|
-
<false/>
|
|
83
|
-
</plist>
|
|
84
|
-
*/}));
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('should create a plist XML dict from an Object', function () {
|
|
88
|
-
var xml = build({ foo: 'bar' });
|
|
89
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
90
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
91
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
92
|
-
<plist version="1.0">
|
|
93
|
-
<dict>
|
|
94
|
-
<key>foo</key>
|
|
95
|
-
<string>bar</string>
|
|
96
|
-
</dict>
|
|
97
|
-
</plist>
|
|
98
|
-
*/}));
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should create a plist XML array from an Array', function () {
|
|
102
|
-
var xml = build([ 1, 'foo', false, new Date(1234) ]);
|
|
103
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
104
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
105
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
106
|
-
<plist version="1.0">
|
|
107
|
-
<array>
|
|
108
|
-
<integer>1</integer>
|
|
109
|
-
<string>foo</string>
|
|
110
|
-
<false/>
|
|
111
|
-
<date>1970-01-01T00:00:01Z</date>
|
|
112
|
-
</array>
|
|
113
|
-
</plist>
|
|
114
|
-
*/}));
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('should properly encode an empty string', function () {
|
|
118
|
-
var xml = build({ a: '' });
|
|
119
|
-
assert.strictEqual(xml, multiline(function () {/*
|
|
120
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
121
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
122
|
-
<plist version="1.0">
|
|
123
|
-
<dict>
|
|
124
|
-
<key>a</key>
|
|
125
|
-
<string></string>
|
|
126
|
-
</dict>
|
|
127
|
-
</plist>
|
|
128
|
-
*/}));
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
});
|
package/test/parse.js
DELETED
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
var assert = require('assert');
|
|
3
|
-
var parse = require('../').parse;
|
|
4
|
-
var multiline = require('multiline');
|
|
5
|
-
|
|
6
|
-
describe('plist', function () {
|
|
7
|
-
|
|
8
|
-
describe('parse()', function () {
|
|
9
|
-
|
|
10
|
-
it('should parse a minimal <string> node into a String', function () {
|
|
11
|
-
var parsed = parse('<plist><string>Hello World!</string></plist>');
|
|
12
|
-
assert.strictEqual(parsed, 'Hello World!');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('should parse a full XML <string> node into a String', function () {
|
|
16
|
-
var xml = multiline(function () {/*
|
|
17
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
18
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
19
|
-
<plist version="1.0">
|
|
20
|
-
<string>gray</string>
|
|
21
|
-
</plist>
|
|
22
|
-
*/});
|
|
23
|
-
var parsed = parse(xml);
|
|
24
|
-
assert.strictEqual(parsed, 'gray');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('should parse an <integer> node into a Number', function () {
|
|
28
|
-
var xml = multiline(function () {/*
|
|
29
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
30
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
31
|
-
<plist version="1.0">
|
|
32
|
-
<integer>14</integer>
|
|
33
|
-
</plist>
|
|
34
|
-
*/});
|
|
35
|
-
var parsed = parse(xml);
|
|
36
|
-
assert.strictEqual(parsed, 14);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should parse a <real> node into a Number', function () {
|
|
40
|
-
var xml = multiline(function () {/*
|
|
41
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
42
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
43
|
-
<plist version="1.0">
|
|
44
|
-
<real>3.14</real>
|
|
45
|
-
</plist>
|
|
46
|
-
*/});
|
|
47
|
-
var parsed = parse(xml);
|
|
48
|
-
assert.strictEqual(parsed, 3.14);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should parse a <date> node into a Date', function () {
|
|
52
|
-
var xml = multiline(function () {/*
|
|
53
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
54
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
55
|
-
<plist version="1.0">
|
|
56
|
-
<date>2010-02-08T21:41:23Z</date>
|
|
57
|
-
</plist>
|
|
58
|
-
*/});
|
|
59
|
-
var parsed = parse(xml);
|
|
60
|
-
assert(parsed instanceof Date);
|
|
61
|
-
assert.strictEqual(parsed.getTime(), 1265665283000);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should parse a <data> node into a Buffer', function () {
|
|
65
|
-
var xml = multiline(function () {/*
|
|
66
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
67
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
68
|
-
<plist version="1.0">
|
|
69
|
-
<data>4pyTIMOgIGxhIG1vZGU=</data>
|
|
70
|
-
</plist>
|
|
71
|
-
*/});
|
|
72
|
-
var parsed = parse(xml);
|
|
73
|
-
assert(Buffer.isBuffer(parsed));
|
|
74
|
-
assert.strictEqual(parsed.toString('utf8'), '✓ à la mode');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('should parse a <data> node with newlines into a Buffer', function () {
|
|
78
|
-
var xml = multiline(function () {/*
|
|
79
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
80
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
81
|
-
<plist version="1.0">
|
|
82
|
-
<data>4pyTIMOgIGxhIG
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
1v
|
|
86
|
-
|
|
87
|
-
ZG
|
|
88
|
-
U=</data>
|
|
89
|
-
</plist>
|
|
90
|
-
*/});
|
|
91
|
-
var parsed = parse(xml);
|
|
92
|
-
assert(Buffer.isBuffer(parsed));
|
|
93
|
-
assert.strictEqual(parsed.toString('utf8'), '✓ à la mode');
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('should parse a <true> node into a Boolean `true` value', function () {
|
|
97
|
-
var xml = multiline(function () {/*
|
|
98
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
99
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
100
|
-
<plist version="1.0">
|
|
101
|
-
<true/>
|
|
102
|
-
</plist>
|
|
103
|
-
*/});
|
|
104
|
-
var parsed = parse(xml);
|
|
105
|
-
assert.strictEqual(parsed, true);
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('should parse a <false> node into a Boolean `false` value', function () {
|
|
109
|
-
var xml = multiline(function () {/*
|
|
110
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
111
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
112
|
-
<plist version="1.0">
|
|
113
|
-
<false/>
|
|
114
|
-
</plist>
|
|
115
|
-
*/});
|
|
116
|
-
var parsed = parse(xml);
|
|
117
|
-
assert.strictEqual(parsed, false);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('should parse an <array> node into an Array', function () {
|
|
121
|
-
var xml = multiline(function () {/*
|
|
122
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
123
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
124
|
-
<plist version="1.0">
|
|
125
|
-
<array>
|
|
126
|
-
<dict>
|
|
127
|
-
<key>duration</key>
|
|
128
|
-
<real>5555.0495000000001</real>
|
|
129
|
-
<key>start</key>
|
|
130
|
-
<real>0.0</real>
|
|
131
|
-
</dict>
|
|
132
|
-
</array>
|
|
133
|
-
</plist>
|
|
134
|
-
*/});
|
|
135
|
-
var parsed = parse(xml);
|
|
136
|
-
assert.deepEqual(parsed, [
|
|
137
|
-
{
|
|
138
|
-
duration: 5555.0495,
|
|
139
|
-
start: 0
|
|
140
|
-
}
|
|
141
|
-
]);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('should parse a plist file with XML comments', function () {
|
|
145
|
-
var xml = multiline(function () {/*
|
|
146
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
147
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
148
|
-
<plist version="1.0">
|
|
149
|
-
<dict>
|
|
150
|
-
<key>CFBundleName</key>
|
|
151
|
-
<string>Emacs</string>
|
|
152
|
-
|
|
153
|
-
<key>CFBundlePackageType</key>
|
|
154
|
-
<string>APPL</string>
|
|
155
|
-
|
|
156
|
-
<!-- This should be the emacs version number. -->
|
|
157
|
-
|
|
158
|
-
<key>CFBundleShortVersionString</key>
|
|
159
|
-
<string>24.3</string>
|
|
160
|
-
|
|
161
|
-
<key>CFBundleSignature</key>
|
|
162
|
-
<string>EMAx</string>
|
|
163
|
-
|
|
164
|
-
<!-- This SHOULD be a build number. -->
|
|
165
|
-
|
|
166
|
-
<key>CFBundleVersion</key>
|
|
167
|
-
<string>9.0</string>
|
|
168
|
-
</dict>
|
|
169
|
-
</plist>
|
|
170
|
-
*/});
|
|
171
|
-
var parsed = parse(xml);
|
|
172
|
-
assert.deepEqual(parsed, {
|
|
173
|
-
CFBundleName: 'Emacs',
|
|
174
|
-
CFBundlePackageType: 'APPL',
|
|
175
|
-
CFBundleShortVersionString: '24.3',
|
|
176
|
-
CFBundleSignature: 'EMAx',
|
|
177
|
-
CFBundleVersion: '9.0'
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('should parse a plist file with CDATA content', function () {
|
|
182
|
-
var xml = multiline(function () {/*
|
|
183
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
184
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
185
|
-
<plist version="1.0">
|
|
186
|
-
<dict>
|
|
187
|
-
<key>OptionsLabel</key>
|
|
188
|
-
<string>Product</string>
|
|
189
|
-
<key>PopupMenu</key>
|
|
190
|
-
<array>
|
|
191
|
-
<dict>
|
|
192
|
-
<key>Key</key>
|
|
193
|
-
<string>iPhone</string>
|
|
194
|
-
<key>Title</key>
|
|
195
|
-
<string>iPhone</string>
|
|
196
|
-
</dict>
|
|
197
|
-
<dict>
|
|
198
|
-
<key>Key</key>
|
|
199
|
-
<string>iPad</string>
|
|
200
|
-
<key>Title</key>
|
|
201
|
-
<string>iPad</string>
|
|
202
|
-
</dict>
|
|
203
|
-
<dict>
|
|
204
|
-
<key>Key</key>
|
|
205
|
-
<string>
|
|
206
|
-
<![CDATA[
|
|
207
|
-
#import <Cocoa/Cocoa.h>
|
|
208
|
-
|
|
209
|
-
#import <MacRuby/MacRuby.h>
|
|
210
|
-
|
|
211
|
-
int main(int argc, char *argv[])
|
|
212
|
-
{
|
|
213
|
-
return macruby_main("rb_main.rb", argc, argv);
|
|
214
|
-
}
|
|
215
|
-
]]>
|
|
216
|
-
</string>
|
|
217
|
-
</dict>
|
|
218
|
-
</array>
|
|
219
|
-
<key>TemplateSelection</key>
|
|
220
|
-
<dict>
|
|
221
|
-
<key>iPhone</key>
|
|
222
|
-
<string>Tab Bar iPhone Application</string>
|
|
223
|
-
<key>iPad</key>
|
|
224
|
-
<string>Tab Bar iPad Application</string>
|
|
225
|
-
</dict>
|
|
226
|
-
</dict>
|
|
227
|
-
</plist>
|
|
228
|
-
*/});
|
|
229
|
-
var parsed = parse(xml);
|
|
230
|
-
assert.deepEqual(parsed, { OptionsLabel: 'Product',
|
|
231
|
-
PopupMenu:
|
|
232
|
-
[ { Key: 'iPhone', Title: 'iPhone' },
|
|
233
|
-
{ Key: 'iPad', Title: 'iPad' },
|
|
234
|
-
{ Key: '\n \n #import <Cocoa/Cocoa.h>\n\n#import <MacRuby/MacRuby.h>\n\nint main(int argc, char *argv[])\n{\n return macruby_main("rb_main.rb", argc, argv);\n}\n\n' } ],
|
|
235
|
-
TemplateSelection:
|
|
236
|
-
{ iPhone: 'Tab Bar iPhone Application',
|
|
237
|
-
iPad: 'Tab Bar iPad Application' }
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('should parse an example "Cordova.plist" file', function () {
|
|
242
|
-
var xml = multiline(function () {/*
|
|
243
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
244
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
245
|
-
<!--
|
|
246
|
-
#
|
|
247
|
-
# Licensed to the Apache Software Foundation (ASF) under one
|
|
248
|
-
# or more contributor license agreements. See the NOTICE file
|
|
249
|
-
# distributed with this work for additional information
|
|
250
|
-
# regarding copyright ownership. The ASF licenses this file
|
|
251
|
-
# to you under the Apache License, Version 2.0 (the
|
|
252
|
-
# "License"); you may not use this file except in compliance
|
|
253
|
-
# with the License. You may obtain a copy of the License at
|
|
254
|
-
#
|
|
255
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
256
|
-
#
|
|
257
|
-
# Unless required by applicable law or agreed to in writing,
|
|
258
|
-
# software distributed under the License is distributed on an
|
|
259
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
260
|
-
# KIND, either express or implied. See the License for the
|
|
261
|
-
# specific language governing permissions and limitations
|
|
262
|
-
# under the License.
|
|
263
|
-
#
|
|
264
|
-
-->
|
|
265
|
-
<plist version="1.0">
|
|
266
|
-
<dict>
|
|
267
|
-
<key>UIWebViewBounce</key>
|
|
268
|
-
<true/>
|
|
269
|
-
<key>TopActivityIndicator</key>
|
|
270
|
-
<string>gray</string>
|
|
271
|
-
<key>EnableLocation</key>
|
|
272
|
-
<false/>
|
|
273
|
-
<key>EnableViewportScale</key>
|
|
274
|
-
<false/>
|
|
275
|
-
<key>AutoHideSplashScreen</key>
|
|
276
|
-
<true/>
|
|
277
|
-
<key>ShowSplashScreenSpinner</key>
|
|
278
|
-
<true/>
|
|
279
|
-
<key>MediaPlaybackRequiresUserAction</key>
|
|
280
|
-
<false/>
|
|
281
|
-
<key>AllowInlineMediaPlayback</key>
|
|
282
|
-
<false/>
|
|
283
|
-
<key>OpenAllWhitelistURLsInWebView</key>
|
|
284
|
-
<false/>
|
|
285
|
-
<key>BackupWebStorage</key>
|
|
286
|
-
<true/>
|
|
287
|
-
<key>ExternalHosts</key>
|
|
288
|
-
<array>
|
|
289
|
-
<string>*</string>
|
|
290
|
-
</array>
|
|
291
|
-
<key>Plugins</key>
|
|
292
|
-
<dict>
|
|
293
|
-
<key>Device</key>
|
|
294
|
-
<string>CDVDevice</string>
|
|
295
|
-
<key>Logger</key>
|
|
296
|
-
<string>CDVLogger</string>
|
|
297
|
-
<key>Compass</key>
|
|
298
|
-
<string>CDVLocation</string>
|
|
299
|
-
<key>Accelerometer</key>
|
|
300
|
-
<string>CDVAccelerometer</string>
|
|
301
|
-
<key>Camera</key>
|
|
302
|
-
<string>CDVCamera</string>
|
|
303
|
-
<key>NetworkStatus</key>
|
|
304
|
-
<string>CDVConnection</string>
|
|
305
|
-
<key>Contacts</key>
|
|
306
|
-
<string>CDVContacts</string>
|
|
307
|
-
<key>Debug Console</key>
|
|
308
|
-
<string>CDVDebugConsole</string>
|
|
309
|
-
<key>Echo</key>
|
|
310
|
-
<string>CDVEcho</string>
|
|
311
|
-
<key>File</key>
|
|
312
|
-
<string>CDVFile</string>
|
|
313
|
-
<key>FileTransfer</key>
|
|
314
|
-
<string>CDVFileTransfer</string>
|
|
315
|
-
<key>Geolocation</key>
|
|
316
|
-
<string>CDVLocation</string>
|
|
317
|
-
<key>Notification</key>
|
|
318
|
-
<string>CDVNotification</string>
|
|
319
|
-
<key>Media</key>
|
|
320
|
-
<string>CDVSound</string>
|
|
321
|
-
<key>Capture</key>
|
|
322
|
-
<string>CDVCapture</string>
|
|
323
|
-
<key>SplashScreen</key>
|
|
324
|
-
<string>CDVSplashScreen</string>
|
|
325
|
-
<key>Battery</key>
|
|
326
|
-
<string>CDVBattery</string>
|
|
327
|
-
</dict>
|
|
328
|
-
</dict>
|
|
329
|
-
</plist>
|
|
330
|
-
*/});
|
|
331
|
-
var parsed = parse(xml);
|
|
332
|
-
assert.deepEqual(parsed, {
|
|
333
|
-
UIWebViewBounce: true,
|
|
334
|
-
TopActivityIndicator: 'gray',
|
|
335
|
-
EnableLocation: false,
|
|
336
|
-
EnableViewportScale: false,
|
|
337
|
-
AutoHideSplashScreen: true,
|
|
338
|
-
ShowSplashScreenSpinner: true,
|
|
339
|
-
MediaPlaybackRequiresUserAction: false,
|
|
340
|
-
AllowInlineMediaPlayback: false,
|
|
341
|
-
OpenAllWhitelistURLsInWebView: false,
|
|
342
|
-
BackupWebStorage: true,
|
|
343
|
-
ExternalHosts: [ '*' ],
|
|
344
|
-
Plugins: {
|
|
345
|
-
Device: 'CDVDevice',
|
|
346
|
-
Logger: 'CDVLogger',
|
|
347
|
-
Compass: 'CDVLocation',
|
|
348
|
-
Accelerometer: 'CDVAccelerometer',
|
|
349
|
-
Camera: 'CDVCamera',
|
|
350
|
-
NetworkStatus: 'CDVConnection',
|
|
351
|
-
Contacts: 'CDVContacts',
|
|
352
|
-
'Debug Console': 'CDVDebugConsole',
|
|
353
|
-
Echo: 'CDVEcho',
|
|
354
|
-
File: 'CDVFile',
|
|
355
|
-
FileTransfer: 'CDVFileTransfer',
|
|
356
|
-
Geolocation: 'CDVLocation',
|
|
357
|
-
Notification: 'CDVNotification',
|
|
358
|
-
Media: 'CDVSound',
|
|
359
|
-
Capture: 'CDVCapture',
|
|
360
|
-
SplashScreen: 'CDVSplashScreen',
|
|
361
|
-
Battery: 'CDVBattery'
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
it('should parse an example "Xcode-Info.plist" file', function () {
|
|
367
|
-
var xml = multiline(function () {/*
|
|
368
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
369
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
370
|
-
<plist version="1.0">
|
|
371
|
-
<dict>
|
|
372
|
-
<key>CFBundleDevelopmentRegion</key>
|
|
373
|
-
<string>en</string>
|
|
374
|
-
<key>CFBundleDisplayName</key>
|
|
375
|
-
<string>${PRODUCT_NAME}</string>
|
|
376
|
-
<key>CFBundleExecutable</key>
|
|
377
|
-
<string>${EXECUTABLE_NAME}</string>
|
|
378
|
-
<key>CFBundleIconFiles</key>
|
|
379
|
-
<array/>
|
|
380
|
-
<key>CFBundleIdentifier</key>
|
|
381
|
-
<string>com.joshfire.ads</string>
|
|
382
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
|
383
|
-
<string>6.0</string>
|
|
384
|
-
<key>CFBundleName</key>
|
|
385
|
-
<string>${PRODUCT_NAME}</string>
|
|
386
|
-
<key>CFBundlePackageType</key>
|
|
387
|
-
<string>APPL</string>
|
|
388
|
-
<key>CFBundleShortVersionString</key>
|
|
389
|
-
<string>1.0</string>
|
|
390
|
-
<key>CFBundleSignature</key>
|
|
391
|
-
<string>????</string>
|
|
392
|
-
<key>CFBundleVersion</key>
|
|
393
|
-
<string>1.0</string>
|
|
394
|
-
<key>LSRequiresIPhoneOS</key>
|
|
395
|
-
<true/>
|
|
396
|
-
<key>UIRequiredDeviceCapabilities</key>
|
|
397
|
-
<array>
|
|
398
|
-
<string>armv7</string>
|
|
399
|
-
</array>
|
|
400
|
-
<key>UISupportedInterfaceOrientations</key>
|
|
401
|
-
<array>
|
|
402
|
-
<string>UIInterfaceOrientationPortrait</string>
|
|
403
|
-
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
404
|
-
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
405
|
-
</array>
|
|
406
|
-
<key>UISupportedInterfaceOrientations~ipad</key>
|
|
407
|
-
<array>
|
|
408
|
-
<string>UIInterfaceOrientationPortrait</string>
|
|
409
|
-
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
|
410
|
-
<string>UIInterfaceOrientationLandscapeLeft</string>
|
|
411
|
-
<string>UIInterfaceOrientationLandscapeRight</string>
|
|
412
|
-
</array>
|
|
413
|
-
<key>CFBundleAllowMixedLocalizations</key>
|
|
414
|
-
<true/>
|
|
415
|
-
</dict>
|
|
416
|
-
</plist>
|
|
417
|
-
*/});
|
|
418
|
-
var parsed = parse(xml);
|
|
419
|
-
assert.deepEqual(parsed, {
|
|
420
|
-
CFBundleDevelopmentRegion: 'en',
|
|
421
|
-
CFBundleDisplayName: '${PRODUCT_NAME}',
|
|
422
|
-
CFBundleExecutable: '${EXECUTABLE_NAME}',
|
|
423
|
-
CFBundleIconFiles: [],
|
|
424
|
-
CFBundleIdentifier: 'com.joshfire.ads',
|
|
425
|
-
CFBundleInfoDictionaryVersion: '6.0',
|
|
426
|
-
CFBundleName: '${PRODUCT_NAME}',
|
|
427
|
-
CFBundlePackageType: 'APPL',
|
|
428
|
-
CFBundleShortVersionString: '1.0',
|
|
429
|
-
CFBundleSignature: '????',
|
|
430
|
-
CFBundleVersion: '1.0',
|
|
431
|
-
LSRequiresIPhoneOS: true,
|
|
432
|
-
UIRequiredDeviceCapabilities: [ 'armv7' ],
|
|
433
|
-
UISupportedInterfaceOrientations:
|
|
434
|
-
[ 'UIInterfaceOrientationPortrait',
|
|
435
|
-
'UIInterfaceOrientationLandscapeLeft',
|
|
436
|
-
'UIInterfaceOrientationLandscapeRight' ],
|
|
437
|
-
'UISupportedInterfaceOrientations~ipad':
|
|
438
|
-
[ 'UIInterfaceOrientationPortrait',
|
|
439
|
-
'UIInterfaceOrientationPortraitUpsideDown',
|
|
440
|
-
'UIInterfaceOrientationLandscapeLeft',
|
|
441
|
-
'UIInterfaceOrientationLandscapeRight' ],
|
|
442
|
-
CFBundleAllowMixedLocalizations: true
|
|
443
|
-
});
|
|
444
|
-
});
|
|
445
|
-
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
});
|