Skip to content

Commit

Permalink
Fixed stylistic issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeStanton committed May 14, 2015
1 parent 29325d7 commit d145224
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions local-cli/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ function init(projectDir, appName) {

walk(source).forEach(function(f) {
f = f.replace(source + '/', ''); // Strip off absolute path
if(f === 'project.xcworkspace' || f === 'xcuserdata') { return; }
if (f === 'project.xcworkspace' || f === 'xcuserdata') {
return;
}

var replacements = {
'Examples/SampleApp/': '',
Expand Down Expand Up @@ -37,8 +39,7 @@ function copyAndReplace(src, dest, replacements) {
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest);
}
}
else {
} else {
var content = fs.readFileSync(src, 'utf8');
Object.keys(replacements).forEach(function(regex) {
content = content.replace(new RegExp(regex, 'g'), replacements[regex]);
Expand All @@ -48,15 +49,15 @@ function copyAndReplace(src, dest, replacements) {
}

function walk(current) {
if(fs.lstatSync(current).isDirectory()) {
var files = fs.readdirSync(current).map(function(child) {
child = path.join(current, child);
return walk(child);
});
return [].concat.apply([current], files);
} else {
if (!fs.lstatSync(current).isDirectory()) {
return [current];
}

var files = fs.readdirSync(current).map(function(child) {
child = path.join(current, child);
return walk(child);
});
return [].concat.apply([current], files);
}

module.exports = init;

0 comments on commit d145224

Please sign in to comment.