File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 11node_modules /*
2+ .DS_Store
23npm-debug.log
Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ var util = require('util'),
66 fork = require ( 'child_process' ) . fork ,
77 pbxWriter = require ( './pbxWriter' ) ,
88 pbxFile = require ( './pbxFile' ) ,
9+ fs = require ( 'fs' ) ,
10+ parser = require ( './parser/pbxproj' ) ,
911 COMMENT_KEY = / _ c o m m e n t $ /
1012
1113function pbxProject ( filename ) {
@@ -37,6 +39,12 @@ pbxProject.prototype.parse = function (cb) {
3739 return this ;
3840}
3941
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+
4048pbxProject . prototype . writeSync = function ( ) {
4149 this . writer = new pbxWriter ( this . hash ) ;
4250 return this . writer . writeSync ( ) ;
Original file line number Diff line number Diff line change @@ -18,6 +18,15 @@ exports['creation'] = {
1818 }
1919}
2020
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+
2130exports [ 'parse function' ] = {
2231 'should emit an "end" event' : function ( test ) {
2332 var myProj = new pbx ( 'test/parser/projects/hash.pbxproj' ) ;
You can’t perform that action at this time.
0 commit comments