我刚刚第一次安装Phonegap,浏览了一下文档。让我困惑的是,一些文档使用命令“phonegap”和一些“cordova”。

Android平台指南:

$ cordova create hello com.example.hello "HelloWorld"

命令行接口指南告诉:

$ phonegap create hello com.example.hello HelloWorld

这两个命令之间是否存在差异(导致不同的文件和文件夹结构),或者它们只是同一事物的别名?


当前回答

上面,Abhishek提到了两个url中指定的命令行差异:

PhoneGap: http://docs.phonegap.com/en/edge/guide_cli_index.md.html 科尔多瓦: http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface

需要指出的一件事是,在这篇文章中,phonegap看起来几乎和cordova一样,并且可能不是命令行选项差异的准确图像。因此,我将两者都安装到我的系统中,以便查看它们之间的区别。

这些只是其中的一部分。希望有一天他们能更加同步。如果有人有更好的消息,请告诉我。

Adding platforms seems to be done differently between the two commands ( phonegap uses "install" command, cordova uses "platform add" command ) Adding/creating projects seems to be the same between the two commands ( same command line options supported ) Obviously, as has been stated, phonegap can use PhoneGap Build, so it has the corresponding options to trigger that or local builds Quite a few other significant command line differences, simply by running "cordova help" and "phonegap help" and comparing the two.

我想我的观点是,phonegap CLI文档经常提到的并不是针对phonegap CLI,而是针对cordova CLI。如果我遗漏了什么,请告诉我。谢谢。

其他回答

This first choice might be a confusing one but it’s really very simple. PhoneGap is a product owned by Adobe which currently includes additional build services, and it may or may not eventually offer additional services and/or charge payments for use in the future. Cordova is owned and maintained by Apache, and will always be maintained as an open source project. Currently they both have a very similar API. I would recommend going with Cordova, unless you require the additional PhoneGap build services.

http://phonegap.com/blog/2012/03/19/phonegap-cordova-and-whate28099s-in-a-name/

我想这个网址说明了你需要什么。 Phonegap是建立在Apache Cordova上的。你可以把Apache Cordova看作是PhoneGap的引擎。随着时间的推移,PhoneGap发行版可能包含额外的工具,这就是为什么它们在命令上有所不同,但它们做的是同样的事情。

编辑:额外的信息添加为它的命令差异,phonegap可以做什么,而apache cordova不能,反之亦然

PhoneGap的第一个命令行选项

http://docs.phonegap.com/en/edge/guide_cli_index.md.html

Apache Cordova选项 http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html#The%20Command-line%20Interface

As almost most of commands are similar. There are few differences (Note: No difference in Codebase) Adobe can add additional features to PhoneGap so that will not be in Cordova ,Eg: Building applications remotely for that you need to have account on https://build.phonegap.com Though For local builds phonegap cli uses cordova cli (Link to check: https://github.com/phonegap/phonegap-cli/blob/master/lib/phonegap/util/platform.js) Platform Environment Names. Mapping: 'local' => cordova-cli 'remote' => PhoneGap/Build

也来自以下存储库: 需要cordova的模块有:

build
create
install
local install
local plugin add , list , remove
run
mode
platform update
run

不包括科尔多瓦:

remote build
remote install
remote login,logout
remote run
serve

我还注意到cordova有一个Phonegap没有的“服务”命令。这个命令在端口8000上启动一个本地服务器。这对于在Chrome中运行应用程序和使用Ripple模拟器非常方便。

我发现这种差异迫使我在构建应用时混合使用phonegap和cordova cli命令:

“phonegap plugin add”不能正确处理命令行参数,而“cordova platform add”工作完美无缺

我使用的命令是:

'cordova plugin add https://github.com/crittercism/PhoneGap.git --variable IOS_APP_ID="[my_license_key]"

注意我使用的是phonegap 3.5

以下是我发现的不同之处:

我将phonegap 3.3.0-0.18.0 CLI与cordova 3.3.0文档中描述的该CLI的功能进行比较。

“ls”是“cordova plugin”的选项,但不是“phonegap plugin”的选项。你必须用“list”代替。 例如:“phonegap插件列表” "serve"在"phonegap -help"中没有记录,但它确实存在,而且它确实有效。它不会找到和加载phonegap.js,所以页面永远不会完全加载,但它仍然提供了一些价值。我不确定这和科多瓦的行为是否不同。 “phonegap平台添加”在phonegap中不工作。您必须执行“phonegap构建”以添加对平台的支持。

注意,在phonegap中,建议的解决方案是使用cordova命令,您可能还会遇到一些令人困惑的错误消息。