28
by Mathieu Trudel-Lapierre
testing the flattenage, yo |
1 |
# node-xcode
|
2 |
||
3 |
> parser/toolkit for xcodeproj project files |
|
4 |
||
5 |
Allows you to edit xcodeproject files and write them back out. |
|
6 |
||
7 |
## Example
|
|
8 |
||
9 |
// API is a bit wonky right now |
|
10 |
var xcode = require('xcode'), |
|
11 |
fs = require('fs'), |
|
12 |
projectPath = 'myproject.xcodeproj/project.pbxproj', |
|
13 |
myProj = xcode.project(projectPath); |
|
14 |
||
15 |
// parsing is async, in a different process
|
|
16 |
myProj.parse(function (err) {
|
|
17 |
myProj.addHeaderFile('foo.h');
|
|
18 |
myProj.addSourceFile('foo.m');
|
|
19 |
myProj.addFramework('FooKit.framework');
|
|
20 |
|
|
21 |
fs.writeFileSync(projectPath, myProj.writeSync());
|
|
22 |
console.log('new project written');
|
|
23 |
});
|
|
24 |
||
25 |
## Working on the parser
|
|
26 |
||
27 |
If there's a problem parsing, you will want to edit the grammar under |
|
28 |
`lib/parser/pbxproj.pegjs`. You can test it online with the PEGjs online thingy
|
|
29 |
at http://pegjs.majda.cz/online - I have had some mixed results though. |
|
30 |
||
31 |
Tests under the `test/parser` directory will compile the parser from the
|
|
32 |
grammar. Other tests will use the prebuilt parser (`lib/parser/pbxproj.js`).
|
|
33 |
||
34 |
To rebuild the parser js file after editing the grammar, run: |
|
35 |
||
36 |
./node_modules/.bin/pegjs lib/parser/pbxproj.pegjs
|
|
37 |
||
38 |
(easier if `./node_modules/.bin` is in your path)
|
|
39 |
||
40 |
## License
|
|
41 |
||
42 |
MIT |