private void CreateNewVersionInCustomerPortal(DeployInfo deployment) { UpdateJob("Creating new version in Customer Portal"); var message = _customerPortalRepository.CreateNewVersion(_job.Company.CompanyKey, _job.Revision.Tag, _job.ServerUrl, deployment); UpdateJob(message); }
private DeployInfo Deploy(Company company, string ipaAdHocPath, string ipaAppStorePath, string apkPath, string apkPathCallBox, string apkBlackBerryPath, string barPath) { var result = new DeployInfo(); if (!_job.Android && !_job.CallBox && !_job.IosAdhoc && !_job.IosAppStore && !_job.BlackBerry) { return(result); } var targetDirWithoutFileName = Path.Combine( ConfigurationManager.AppSettings ["DeployDir"], company.CompanyKey, string.Format("{0}.{1}", _job.Revision.Tag, _job.Revision.Commit)); if (!Directory.Exists(targetDirWithoutFileName)) { Directory.CreateDirectory(targetDirWithoutFileName); } result.RootPath = targetDirWithoutFileName; if (_job.Android) { _logger.DebugFormat(String.Format("Copying Apk, {0}", apkPath)); var apkFile = GetAndroidFile(apkPath); if (apkFile != null) { var fileInfo = new FileInfo(apkFile); var targetDir = Path.Combine(targetDirWithoutFileName, fileInfo.Name); if (File.Exists(targetDir)) { File.Delete(targetDir); } File.Copy(apkFile, targetDir); result.AndroidApkFileName = fileInfo.Name; } else { throw new Exception(String.Format("Can't find the APK file in the release dir: {0}", apkPath)); } } if (_job.BlackBerry) { _logger.DebugFormat(String.Format("Copying BlackBerry Apk, {0} ", apkBlackBerryPath)); var apkBlackBerryFile = GetBlackBerryApkFile(apkBlackBerryPath); if (apkBlackBerryFile != null) { var fileInfo = new FileInfo(apkBlackBerryFile); var newName = fileInfo.Name.Replace(".apk", "_blackberry.apk"); var targetDir = Path.Combine(targetDirWithoutFileName, newName); if (File.Exists(targetDir)) { File.Delete(targetDir); } File.Copy(apkBlackBerryFile, targetDir); result.BlackBerryApkFileName = newName; } else { throw new Exception(String.Format("Can't find the APK BlackBerry file in the release dir: {0}", apkBlackBerryPath)); } var barFile = GetBlackBerryBarFile(barPath); if (barFile != null) { var fileInfo = new FileInfo(barFile); var targetDir = Path.Combine(targetDirWithoutFileName, fileInfo.Name); if (File.Exists(targetDir)) { File.Delete(targetDir); } File.Copy(barFile, targetDir); result.BlackBerryBarFileName = fileInfo.Name; } else { throw new Exception(String.Format("Can't find the BAR BlackBerry file in the release dir: {0}", barPath)); } } if (_job.CallBox) { _logger.DebugFormat(String.Format("Copying CallBox Apk, {0}", apkPathCallBox)); var apkFile = GetAndroidFile(apkPathCallBox); if (apkFile != null) { var fileInfo = new FileInfo(apkFile); var targetDir = Path.Combine(targetDirWithoutFileName, fileInfo.Name); if (File.Exists(targetDir)) { File.Delete(targetDir); } File.Copy(apkFile, targetDir); result.CallboxApkFileName = fileInfo.Name; } else { throw new Exception(String.Format("Can't find the CallBox APK file in the release dir: {0}", apkPathCallBox)); } } if (_job.IosAdhoc) { _logger.DebugFormat(String.Format("Uploading and copying IPA AdHoc, {0}", ipaAdHocPath)); var ipaFile = GetiOSFile(ipaAdHocPath); if (ipaFile != null) { UpdateJob("Found AdHoc IPA"); var fileInfo = new FileInfo(ipaFile); var targetDir = Path.Combine(targetDirWithoutFileName, fileInfo.Name); if (File.Exists(targetDir)) { File.Delete(targetDir); } File.Copy(ipaFile, targetDir); result.iOSAdhocFileName = fileInfo.Name; } else { throw new Exception(String.Format("Can't find the IPA file in the AdHoc dir: {0}", ipaAdHocPath)); } } if (_job.IosAppStore) { _logger.DebugFormat(String.Format("Uploading and copying IPA AppStore, {0}", ipaAppStorePath)); var ipaFile = GetiOSFile(ipaAppStorePath); if (ipaFile != null) { UpdateJob("Found AppStore IPA"); var fileInfo = new FileInfo(ipaFile); var newName = fileInfo.Name.Replace(".ipa", ".appstore.ipa"); var targetDir = Path.Combine(targetDirWithoutFileName, newName); if (File.Exists(targetDir)) { File.Delete(targetDir); } File.Copy(ipaFile, targetDir); result.iOSAppStoreFileName = newName; } else { throw new Exception(String.Format("Can't find the IPA file in the AppStore dir: {0}", ipaAppStorePath)); } } return(result); }