Skip to content

Commit 0035c3d

Browse files
Merge pull request #1107 from Icenium/vladimirov/merge-2.10
Merge release in master (for 2.10.0)
2 parents c1c268e + 8e402ee commit 0035c3d

12 files changed

+41
-32
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ The Telerik AppBuilder CLI lets you build, test, deploy, and publish cross-platf
2222
Installation
2323
===
2424

25-
Latest version: Telerik AppBuilder 2.9.3
26-
Release date: 2015, May 22
25+
Latest version: Telerik AppBuilder 2.10
26+
Release date: 2015, June 8
2727

28-
> Telerik AppBuilder 2.9.3 is a maintenance release. For a complete list of the updates available in Telerik AppBuilder 2.9.3, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v2-9-3" target="_blank">Telerik AppBuilder 2.9.3 Release Notes</a>.<br/>For a complete list of the features available in the earlier major release Telerik AppBuilder 2.9, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v2-9" target="_blank">Telerik AppBuilder 2.9 Release Notes</a>.
28+
> For a complete list of the improvements and updates available in Telerik AppBuilder 2.10, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v2-10" target="_blank">Telerik AppBuilder 2.10 Release Notes</a>.
2929
3030
### System Requirements
3131

@@ -326,10 +326,10 @@ $ appbuilder create --help
326326
Features
327327
===
328328

329-
Latest version: Telerik AppBuilder 2.9.3
330-
Release date: 2015, May 22
329+
Latest version: Telerik AppBuilder 2.10
330+
Release date: 2015, June 8
331331

332-
> Telerik AppBuilder 2.9.3 is a maintenance release. For a complete list of the updates available in Telerik AppBuilder 2.9.3, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v2-9-3" target="_blank">Telerik AppBuilder 2.9.3 Release Notes</a>.<br/>For a complete list of the features available in the earlier major release Telerik AppBuilder 2.9, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v2-9" target="_blank">Telerik AppBuilder 2.9 Release Notes</a>.
332+
> For a complete list of the improvements and updates available in Telerik AppBuilder 2.10, see <a href="http://docs.telerik.com/platform/appbuilder/release-notes/v2-10" target="_blank">Telerik AppBuilder 2.10 Release Notes</a>.
333333
334334
#### What you can do with this version of the Telerik AppBuilder CLI
335335

lib/commands/dev/prepackage.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ export class PrePackageCommand implements ICommand {
2626
this.$templatesService.downloadItemTemplates().wait();
2727
this.$logger.info("Downloading project schemas.");
2828
this.$jsonSchemaLoader.downloadSchemas().wait();
29-
this.$logger.info("Unpacking app resources.");
30-
this.$templatesService.unpackAppResources().wait();
3129
this.$logger.info("Downloading Cordova migration data.");
3230
this.$cordovaMigrationService.downloadMigrationData().wait();
3331
// Cordova files have to be downloaded after cordova migration data so we know which cordova versions we support
3432
this.$logger.info("Downloading cordova.js files.");
3533
this.$resourceDownloader.downloadCordovaJsFiles().wait();
3634
this.$logger.info("Downloading NativeScript migration data.")
3735
this.$nativeScriptMigrationService.downloadMigrationData().wait();
36+
this.$logger.info("Unpacking app resources.");
37+
this.$templatesService.unpackAppResources().wait();
3838
this.$serviceProxy.setShouldAuthenticate(true);
3939
}).future<void>()();
4040
}

lib/declarations.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,11 @@ interface IPackageDownloadViewModel {
310310
}
311311

312312
interface IResourceLoader {
313-
appResourcesDir: string;
314313
resolvePath(path: string): string;
315314
openFile(path: string): any;
316315
readJson(path: string): IFuture<any>;
317316
buildCordovaJsFilePath(version: string, platform: string): string;
317+
getPathToAppResources(framework: string): string;
318318
}
319319

