Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Add console logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ericrwolfe committed Dec 21, 2016
1 parent c58f64d commit 2b7863d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
10 changes: 6 additions & 4 deletions platform/ios/ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@
DA8847CE1CBAF91600AB86E3 /* Frameworks */,
DA8847CF1CBAF91600AB86E3 /* Headers */,
DA8847D01CBAF91600AB86E3 /* Resources */,
64E5BF321E09D729005223F7 /* ShellScript */,
64E5BF321E09D729005223F7 /* Add Examples to Documentation */,
);
buildRules = (
);
Expand Down Expand Up @@ -1728,7 +1728,7 @@
DAA4E4101CBB71D400178DFB /* Frameworks */,
DAA4E4111CBB71D400178DFB /* CopyFiles */,
DABFB85C1CBE99DE00D62B32 /* Headers */,
6421B07A1E09EA4B00AF169B /* ShellScript */,
6421B07A1E09EA4B00AF169B /* Add Examples to Documentation */,
);
buildRules = (
);
Expand Down Expand Up @@ -1921,26 +1921,28 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
6421B07A1E09EA4B00AF169B /* ShellScript */ = {
6421B07A1E09EA4B00AF169B /* Add Examples to Documentation */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Add Examples to Documentation";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "node \"${SRCROOT}/scripts/add-examples-to-docs.js\"";
};
64E5BF321E09D729005223F7 /* ShellScript */ = {
64E5BF321E09D729005223F7 /* Add Examples to Documentation */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Add Examples to Documentation";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
10 changes: 9 additions & 1 deletion platform/ios/scripts/add-examples-to-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const exampleRegex = /\/\*---BEGIN EXAMPLE:(.*)---\*\/\s*(\/\*+[\s\S]*?\*+\/)?([

var path = `${process.env.TARGET_BUILD_DIR}/${process.env.PUBLIC_HEADERS_FOLDER_PATH}`;

console.log("Installing examples...");

var match;
while ((match = exampleRegex.exec(examples)) !== null) {
const token = match[1].trim();
Expand Down Expand Up @@ -50,8 +52,14 @@ while ((match = exampleRegex.exec(examples)) !== null) {
const file = fs.readFileSync(filename, 'utf8');
// Check for example placeholder in file & update file if found
if (placeholderRegex.test(file)) {
console.log("Updating examples:", filename);
console.log("Updating example:", filename);
fs.writeFileSync(filename, file.replace(placeholderRegex, exampleText));
} else if (file.indexOf(exampleText) === -1) {
console.log(`Placeholder "${token}" missing:`, filename);
} else {
console.log(`Example "${token}" already replaced.`);
}
} else if (token !== "ExampleToken") {
console.log("Error file doesn't exist:", filename);
}
}

0 comments on commit 2b7863d

Please sign in to comment.