From 0f5ae7b11d3cef329c517a3729c3686344ed1c17 Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Fri, 13 Mar 2015 09:40:35 +0200 Subject: [PATCH 1/5] Fix validation when specifying version to update --- lib/commands/update-platform.ts | 2 +- lib/services/platform-service.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/commands/update-platform.ts b/lib/commands/update-platform.ts index 1c7dc22ae4..fa2c2bbd53 100644 --- a/lib/commands/update-platform.ts +++ b/lib/commands/update-platform.ts @@ -17,7 +17,7 @@ export class UpdatePlatformCommand implements ICommand { this.$errors.fail("No platform specified. Please specify platforms to update."); } - _.each(args, arg => this.$platformService.validatePlatformInstalled(arg)); + _.each(args, arg => this.$platformService.validatePlatformInstalled(arg.split("@")[0])); return true; }).future()(); diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 1652ea14f9..2aff7738d5 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -310,7 +310,8 @@ export class PlatformService implements IPlatformService { this.$errors.fail("No platform specified.") } - platform = platform.toLowerCase(); + var parts = platform.split("@"); + platform = parts[0].toLowerCase(); if (!this.isValidPlatform(platform)) { this.$errors.fail("Invalid platform %s. Valid platforms are %s.", platform, helpers.formatListOfNames(this.$platformsData.platformsNames)); From df49daaa484ad488f67af2d632340a9a5e036f4c Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Fri, 13 Mar 2015 15:19:59 +0200 Subject: [PATCH 2/5] Fix update - copy correctly TNSDebugging.framework and Metadata folder --- lib/definitions/platform.d.ts | 2 + lib/node-package-manager.ts | 11 +++++- lib/services/android-project-service.ts | 3 +- lib/services/ios-project-service.ts | 4 +- lib/services/platform-service.ts | 50 ++++++++++++++++++++----- 5 files changed, 55 insertions(+), 15 deletions(-) diff --git a/lib/definitions/platform.d.ts b/lib/definitions/platform.d.ts index 50ec1c49c2..e6316f0b39 100644 --- a/lib/definitions/platform.d.ts +++ b/lib/definitions/platform.d.ts @@ -27,6 +27,8 @@ interface IPlatformData { validPackageNamesForDevice: string[]; validPackageNamesForEmulator?: string[]; frameworkFilesExtensions: string[]; + frameworkDirectoriesExtensions?: string[]; + frameworkDirectoriesNames?: string[]; targetedOS?: string[]; } diff --git a/lib/node-package-manager.ts b/lib/node-package-manager.ts index fdc8aebf4d..c4775ddbcd 100644 --- a/lib/node-package-manager.ts +++ b/lib/node-package-manager.ts @@ -30,7 +30,14 @@ export class NodePackageManager implements INodePackageManager { } public addToCache(packageName: string, version: string): IFuture { - return this.addToCacheCore(packageName, version); + return (() => { + this.addToCacheCore(packageName, version).wait(); + + var packagePath = path.join(npm.cache, packageName, version, "package"); + if(!this.isPackageUnpacked(packagePath).wait()) { + this.cacheUnpack(packageName, version).wait(); + } + }).future()(); } public load(config?: any): IFuture { @@ -84,7 +91,7 @@ export class NodePackageManager implements INodePackageManager { } return options.frameworkPath; } else { - var version: string = version || this.getLatestVersion(packageName).wait(); + version = version || this.getLatestVersion(packageName).wait(); var packagePath = path.join(npm.cache, packageName, version, "package"); if (!this.isPackageCached(packagePath).wait()) { this.addToCacheCore(packageName, version).wait(); diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index 02178a25b1..5f2b40b60b 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -23,7 +23,6 @@ class AndroidProjectService implements IPlatformProjectService { private $logger: ILogger, private $projectData: IProjectData, private $propertiesParser: IPropertiesParser) { - } public get platformData(): IPlatformData { @@ -38,7 +37,7 @@ class AndroidProjectService implements IPlatformProjectService { util.format("%s-%s.%s", this.$projectData.projectName, "debug", "apk"), util.format("%s-%s.%s", this.$projectData.projectName, "release", "apk") ], - frameworkFilesExtensions: [".jar", ".dat"] + frameworkFilesExtensions: [".jar", ".dat", ".so"] }; } diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 70b0ccb0f1..8eec27de48 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -37,7 +37,9 @@ class IOSProjectService implements IPlatformProjectService { validPackageNamesForEmulator: [ this.$projectData.projectName + ".app" ], - frameworkFilesExtensions: [".a", ".h", ".bin"], + frameworkFilesExtensions: [".a", ".framework", ".bin"], + frameworkDirectoriesExtensions: [".framework"], + frameworkDirectoriesNames: ["Metadata"], targetedOS: ['darwin'] }; } diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 2aff7738d5..fa915056cb 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -464,16 +464,36 @@ export class PlatformService implements IPlatformService { private updatePlatformCore(platformData: IPlatformData, currentVersion: string, newVersion: string): IFuture { return (() => { // Remove old framework files - var oldFrameworkFiles = this.getFrameworkFiles(platformData, currentVersion).wait(); - _.each(oldFrameworkFiles, file => { - this.$fs.deleteFile(path.join(platformData.projectRoot, file)).wait(); + var oldFrameworkData = this.getFrameworkFiles(platformData, currentVersion).wait(); + + _.each(oldFrameworkData.frameworkFiles, file => { + var fileToDelete = path.join(platformData.projectRoot, file); + this.$logger.trace("Deleting %s", fileToDelete); + this.$fs.deleteFile(fileToDelete).wait(); + }); + + _.each(oldFrameworkData.frameworkDirectories, dir => { + var dirToDelete = path.join(platformData.projectRoot, dir); + this.$logger.trace("Deleting %s", dirToDelete); + this.$fs.deleteDirectory(dirToDelete).wait(); }); // Add new framework files - var newFrameworkFiles = this.getFrameworkFiles(platformData, newVersion).wait(); + var newFrameworkData = this.getFrameworkFiles(platformData, newVersion).wait(); var cacheDirectoryPath = this.getNpmCacheDirectoryCore(platformData.frameworkPackageName, newVersion); - _.each(newFrameworkFiles, file => { - shell.cp("-f", path.join(cacheDirectoryPath, file), path.join(platformData.projectRoot, file)); + + _.each(newFrameworkData.frameworkFiles, file => { + var sourceFile = path.join(cacheDirectoryPath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, file); + var destinationFile = path.join(platformData.projectRoot, file); + this.$logger.trace("Replacing %s with %s", sourceFile, destinationFile); + shell.cp("-f", sourceFile, destinationFile); + }); + + _.each(newFrameworkData.frameworkDirectories, dir => { + var sourceDirectory = path.join(cacheDirectoryPath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, dir); + var destinationDirectory = path.join(platformData.projectRoot, dir); + this.$logger.trace("Copying %s to %s", sourceDirectory, destinationDirectory); + shell.cp("-fR", path.join(sourceDirectory, "*"), destinationDirectory); }); // Update .tnsproject file @@ -485,16 +505,22 @@ export class PlatformService implements IPlatformService { }).future()(); } - private getFrameworkFiles(platformData: IPlatformData, version: string): IFuture { + private getFrameworkFiles(platformData: IPlatformData, version: string): IFuture { return (() => { var npmCacheDirectoryPath = this.getNpmCacheDirectory(platformData.frameworkPackageName, version).wait(); + var allFiles = this.$fs.enumerateFilesInDirectorySync(npmCacheDirectoryPath); var filteredFiles = _.filter(allFiles, file => _.contains(platformData.frameworkFilesExtensions, path.extname(file))); - var relativeToCacheFiles = _.map(filteredFiles, file => file.substr(npmCacheDirectoryPath.length)); - return relativeToCacheFiles; + var allFrameworkDirectories = _.map(this.$fs.readDirectory(path.join(npmCacheDirectoryPath, constants.PROJECT_FRAMEWORK_FOLDER_NAME)).wait(), dir => path.join(npmCacheDirectoryPath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, dir)); + var filteredFrameworkDirectories = _.filter(allFrameworkDirectories, dir => this.$fs.getFsStats(dir).wait().isDirectory() && (_.contains(platformData.frameworkFilesExtensions, path.extname(dir)) || _.contains(platformData.frameworkDirectoriesNames, path.basename(dir)))); - }).future()(); + return { + frameworkFiles: this.mapFrameworkFiles(npmCacheDirectoryPath, filteredFiles), + frameworkDirectories: this.mapFrameworkFiles(npmCacheDirectoryPath, filteredFrameworkDirectories) + } + + }).future()(); } private getNpmCacheDirectory(packageName: string, version: string): IFuture { @@ -512,5 +538,9 @@ export class PlatformService implements IPlatformService { private getNpmCacheDirectoryCore(packageName: string, version: string): string { return path.join(this.$npm.getCacheRootPath(), packageName, version, "package"); } + + private mapFrameworkFiles(npmCacheDirectoryPath: string, files: string[]): string[] { + return _.map(files, file => file.substr(npmCacheDirectoryPath.length + constants.PROJECT_FRAMEWORK_FOLDER_NAME.length + 1)) + } } $injector.register("platformService", PlatformService); From f46073fb7b5f22ca9309f4dd61882216fc8c454e Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Fri, 13 Mar 2015 18:58:56 +0200 Subject: [PATCH 3/5] Show confirmation dialog when xcodeproject files are different, backup the old one and override it with the new. --- lib/declarations.ts | 1 + lib/definitions/project.d.ts | 2 + lib/node-package-manager.ts | 6 ++- lib/services/android-project-service.ts | 10 +++++ lib/services/ios-project-service.ts | 44 ++++++++++++++++++-- lib/services/platform-service.ts | 54 +++++++++++++------------ 6 files changed, 87 insertions(+), 30 deletions(-) diff --git a/lib/declarations.ts b/lib/declarations.ts index 115bdc950f..fbd6c1b77a 100644 --- a/lib/declarations.ts +++ b/lib/declarations.ts @@ -5,6 +5,7 @@ interface INodePackageManager { load(config?: any): IFuture; install(packageName: string, options?: INpmInstallOptions): IFuture; getLatestVersion(packageName: string): IFuture; + getCachedPackagePath(packageName: string, version: string): string; } interface INpmInstallOptions { diff --git a/lib/definitions/project.d.ts b/lib/definitions/project.d.ts index 6e1fb41022..28cd6855f7 100644 --- a/lib/definitions/project.d.ts +++ b/lib/definitions/project.d.ts @@ -30,4 +30,6 @@ interface IPlatformProjectService { buildProject(projectRoot: string): IFuture; isPlatformPrepared(projectRoot: string): IFuture; addLibrary(platformData: IPlatformData, libraryPath: string): IFuture; + canUpdatePlatform(currentVersion: string, newVersion: string): IFuture; + updatePlatform(currentVersion: string, newVersion: string): IFuture; } diff --git a/lib/node-package-manager.ts b/lib/node-package-manager.ts index c4775ddbcd..be10604c93 100644 --- a/lib/node-package-manager.ts +++ b/lib/node-package-manager.ts @@ -80,6 +80,10 @@ export class NodePackageManager implements INodePackageManager { }).future()(); } + public getCachedPackagePath(packageName: string, version: string): string { + return path.join(npm.cache, packageName, version, "package"); + } + private installCore(packageName: string, pathToSave: string, version: string): IFuture { return (() => { if (options.frameworkPath) { @@ -92,7 +96,7 @@ export class NodePackageManager implements INodePackageManager { return options.frameworkPath; } else { version = version || this.getLatestVersion(packageName).wait(); - var packagePath = path.join(npm.cache, packageName, version, "package"); + var packagePath = this.getCachedPackagePath(packageName, version); if (!this.isPackageCached(packagePath).wait()) { this.addToCacheCore(packageName, version).wait(); } diff --git a/lib/services/android-project-service.ts b/lib/services/android-project-service.ts index 5f2b40b60b..0e3abae1bf 100644 --- a/lib/services/android-project-service.ts +++ b/lib/services/android-project-service.ts @@ -122,6 +122,16 @@ class AndroidProjectService implements IPlatformProjectService { }).future()(); } + public canUpdatePlatform(currentVersion: string, newVersion: string): IFuture { + return (() => { + return true; + }).future()(); + } + + updatePlatform(currentVersion: string, newVersion: string): IFuture { + return (() => { }).future()(); + } + private updateMetadata(projectRoot: string): void { var projMetadataDir = path.join(projectRoot, "assets", "metadata"); var libsmetadataDir = path.join(projectRoot, "../../lib", this.platformData.normalizedPlatformName, AndroidProjectService.METADATA_DIRNAME); diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 8eec27de48..b4628774ca 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -20,7 +20,8 @@ class IOSProjectService implements IPlatformProjectService { private $childProcess: IChildProcess, private $errors: IErrors, private $logger: ILogger, - private $iOSEmulatorServices: Mobile.IEmulatorPlatformServices) { } + private $iOSEmulatorServices: Mobile.IEmulatorPlatformServices, + private $npm: INodePackageManager) { } public get platformData(): IPlatformData { return { @@ -72,7 +73,7 @@ class IOSProjectService implements IPlatformProjectService { var xcodeProjectName = util.format("%s.xcodeproj", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER); shell.cp("-R", path.join(frameworkDir, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, "*"), path.join(projectRoot, IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)); - shell.cp("-R", path.join(frameworkDir, xcodeProjectName), path.join(projectRoot)); + shell.cp("-R", path.join(frameworkDir, xcodeProjectName), projectRoot); var directoryContent = this.$fs.readDirectory(frameworkDir).wait(); var frameworkFiles = _.difference(directoryContent, [IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER, xcodeProjectName]); @@ -195,7 +196,44 @@ class IOSProjectService implements IPlatformProjectService { this.$fs.writeFile(pbxProjPath, project.writeSync()).wait(); this.$logger.info("The iOS Deployment Target is now 8.0 in order to support Cocoa Touch Frameworks."); }).future()(); - } + } + + public canUpdatePlatform(currentVersion: string, newVersion: string): IFuture { + return (() => { + var currentXcodeProjectFile = this.buildPathToXcodeProjectFile(currentVersion); + var currentXcodeProjectFileContent = this.$fs.readFile(currentXcodeProjectFile).wait(); + + var newXcodeProjectFile = this.buildPathToXcodeProjectFile(newVersion); + var newXcodeProjectFileContent = this.$fs.readFile(newXcodeProjectFile).wait(); + + return currentXcodeProjectFileContent === newXcodeProjectFileContent; + + }).future()(); + } + + public updatePlatform(currentVersion: string, newVersion: string): IFuture { + return (() => { + // Copy old file to options["profile-dir"] + var sourceFile = path.join(this.platformData.projectRoot, util.format("%s.xcodeproj", this.$projectData.projectName)); + var destinationFile = path.join(options.profileDir, "xcodeproj"); + //this.$fs.copyFile(sourceFile, destinationFile).wait(); + this.$logger.info("Backup file %s at location %s", sourceFile, destinationFile); + this.$fs.deleteDirectory(path.join(this.platformData.projectRoot, util.format("%s.xcodeproj", this.$projectData.projectName))).wait(); + + // Copy xcodeProject file + var cachedPackagePath = path.join(this.$npm.getCachedPackagePath(this.platformData.frameworkPackageName, newVersion), constants.PROJECT_FRAMEWORK_FOLDER_NAME, util.format("%s.xcodeproj", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER)); + shell.cp("-R", path.join(cachedPackagePath, "*"), path.join(this.platformData.projectRoot, util.format("%s.xcodeproj", this.$projectData.projectName))); + this.$logger.info("Copied from %s at %s.", cachedPackagePath, this.platformData.projectRoot); + + + var pbxprojFilePath = path.join(this.platformData.projectRoot, this.$projectData.projectName + IOSProjectService.XCODE_PROJECT_EXT_NAME, "project.pbxproj"); + this.replaceFileContent(pbxprojFilePath).wait(); + }).future()(); + } + + private buildPathToXcodeProjectFile(version: string): string { + return path.join(this.$npm.getCachedPackagePath(this.platformData.frameworkPackageName, version), constants.PROJECT_FRAMEWORK_FOLDER_NAME, util.format("%s.xcodeproj", IOSProjectService.IOS_PROJECT_NAME_PLACEHOLDER), "project.pbxproj"); + } private validateDynamicFramework(libraryPath: string): IFuture { return (() => { diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index fa915056cb..25e04f26d5 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -443,19 +443,28 @@ export class PlatformService implements IPlatformService { var currentVersion = data && data.version ? data.version : "0.2.0"; var newVersion = version || this.$npm.getLatestVersion(platformData.frameworkPackageName).wait(); - if(!semver.valid(newVersion)) { - this.$errors.fail("The version %s is not valid. The version should consists from 3 parts seperated by dot.", newVersion); - } + if(platformData.platformProjectService.canUpdatePlatform(currentVersion, newVersion).wait()) { - if(semver.gt(currentVersion, newVersion)) { // Downgrade - var isUpdateConfirmed = this.$prompter.confirm("You are going to update to lower version. Are you sure?", () => "n").wait(); - if(isUpdateConfirmed) { + if(!semver.valid(newVersion)) { + this.$errors.fail("The version %s is not valid. The version should consists from 3 parts separated by dot.", newVersion); + } + + if(semver.gt(currentVersion, newVersion)) { // Downgrade + var isUpdateConfirmed = this.$prompter.confirm("You are going to update to lower version. Are you sure?", () => "n").wait(); + if(isUpdateConfirmed) { + this.updatePlatformCore(platformData, currentVersion, newVersion).wait(); + } + } else if(semver.eq(currentVersion, newVersion)) { + this.$errors.fail("Current and new version are the same."); + } else { this.updatePlatformCore(platformData, currentVersion, newVersion).wait(); } - } else if(semver.eq(currentVersion, newVersion)) { - this.$errors.fail("Current and new version are the same."); } else { - this.updatePlatformCore(platformData, currentVersion, newVersion).wait(); + var isUpdateConfirmed = this.$prompter.confirm(util.format("We need to override xcodeproj file. The old one will be saved at %s Are you sure?", options.profileDir), () => "y").wait(); + if(isUpdateConfirmed) { + platformData.platformProjectService.updatePlatform(currentVersion, newVersion).wait(); + this.updatePlatformCore(platformData, currentVersion, newVersion).wait(); + } } }).future()(); @@ -480,7 +489,7 @@ export class PlatformService implements IPlatformService { // Add new framework files var newFrameworkData = this.getFrameworkFiles(platformData, newVersion).wait(); - var cacheDirectoryPath = this.getNpmCacheDirectoryCore(platformData.frameworkPackageName, newVersion); + var cacheDirectoryPath = this.$npm.getCachedPackagePath(platformData.frameworkPackageName, newVersion); _.each(newFrameworkData.frameworkFiles, file => { var sourceFile = path.join(cacheDirectoryPath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, file); @@ -507,36 +516,29 @@ export class PlatformService implements IPlatformService { private getFrameworkFiles(platformData: IPlatformData, version: string): IFuture { return (() => { - var npmCacheDirectoryPath = this.getNpmCacheDirectory(platformData.frameworkPackageName, version).wait(); + var cachedPackagePath = this.$npm.getCachedPackagePath(platformData.frameworkPackageName, version); + this.ensurePackageIsCached(cachedPackagePath, platformData.frameworkPackageName, version).wait(); - var allFiles = this.$fs.enumerateFilesInDirectorySync(npmCacheDirectoryPath); + var allFiles = this.$fs.enumerateFilesInDirectorySync(cachedPackagePath); var filteredFiles = _.filter(allFiles, file => _.contains(platformData.frameworkFilesExtensions, path.extname(file))); - var allFrameworkDirectories = _.map(this.$fs.readDirectory(path.join(npmCacheDirectoryPath, constants.PROJECT_FRAMEWORK_FOLDER_NAME)).wait(), dir => path.join(npmCacheDirectoryPath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, dir)); + var allFrameworkDirectories = _.map(this.$fs.readDirectory(path.join(cachedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME)).wait(), dir => path.join(cachedPackagePath, constants.PROJECT_FRAMEWORK_FOLDER_NAME, dir)); var filteredFrameworkDirectories = _.filter(allFrameworkDirectories, dir => this.$fs.getFsStats(dir).wait().isDirectory() && (_.contains(platformData.frameworkFilesExtensions, path.extname(dir)) || _.contains(platformData.frameworkDirectoriesNames, path.basename(dir)))); return { - frameworkFiles: this.mapFrameworkFiles(npmCacheDirectoryPath, filteredFiles), - frameworkDirectories: this.mapFrameworkFiles(npmCacheDirectoryPath, filteredFrameworkDirectories) + frameworkFiles: this.mapFrameworkFiles(cachedPackagePath, filteredFiles), + frameworkDirectories: this.mapFrameworkFiles(cachedPackagePath, filteredFrameworkDirectories) } }).future()(); } - private getNpmCacheDirectory(packageName: string, version: string): IFuture { + private ensurePackageIsCached(cachedPackagePath: string, packageName: string, version: string): IFuture { return (() => { - var npmCacheDirectoryPath = this.getNpmCacheDirectoryCore(packageName, version); - - if(!this.$fs.exists(npmCacheDirectoryPath).wait()) { + if(!this.$fs.exists(cachedPackagePath).wait()) { this.$npm.addToCache(packageName, version).wait(); } - - return npmCacheDirectoryPath; - }).future()(); - } - - private getNpmCacheDirectoryCore(packageName: string, version: string): string { - return path.join(this.$npm.getCacheRootPath(), packageName, version, "package"); + }).future()(); } private mapFrameworkFiles(npmCacheDirectoryPath: string, files: string[]): string[] { From 2ad0926bd2a5ad1ee241ed6b239b2ce4a0481c4f Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Fri, 13 Mar 2015 19:07:13 +0200 Subject: [PATCH 4/5] Fixes unit tests --- test/stubs.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/stubs.ts b/test/stubs.ts index 5f89cc9358..b074d51529 100644 --- a/test/stubs.ts +++ b/test/stubs.ts @@ -201,6 +201,10 @@ export class NPMStub implements INodePackageManager { getLatestVersion(packageName: string): IFuture { return Future.fromResult(""); } + + getCachedPackagePath(packageName: string, version: string): string { + return ""; + } } export class ProjectDataStub implements IProjectData { @@ -273,6 +277,12 @@ export class PlatformProjectServiceStub implements IPlatformProjectService { addLibrary(platformData: IPlatformData, libraryPath: string): IFuture { return Future.fromResult(); } + canUpdatePlatform(currentVersion: string, newVersion: string): IFuture { + return Future.fromResult(false); + } + updatePlatform(currentVersion: string, newVersion: string): IFuture { + return Future.fromResult(); + } } export class ProjectDataService implements IProjectDataService { From d8ae20aafd8a4e135fcf795e381200aa460427af Mon Sep 17 00:00:00 2001 From: Fatme Havaluova Date: Mon, 16 Mar 2015 11:48:53 +0200 Subject: [PATCH 5/5] PR comments --- lib/services/ios-project-service.ts | 3 ++- lib/services/platform-service.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index b4628774ca..cb769d366e 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -216,7 +216,8 @@ class IOSProjectService implements IPlatformProjectService { // Copy old file to options["profile-dir"] var sourceFile = path.join(this.platformData.projectRoot, util.format("%s.xcodeproj", this.$projectData.projectName)); var destinationFile = path.join(options.profileDir, "xcodeproj"); - //this.$fs.copyFile(sourceFile, destinationFile).wait(); + this.$fs.deleteDirectory(destinationFile).wait(); + shell.cp("-R", path.join(sourceFile, "*"), destinationFile); this.$logger.info("Backup file %s at location %s", sourceFile, destinationFile); this.$fs.deleteDirectory(path.join(this.platformData.projectRoot, util.format("%s.xcodeproj", this.$projectData.projectName))).wait(); diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 25e04f26d5..9969923be7 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -450,7 +450,7 @@ export class PlatformService implements IPlatformService { } if(semver.gt(currentVersion, newVersion)) { // Downgrade - var isUpdateConfirmed = this.$prompter.confirm("You are going to update to lower version. Are you sure?", () => "n").wait(); + var isUpdateConfirmed = this.$prompter.confirm(util.format("You are going to downgrade to android runtime v.%s. Are you sure?", newVersion), () => "n").wait(); if(isUpdateConfirmed) { this.updatePlatformCore(platformData, currentVersion, newVersion).wait(); } @@ -460,7 +460,7 @@ export class PlatformService implements IPlatformService { this.updatePlatformCore(platformData, currentVersion, newVersion).wait(); } } else { - var isUpdateConfirmed = this.$prompter.confirm(util.format("We need to override xcodeproj file. The old one will be saved at %s Are you sure?", options.profileDir), () => "y").wait(); + var isUpdateConfirmed = this.$prompter.confirm(util.format("We need to override xcodeproj file. The old one will be saved at %s. Are you sure?", options.profileDir), () => "y").wait(); if(isUpdateConfirmed) { platformData.platformProjectService.updatePlatform(currentVersion, newVersion).wait(); this.updatePlatformCore(platformData, currentVersion, newVersion).wait();