Skip to content

Commit 4ee0d31

Browse files
committed
Merge pull request #1 from alunny/master
merge latest updates into mcgrews3-fork
2 parents 3131b93 + f082343 commit 4ee0d31

File tree

15 files changed

+3550
-1618
lines changed

15 files changed

+3550
-1618
lines changed

lib/pbxFile.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,14 @@ function defaultEncoding(fileRef) {
9494
}
9595

9696
function detectGroup(fileRef) {
97-
var filetype = fileRef.lastKnownFileType || fileRef.explicitFileType,
97+
var extension = path.extname(fileRef.basename).substring(1),
98+
filetype = fileRef.lastKnownFileType || fileRef.explicitFileType,
9899
groupName = GROUP_BY_FILETYPE[unquoted(filetype)];
99100

101+
if (extension === 'xcdatamodeld') {
102+
return 'Sources';
103+
}
104+
100105
if (!groupName) {
101106
return DEFAULT_GROUP;
102107
}
@@ -105,18 +110,18 @@ function detectGroup(fileRef) {
105110
}
106111

107112
function detectSourcetree(fileRef) {
108-
113+
109114
var filetype = fileRef.lastKnownFileType || fileRef.explicitFileType,
110115
sourcetree = SOURCETREE_BY_FILETYPE[unquoted(filetype)];
111116

112117
if (fileRef.explicitFileType) {
113118
return DEFAULT_PRODUCT_SOURCETREE;
114119
}
115-
120+
116121
if (fileRef.customFramework) {
117122
return DEFAULT_SOURCETREE;
118123
}
119-
124+
120125
if (!sourcetree) {
121126
return DEFAULT_SOURCETREE;
122127
}
@@ -131,7 +136,7 @@ function defaultPath(fileRef, filePath) {
131136
if (fileRef.customFramework) {
132137
return filePath;
133138
}
134-
139+
135140
if (defaultPath) {
136141
return path.join(defaultPath, path.basename(filePath));
137142
}
@@ -151,23 +156,22 @@ function defaultGroup(fileRef) {
151156

152157
function pbxFile(filepath, opt) {
153158
var opt = opt || {};
154-
159+
155160
self = this;
156161

162+
this.basename = path.basename(filepath);
157163
this.lastKnownFileType = opt.lastKnownFileType || detectType(filepath);
158164
this.group = detectGroup(self);
159165

160166
// for custom frameworks
161167
if (opt.customFramework == true) {
162168
this.customFramework = true;
163-
this.dirname = path.dirname(filepath);
169+
this.dirname = path.dirname(filepath).replace(/\\/g, '/');
164170
}
165171

166-
this.basename = path.basename(filepath);
167-
this.path = defaultPath(this, filepath);
172+
this.path = defaultPath(this, filepath).replace(/\\/g, '/');
168173
this.fileEncoding = this.defaultEncoding = opt.defaultEncoding || defaultEncoding(self);
169174

170-
171175
// When referencing products / build output files
172176
if (opt.explicitFileType) {
173177
this.explicitFileType = opt.explicitFileType;
@@ -189,6 +193,14 @@ function pbxFile(filepath, opt) {
189193
this.settings = {};
190194
this.settings.COMPILER_FLAGS = util.format('"%s"', opt.compilerFlags);
191195
}
196+
197+
if (opt.sign) {
198+
if (!this.settings)
199+
this.settings = {};
200+
if (!this.settings.ATTRIBUTES)
201+
this.settings.ATTRIBUTES = [];
202+
this.settings.ATTRIBUTES.push('CodeSignOnCopy');
203+
}
192204
}
193205

194206
module.exports = pbxFile;

0 commit comments

Comments
 (0)