diff --git a/bin/crosswalk-app-deb b/bin/crosswalk-app-deb deleted file mode 100755 index f70455e..0000000 --- a/bin/crosswalk-app-deb +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env nodejs - -// Copyright © 2014 Intel Corporation. All rights reserved. -// Use of this source code is governed by an Apache v2 -// license that can be found in the LICENSE-APACHE-V2 file. - -var Shell = require ("shelljs"); -var Fs = require ('fs'); -var Path = require ('path'); -var DebProject = require('../lib/DebProject'); -var PlatformBase = require('../lib/PlatformBase'); - -function log(msg) { - if (typeof(msg) != 'undefined' && msg != null) - console.log(msg); -} - -function PlatformData(root_dir, packageId) { - var application = { - 'packageId': packageId, - 'output': console, - 'pkgPath': Path.join(root_dir, 'pkg'), - 'prjPath': Path.join(root_dir, 'prj'), - 'appPath': Path.join(root_dir, 'app') - }; - return { - 'platformId': 'deb', - 'application': application - }; -} - -if (process.argv.length < 3) { - console.log("crosswalk-app-deb [create|build] [projectId]"); - return; -} - -var cmd = process.argv[2]; -if (cmd) { - switch(cmd){ - case 'create': - if (process.argv.length < 4) { - console.log("Usage: crosswalk-app-deb create projectId"); - break; - } - var packageId = process.argv[3] - var Project = DebProject(PlatformBase, PlatformData(Path.join(Shell.pwd(), packageId), packageId), DebProject.getArgs); - Project.create(packageId, null, log); - break; - case 'build': - var packageId = Path.basename(Shell.pwd()); - var Project = DebProject(PlatformBase, PlatformData(Shell.pwd(), packageId)); - Project.build(null, null, log); - break; - default: - }; -} else { - console.log("Command error!"); -} diff --git a/lib/PlatformBase.js b/lib/PlatformBase.js deleted file mode 100644 index 056db5d..0000000 --- a/lib/PlatformBase.js +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright © 2014 Intel Corporation. All rights reserved. -// Use of this source code is governed by an Apache v2 -// license that can be found in the LICENSE-APACHE-V2 file. - -var Path = require("path"); -var ShellJS = require("shelljs"); - -/** - * Callback signature for {@link PlatformBase.generate}. - * @param {String} errormsg null on success, otherwise error message - * @inner - * @memberOf PlatformBase - */ -function platformBaseOperationCb(result) {} - -/** - * @typedef PlatformData - * @type {Object} - * @property {Application} application Application instance - * @property {String} platformId Name for backend (android, ios, ...) - * @memberOf PlatformBase - */ - -/** - * Interface for platform implementations. - * @constructor - * @param {PlatformData} platformData Init data passed to the platform - * @throws {Error} If instantiation failed. - * @protected - */ -function PlatformBase(platformData) { - - this._application = platformData.application; - - if (typeof platformData.platformId === "string" && platformData.platformId.length > 0) { - this._platformId = platformData.platformId; - } else { - throw new Error("PlatformBase() invalid platformData.platformId '" + platformData.platformId + "'"); - } -} - -/** - * Application instance. - * @member {Application} application - * @instance - * @memberOf PlatformBase - */ -Object.defineProperty(PlatformBase.prototype, "application", { - get: function() { - return this._application; - } - }); - -/** - * Absolute path to directory where the html application is located. - * @member {String} appPath - * @instance - * @memberOf PlatformBase - */ -Object.defineProperty(PlatformBase.prototype, "appPath", { - get: function() { - return this._application.appPath; - } - }); - -/** - * Read-only {@link TerminalOutput} object. - * @member {TerminalOutput} output - * @instance - * @memberOf PlatformBase - */ -Object.defineProperty(PlatformBase.prototype, "output", { - get: function() { - return this._application.output; - } - }); - -/** - * Application instance. - * @member {String} packageId - * @instance - * @memberOf PlatformBase - */ -Object.defineProperty(PlatformBase.prototype, "packageId", { - get: function() { - return this._application.packageId; - } - }); - -/** - * Absolute path to directory where the built packaged need to be placed. - * @member {String} pkgPath - * @instance - * @memberOf PlatformBase - */ -Object.defineProperty(PlatformBase.prototype, "pkgPath", { - get: function() { - return this._application.pkgPath; - } - }); - -/** - * Platform identifier (android, ios, ...). - * @member {String} platformId - * @instance - * @memberOf PlatformBase - */ -Object.defineProperty(PlatformBase.prototype, "platformId", { - get: function() { - return this._platformId; - } - }); - -/** - * Absolute path to directory where the platform-specific code is located (inside the project). - * @member {String} platformPath - * @instance - * @memberOf PlatformBase - */ -Object.defineProperty(PlatformBase.prototype, "platformPath", { - get: function() { - return Path.join(this._application.prjPath, this.platformId); - } - }); - -/** - * Absolute path to directory where the platform-specific project is located. - * @member {String} prjPath - * @instance - * @memberOf PlatformBase - */ -Object.defineProperty(PlatformBase.prototype, "prjPath", { - get: function() { - return this._application.prjPath; - } - }); - -/** - * Export a built package to the common packages folder. - * @param {String} packagePath Path where the built package is located - * @throws {InvalidPathException} If package file or package folder do not exist. - */ -PlatformBase.prototype.exportPackage = -function(packagePath) { - - if (!ShellJS.test("-f", packagePath)) { - throw new Error("Package could not be found " + packagePath); - } - - if (!ShellJS.test("-d", this.pkgPath)) { - throw new Error("Package could not be found " + this.pkgPath); - } - - ShellJS.mv('-f', packagePath, this.pkgPath); -}; - -/** - * Generate platform project template. - * @param {Object} options Extra options for the command - * @param {PlatformBase~platformBaseOperationCb} callback callback function - */ -PlatformBase.prototype.create = -function(PackageId, args, callback) { - - throw new Error("PlatformBase.create() not implemented."); -}; - -/** - * Update platform project to latest Crosswalk. - */ -PlatformBase.prototype.update = -function() { - - throw new Error("PlatformBase.update() not implemented."); -}; - -/** - * Refresh platform project after environment changes. - */ -PlatformBase.prototype.refresh = -function() { - - throw new Error("PlatformBase.refresh() not implemented."); -}; - -/** - * Build application package. - * @param {String[]} abi Array of ABIs, supported armeabi-v7a, x86 - * @param {Boolean} release Whether to build debug or release package - * @param {PlatformBase~platformBaseOperationCb} callback Callback function. - */ -PlatformBase.prototype.build = -function(abis, release, callback) { - - throw new Error("PlatformBase.build() not implemented."); -}; - -module.exports = PlatformBase; diff --git a/package.json b/package.json index 32ddac1..8955493 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,6 @@ "author": "Xinchao He ", "license": "APACHE-V2", "main": "index.js", - "bin": { - "crosswalk-app-ios": "./bin/crosswalk-app-deb" - }, "dependencies": { "shelljs": "~0.3.0" },