Enabling code signing of frameworks during build
diff --git a/lib/pbxFile.js b/lib/pbxFile.js
index c53b1ab..b226550 100644
--- a/lib/pbxFile.js
+++ b/lib/pbxFile.js
@@ -110,18 +110,18 @@
 }
 
 function detectSourcetree(fileRef) {
-    
+
     var filetype = fileRef.lastKnownFileType || fileRef.explicitFileType,
         sourcetree = SOURCETREE_BY_FILETYPE[unquoted(filetype)];
 
     if (fileRef.explicitFileType) {
         return DEFAULT_PRODUCT_SOURCETREE;
     }
-    
+
     if (fileRef.customFramework) {
         return DEFAULT_SOURCETREE;
     }
-    
+
     if (!sourcetree) {
         return DEFAULT_SOURCETREE;
     }
@@ -136,7 +136,7 @@
     if (fileRef.customFramework) {
         return filePath;
     }
-    
+
     if (defaultPath) {
         return path.join(defaultPath, path.basename(filePath));
     }
@@ -156,7 +156,7 @@
 
 function pbxFile(filepath, opt) {
     var opt = opt || {};
-    
+
     self = this;
 
     this.basename = path.basename(filepath);
@@ -194,6 +194,14 @@
             this.settings = {};
         this.settings.COMPILER_FLAGS = util.format('"%s"', opt.compilerFlags);
     }
+
+    if (opt.sign) {
+      if (!this.settings)
+          this.settings = {};
+      if (!this.settings.ATTRIBUTES)
+          this.settings.ATTRIBUTES = [];
+      this.settings.ATTRIBUTES.push('CodeSignOnCopy');
+    }
 }
 
 module.exports = pbxFile;
diff --git a/test/addFramework.js b/test/addFramework.js
index 60b1b81..efae42e 100644
--- a/test/addFramework.js
+++ b/test/addFramework.js
@@ -131,6 +131,18 @@
 
         test.done();
     },
+    'should add the PBXBuildFile object correctly /w signable frameworks': function (test) {
+        var newFile = proj.addFramework('libsqlite3.dylib', { sign: true }),
+            buildFileSection = proj.pbxBuildFileSection(),
+            buildFileEntry = buildFileSection[newFile.uuid];
+
+        test.equal(buildFileEntry.isa, 'PBXBuildFile');
+        test.equal(buildFileEntry.fileRef, newFile.fileRef);
+        test.equal(buildFileEntry.fileRef_comment, 'libsqlite3.dylib');
+        test.deepEqual(buildFileEntry.settings, { ATTRIBUTES: [ 'CodeSignOnCopy' ] });
+
+        test.done();
+    },
     'should add to the Frameworks PBXGroup': function (test) {
         var newLength = proj.pbxGroupByName('Frameworks').children.length + 1,
             newFile = proj.addFramework('libsqlite3.dylib'),
diff --git a/test/pbxFile.js b/test/pbxFile.js
index ac876f3..90e0851 100644
--- a/test/pbxFile.js
+++ b/test/pbxFile.js
@@ -186,7 +186,7 @@
       test.equal(undefined, sourceFile.settings);
       test.done();
     },
-  
+
     'should be undefined if weak is false or non-boolean': function (test) {
         var sourceFile1 = new pbxFile('social.framework',
             { weak: false });
@@ -206,6 +206,22 @@
         test.done();
     },
 
+    'should be {ATTRIBUTES:["CodeSignOnCopy"]} if sign specified': function (test) {
+        var sourceFile = new pbxFile('signable.framework',
+            { sign: true });
+
+        test.deepEqual({ATTRIBUTES:["CodeSignOnCopy"]}, sourceFile.settings);
+        test.done();
+    },
+
+    'should be {ATTRIBUTES:["Weak","CodeSignOnCopy"]} if both weak linking and sign specified': function (test) {
+        var sourceFile = new pbxFile('signableWeak.framework',
+            { weak: true, sign: true });
+
+        test.deepEqual({ATTRIBUTES:["Weak", "CodeSignOnCopy"]}, sourceFile.settings);
+        test.done();
+    },
+
     'should be {COMPILER_FLAGS:"blah"} if compiler flags specified': function (test) {
         var sourceFile = new pbxFile('Plugins/BarcodeScanner.m',
             { compilerFlags: "-std=c++11 -fno-objc-arc" });