320320
interface IResourceDownloader {

lib/project/cordova-project.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ export class CordovaProject extends frameworkProjectBaseLib.FrameworkProjectBase
141141
let platforms = this.$mobileHelper.platformNames;
142142
_.each(platforms, (platform: string) => this.ensureCordovaJs(platform, projectDir, frameworkVersion).wait());
143143

144-
let appResourcesDir = this.$resources.appResourcesDir;
144+
let appResourcesDir = this.$resources.getPathToAppResources(this.$projectConstants.TARGET_FRAMEWORK_IDENTIFIERS.Cordova);
145145
let appResourceFiles = this.$fs.enumerateFilesInDirectorySync(appResourcesDir);
146146
appResourceFiles.forEach((appResourceFile) => {
147147
let relativePath = path.relative(appResourcesDir, appResourceFile);
148-
let targetFilePath = path.join(projectDir, relativePath);
148+
let targetFilePath = path.join(projectDir, this.$projectConstants.APP_RESOURCES_DIR_NAME, relativePath);
149149
this.$logger.trace("Checking app resources: %s must match %s", appResourceFile, targetFilePath);
150150
if (!this.$fs.exists(targetFilePath).wait()) {
151151
this.printAssetUpdateMessage();

lib/project/nativescript-project.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,18 @@ export class NativeScriptProject extends frameworkProjectBaseLib.FrameworkProjec
105105

106106
public ensureAllPlatformAssets(projectDir: string, frameworkVersion: string): IFuture<void> {
107107
return (() => {
108-
let appResourcesDir = this.$resources.appResourcesDir;
108+
let appResourcesDir = this.$resources.getPathToAppResources(this.$projectConstants.TARGET_FRAMEWORK_IDENTIFIERS.NativeScript);
109109
let appResourceFiles = this.$fs.enumerateFilesInDirectorySync(appResourcesDir);
110110
// In 0.10.0 original template, App_Resources directory is not included in app directory.
111111
let appResourcesHolderDirectory = path.join(projectDir, this.$projectConstants.NATIVESCRIPT_APP_DIR_NAME);
112112
if(semver.eq(frameworkVersion, "0.9.0")
113-
|| (!this.$fs.exists(path.join(appResourcesHolderDirectory, this.$projectConstants.NATIVESCRIPT_APP_RESOURCES_DIR_NAME)).wait()
114-
&& this.$fs.exists(path.join(projectDir, this.$projectConstants.NATIVESCRIPT_APP_RESOURCES_DIR_NAME)).wait())) {
113+
|| (!this.$fs.exists(path.join(appResourcesHolderDirectory, this.$projectConstants.APP_RESOURCES_DIR_NAME)).wait()
114+
&& this.$fs.exists(path.join(projectDir, this.$projectConstants.APP_RESOURCES_DIR_NAME)).wait())) {
115115
appResourcesHolderDirectory = projectDir;
116116
}
117117
appResourceFiles.forEach((appResourceFile) => {
118118
let relativePath = path.relative(appResourcesDir, appResourceFile);
119-
let targetFilePath = path.join(appResourcesHolderDirectory, relativePath);
119+
let targetFilePath = path.join(appResourcesHolderDirectory,this.$projectConstants.APP_RESOURCES_DIR_NAME, relativePath);
120120
this.$logger.trace("Checking app resources: %s must match %s", appResourceFile, targetFilePath);
121121
if (!this.$fs.exists(targetFilePath).wait()) {
122122
this.printAssetUpdateMessage();

lib/project/project-constants.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class ProjectConstants implements Project.IProjectConstants {
1111
public CORDOVA_PLUGIN_VARIABLES_PROPERTY_NAME = "CordovaPluginVariables";
1212
public APPIDENTIFIER_PROPERTY_NAME = "AppIdentifier";
1313
public EXPERIMENTAL_TAG = "Experimental";
14-
public NATIVESCRIPT_APP_RESOURCES_DIR_NAME = "App_Resources";
14+
public APP_RESOURCES_DIR_NAME = "App_Resources";
1515
public NATIVESCRIPT_APP_DIR_NAME = "app";
1616

1717
public TARGET_FRAMEWORK_IDENTIFIERS = {

lib/project/project.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ declare module Project {
126126
TARGET_FRAMEWORK_IDENTIFIERS: ITargetFrameworkIdentifiers;
127127
APPIDENTIFIER_PROPERTY_NAME: string;
128128
EXPERIMENTAL_TAG: string;
129-
NATIVESCRIPT_APP_RESOURCES_DIR_NAME: string;
129+
APP_RESOURCES_DIR_NAME: string;
130130
NATIVESCRIPT_APP_DIR_NAME: string;
131131
}
132132

lib/resource-loader.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import helpers = require("./helpers");
66
import util = require("util");
77

88
export class ResourceLoader implements IResourceLoader {
9-
constructor(private $fs: IFileSystem) { }
9+
constructor(private $fs: IFileSystem,
10+
private $projectConstants: Project.IProjectConstants) { }
1011

1112
resolvePath(resourcePath: string): string {
1213
return path.join(__dirname, "../resources", resourcePath);
@@ -20,13 +21,13 @@ export class ResourceLoader implements IResourceLoader {
2021
return this.$fs.readJson(this.resolvePath(resourcePath));
2122
}
2223

23-
public get appResourcesDir(): string {
24-
return this.resolvePath("App_Resources");
25-
}
26-
2724
public buildCordovaJsFilePath(version: string, platform: string): string {
2825
return path.join(this.resolvePath("Cordova"), version, util.format("cordova.%s.js", platform).toLowerCase());
2926
}
27+
28+
public getPathToAppResources(framework: string) {
29+
return path.join(this.resolvePath(framework), this.$projectConstants.APP_RESOURCES_DIR_NAME);
30+
}
3031
}
3132
$injector.register("resources", ResourceLoader);
3233

lib/services/nativescript-migration-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ export class NativeScriptMigrationService implements IFrameworkMigrationService
8989

9090
let projectDir = this.$project.getProjectDir().wait();
9191
let tnsModulesProjectPath = path.join(projectDir, this.$projectConstants.NATIVESCRIPT_APP_DIR_NAME, "tns_modules");
92-
let appResourcesRequiredPath = path.join(projectDir, this.$projectConstants.NATIVESCRIPT_APP_DIR_NAME, this.$projectConstants.NATIVESCRIPT_APP_RESOURCES_DIR_NAME);
93-
let appResourcesObsoletePath = path.join(projectDir, this.$projectConstants.NATIVESCRIPT_APP_RESOURCES_DIR_NAME);
92+
let appResourcesRequiredPath = path.join(projectDir, this.$projectConstants.NATIVESCRIPT_APP_DIR_NAME, this.$projectConstants.APP_RESOURCES_DIR_NAME);
93+
let appResourcesObsoletePath = path.join(projectDir, this.$projectConstants.APP_RESOURCES_DIR_NAME);
9494
let backupName = `${tnsModulesProjectPath}.backup`;
9595
let shouldRollBackAppResources = false;
9696
// Check if current version is supported one. We cannot migrate ObsoleteVersions

lib/services/web-view-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class WebViewService implements IWebViewService {
6060
return (() => {
6161
if(!this.$pluginsService.isPluginInstalled(webView.pluginIdentifier)) {
6262
this.$options.default = true;
63-
this.$pluginsService.configurePlugin(webView.pluginIdentifier).wait();
63+
this.$pluginsService.addPlugin(webView.pluginIdentifier).wait();
6464
}
6565
}).future<void>()();
6666
}

lib/templates-service.ts

+14-6
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,27 @@ export class TemplatesService implements ITemplatesService {
7070

7171
public unpackAppResources(): IFuture<void> {
7272
return (() => {
73-
let appResourcesDir = this.$resources.appResourcesDir;
74-
this.$fs.deleteDirectory(appResourcesDir).wait();
75-
76-
let assetsZipFileName = path.join(this.projectTemplatesDir, "Telerik.Mobile.Cordova.Blank.zip");
73+
let cordovaAssetsZipFileName = path.join(this.projectTemplatesDir, "Telerik.Mobile.Cordova.Blank.zip");
74+
this.unpackAppResourcesCore(this.$resources.resolvePath("Cordova"), cordovaAssetsZipFileName).wait();
75+
let nsAssetsZipFileName = path.join(this.projectTemplatesDir, "Telerik.Mobile.NS.Blank.zip");
76+
this.unpackAppResourcesCore(this.$resources.resolvePath("NativeScript"), nsAssetsZipFileName).wait();
77+
}).future<void>()();
78+
}
79+
80+
private unpackAppResourcesCore(appResourcesDir: string, assetsZipFileName: string): IFuture<void> {
81+
return (() => {
7782
let unzipOps:IFuture<any>[] = [];
7883
let unzipStream = this.$fs.createReadStream(assetsZipFileName)
7984
.pipe(unzip.Parse())
8085
.on("entry", (entry: ZipEntry) => {
81-
if (entry.type !== "File" || !_.startsWith(entry.path.toLowerCase(), "app_resources/")) {
86+
let indexOfAppResources = entry.path.toLowerCase().indexOf("app_resources/")
87+
if (entry.type !== "File" || indexOfAppResources === -1) {
8288
entry.autodrain();
8389
return;
8490
}
85-
let assetTargetFileName = path.join(appResourcesDir, entry.path);
91+
92+
let entryPath = entry.path.substr(indexOfAppResources);
93+
let assetTargetFileName = path.join(appResourcesDir, entryPath);
8694
let mkdirFuture = this.$fs.createDirectory(path.dirname(assetTargetFileName));
8795
mkdirFuture.resolve((err) => {
8896
if (err) {

0 commit comments

Comments
 (0)