File tree 3 files changed +18
-0
lines changed
3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 1
1
node_modules /*
2
+ .DS_Store
2
3
npm-debug.log
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ var util = require('util'),
6
6
fork = require ( 'child_process' ) . fork ,
7
7
pbxWriter = require ( './pbxWriter' ) ,
8
8
pbxFile = require ( './pbxFile' ) ,
9
+ fs = require ( 'fs' ) ,
10
+ parser = require ( './parser/pbxproj' ) ,
9
11
COMMENT_KEY = / _ c o m m e n t $ /
10
12
11
13
function pbxProject ( filename ) {
@@ -37,6 +39,12 @@ pbxProject.prototype.parse = function (cb) {
37
39
return this ;
38
40
}
39
41
42
+ pbxProject . prototype . parseSync = function ( ) {
43
+ var file_contents = fs . readFileSync ( this . filepath , 'utf-8' )
44
+ , obj = parser . parse ( file_contents ) ;
45
+ return obj ;
46
+ }
47
+
40
48
pbxProject . prototype . writeSync = function ( ) {
41
49
this . writer = new pbxWriter ( this . hash ) ;
42
50
return this . writer . writeSync ( ) ;
Original file line number Diff line number Diff line change @@ -18,6 +18,15 @@ exports['creation'] = {
18
18
}
19
19
}
20
20
21
+ exports [ 'parseSync function' ] = {
22
+ 'should return the hash object' : function ( test ) {
23
+ var myProj = new pbx ( 'test/parser/projects/hash.pbxproj' )
24
+ , projHash = myProj . parseSync ( ) ;
25
+ test . ok ( projHash ) ;
26
+ test . done ( ) ;
27
+ }
28
+ }
29
+
21
30
exports [ 'parse function' ] = {
22
31
'should emit an "end" event' : function ( test ) {
23
32
var myProj = new pbx ( 'test/parser/projects/hash.pbxproj' ) ;
You can’t perform that action at this time.
0 commit comments