From 2b7863d83bfbb291240ccaffd1bbc0c8309eec49 Mon Sep 17 00:00:00 2001 From: Eric Wolfe Date: Tue, 20 Dec 2016 17:27:11 -0800 Subject: [PATCH] Add console logging --- platform/ios/ios.xcodeproj/project.pbxproj | 10 ++++++---- platform/ios/scripts/add-examples-to-docs.js | 10 +++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index b7a5cb303dc..c9cf5e7b1a6 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -1693,7 +1693,7 @@ DA8847CE1CBAF91600AB86E3 /* Frameworks */, DA8847CF1CBAF91600AB86E3 /* Headers */, DA8847D01CBAF91600AB86E3 /* Resources */, - 64E5BF321E09D729005223F7 /* ShellScript */, + 64E5BF321E09D729005223F7 /* Add Examples to Documentation */, ); buildRules = ( ); @@ -1728,7 +1728,7 @@ DAA4E4101CBB71D400178DFB /* Frameworks */, DAA4E4111CBB71D400178DFB /* CopyFiles */, DABFB85C1CBE99DE00D62B32 /* Headers */, - 6421B07A1E09EA4B00AF169B /* ShellScript */, + 6421B07A1E09EA4B00AF169B /* Add Examples to Documentation */, ); buildRules = ( ); @@ -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; diff --git a/platform/ios/scripts/add-examples-to-docs.js b/platform/ios/scripts/add-examples-to-docs.js index eef8e7fe4f7..7be755e2c69 100644 --- a/platform/ios/scripts/add-examples-to-docs.js +++ b/platform/ios/scripts/add-examples-to-docs.js @@ -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(); @@ -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); } }