Comparing version 1.0.0-0.1.0 to 1.0.0-0.2.0
@@ -40,8 +40,7 @@ Synopsis | ||
$ cocoonjs create Baz | ||
$ cd Baz | ||
$ cocoonjs create cocoonjs_test | ||
$ cd cocoonjs_test | ||
$ cocoonjs platform add android | ||
$ cocoonjs plugin add com.ludei.webview.plus | ||
$ cocoonjs build | ||
$ cocoonjs serve android | ||
$ cocoonjs run | ||
@@ -48,0 +47,0 @@ Documentation |
{ | ||
"name": "cocoonjs", | ||
"version": "1.0.0-0.1.0", | ||
"version": "1.0.0-0.2.0", | ||
"preferGlobal": "true", | ||
@@ -5,0 +5,0 @@ "description": "CocoonJS command line tool", |
@@ -9,3 +9,3 @@ # CocoonJS Command Line tools # | ||
## Requirements ## | ||
Please refer to the [Cordova requirements](https://github.com/apache/cordova-cli#requirements) in order to set up the requirements. | ||
Please refer to [Cordova prerequisites](https://github.com/apache/cordova-cli#requirements) to set up your environment. | ||
@@ -38,12 +38,14 @@ After installing Cordova in your computer, execute the following command to install the CocoonJS CLI tools: | ||
### FAQ ### | ||
#### ¿Which version of cordova is required? #### | ||
The CocoonJS command line tool automatically detects the Cordova version that you've installed in your computer, however, if you use a different cordova version that you've installed locally, you can use the --cordova-path argument to tell the CocoonJS-CLI where is the cordova binary that is need to be used for the cordova commands, eg: | ||
#### Regarding cordova versions #### | ||
cordova-cli 3 and higher is required. | ||
The CocoonJS command line tool automatically detects the Cordova version installed in your computer. However, if you have multiple versions installed locally, you can explicitly point to a specific path using the --cordova-path argument to force that cordova binary to execute, eg: | ||
``` | ||
$ cocoonjs platform add android --cordova-path=/Users/Cocoon/cordova/cordova-3.5.0-0.2.4/ | ||
``` | ||
When using the *--cordova-path* the CocoonJS-CLI will find the cordova binary inside *cordova-3.5.0-0.2.4/bin/cordova* and will use it to spawn all the cordova based commands, you can use any cordova 3.x version. | ||
Using the *--cordova-path*, the CocoonJS-CLI will find the cordova binary inside *cordova-3.5.0-0.2.4/bin/cordova* and will use it to spawn all the cordova-based commands. You can use any cordova 3.x version. | ||
@@ -53,3 +55,3 @@ | ||
---- | ||
http://support.ludei.com | ||
http://support.ludei.com/hc/en-us/sections/200476168-CocoonJS-Command-Line-Interface | ||
@@ -70,2 +72,6 @@ License | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
limitations under the License. | ||
### About the author ### | ||
Ludei is a San Francisco based company, creators of CocoonJS. Ludei aims to empower HTML5 industry with a set of tools that eases the adoption of HTML5 as the target platform for every mobile development. |
@@ -115,11 +115,15 @@ var shell = require('shelljs'), | ||
var platforms = this.getPlatforms(); | ||
var isAndroidAvailable = platforms.filter(function(obj){ return obj.name === "android" }); | ||
var isAndroidAvailable = platforms.filter(function(platform_name){ return platform_name === "android" }); | ||
if( (isAndroidAvailable.length > 0) || (!this.WebViewPlusReq(plugin_path)) ){ | ||
util.log("The platform Android is not available in your project."); | ||
if( (isAndroidAvailable.length === 0) ){ | ||
util.errorLog("The platform Android is not available in your project."); | ||
process.exit(1); | ||
} | ||
if( !this.WebViewPlusReq(plugin_path) ){ | ||
process.exit(1); | ||
} | ||
if(!fs.existsSync(hook_path)){ | ||
util.log("Can't find uninstall hook."); | ||
util.errorLog("Can't find uninstall hook."); | ||
process.exit(1); | ||
@@ -130,5 +134,4 @@ } | ||
if( exec_result.code !== 0){ | ||
util.log("Error executing Webview+ hook", hook_path); | ||
util.log("Cannot uninstall manually the WebView+"); | ||
console.log(exec_result.output); | ||
util.errorLog("Error executing Webview+ hook", hook_path); | ||
console.error(exec_result.output); | ||
return false; | ||
@@ -139,4 +142,4 @@ }; | ||
if(plugin_result.code !== 0){ | ||
util.log("Cannot uninstall the Webview+"); | ||
util.log(plugin_result.output); | ||
util.errorLog("Cannot uninstall the Webview+, failed to execute the command `cocoonjs plugin rm " + plugin_id + "`."); | ||
util.errorLog(plugin_result.output); | ||
process.exit(plugin_result.code); | ||
@@ -149,5 +152,5 @@ }; | ||
}catch(e){ | ||
util.log("Cannot delete Webview+ hooks, please remove them manually:"); | ||
util.log(hook_path, hook_installation_path); | ||
console.log(e); | ||
util.errorLog("Cannot delete Webview+ hooks, please remove them manually:"); | ||
util.errorLog(hook_path, hook_installation_path); | ||
console.error(e); | ||
} | ||
@@ -166,6 +169,6 @@ | ||
var plugin_path = path.join(process.cwd(), "plugins", plugin_id, "android"); | ||
var isAndroidAvailable = platforms.filter(function(obj){ return obj.name === "android" }); | ||
var isAndroidAvailable = platforms.filter(function(platform_name){ return platform_name === "android" }); | ||
if( (isAndroidAvailable.length > 0)){ | ||
util.log("The platform Android is not available in your project. Please execute 'cocoonjs platform add android' before installing the Webview+"); | ||
if( (isAndroidAvailable.length === 0) ){ | ||
util.errorLog("The platform Android is not available in your project. Please execute 'cocoonjs platform add android' before installing the Webview+"); | ||
process.exit(1); | ||
@@ -175,3 +178,2 @@ } | ||
if( !this.WebViewPlusReq(plugin_path) ){ | ||
util.log("Invalid configuration needed to install the Weview+"); | ||
process.exit(1); | ||
@@ -186,4 +188,4 @@ } | ||
if(plugin_result.code !== 0) { | ||
util.log("Cannot install the WebView+ in your project"); | ||
console.log(plugin_result.output); | ||
util.errorLog("Cannot install the WebView+ in your project, failed to execute the command `cocoonjs plugin add " + plugin.bundle_id + "`. "); | ||
console.error(plugin_result.output); | ||
process.exit(plugin_result.code); | ||
@@ -196,3 +198,3 @@ } | ||
if(!fileExists(build_xml_path)) { | ||
util.log("Can't find a build.xml needed to build the WebView+ project"); | ||
util.errorLog("Can't find a build.xml needed to build the WebView+ project"); | ||
process.exit(1); | ||
@@ -203,3 +205,3 @@ } | ||
if( !installed_hooks ){ | ||
util.log("Cannot install needed hook in your project"); | ||
util.errorLog("Cannot install needed hook in your project"); | ||
process.exit(1); | ||
@@ -212,3 +214,3 @@ } | ||
if(release_result.code !== 0) { | ||
util.log("Cannot build Webview+ project"); | ||
util.errorLog("Cannot build Webview+ project"); | ||
this._cmd.exec("plugin rm " + plugin_id); | ||
@@ -227,3 +229,3 @@ process.exit(release_result.code); | ||
if(!hook_path){ | ||
util.log("Cannot find a valid Webview+ hook to be executed."); | ||
util.errorLog("Cannot find a valid Webview+ hook to be executed."); | ||
process.exit(1); | ||
@@ -234,6 +236,6 @@ } | ||
if( installation_result.code !== 0){ | ||
util.log("Error executing Webview+ hook", hook_path); | ||
util.log("here's the error info we have"); | ||
util.errorLog("Error executing Webview+ hook", hook_path); | ||
util.errorLog("here's the error info we have"); | ||
this._cmd.exec("plugin rm " + plugin_id); | ||
console.log(installation_result.output); | ||
console.error(installation_result.output); | ||
return false; | ||
@@ -240,0 +242,0 @@ }; |
@@ -21,2 +21,3 @@ var colors = require('colors'), | ||
utils.TAG = ("[" + ("CocoonJS") + "] ").cyan; | ||
utils.TAG_ERROR = ("[" + ("CocoonJS") + "] ").cyan; | ||
@@ -102,3 +103,11 @@ /** | ||
utils.errorLog = function(){ | ||
var args = Array.prototype.slice.call(arguments).join(" "); | ||
if(args.length > 0 && new RegExp(/\\n/).test(JSON.stringify(args[args.length - 1]))){ | ||
args = args.substring(0, args.length - 1); | ||
} | ||
console.error(utils.TAG_ERROR + (args.red)); | ||
}; | ||
module.exports = utils; | ||
})(); |
29257
608
74