[
https://issues.apache.org/jira/browse/CB-8239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14288632#comment-14288632
]
ASF GitHub Bot commented on CB-8239:
------------------------------------
Github user omefire commented on a diff in the pull request:
https://github.com/apache/cordova-lib/pull/148#discussion_r23428777
--- Diff: cordova-lib/src/cordova/platform.js ---
@@ -71,102 +72,98 @@ function add(hooksRunner, projectRoot, targets, opts) {
// The "platforms" dir is safe to delete, it's almost equivalent to
// cordova platform rm <list of all platforms>
- if ( !fs.existsSync(platformsDir)) {
+ if (!fs.existsSync(platformsDir)) {
shell.mkdir('-p', platformsDir);
}
return hooksRunner.fire('before_platform_add', opts)
- .then(function() {
- return promiseutil.Q_chainmap(targets, function(target) {
+ .then(function () {
+ return promiseutil.Q_chainmap(targets, function (target) {
// For each platform, download it and call its "create" script.
var parts = target.split('@');
var platform = parts[0];
var version = parts[1];
- return Q.when().then(function() {
+ return Q.when().then(function () {
if (!(platform in platforms)) {
- return getPlatformDetailsFromDir(target);
- } else {
+ // First, try handling 'platform' as a directory, if
it fails, try handling it as a git repository
+ return Q.fcall(function () {
+ return util.getPlatformDetailsFromDir(target);
+ }).fail(function (err) {
+ // Maybe it's a git repo
--- End diff --
No. The error message would be: 'Unable to add platform android. Make sure
to provide a valid version, an existing folder or an accessible git repository:
'. so, we don't need the check.
> Add support for git urls to 'cordova platform add'
> --------------------------------------------------
>
> Key: CB-8239
> URL: https://issues.apache.org/jira/browse/CB-8239
> Project: Apache Cordova
> Issue Type: New Feature
> Components: CLI, CordovaLib
> Reporter: Omar Mefire
>
> Allow the following scenarios:
> - users can issue 'cordova platform add
> https://github.com/apache/cordova-android.git' and the git repo will be
> cloned and used.
> - users can issue 'cordova platform add
> android@https://github.com/apache/cordova-android.git' and the git repo will
> be cloned and used.
> - users can issue 'cordova platform add android' and if their config.xml file
> contains: '<engine id='android'
> version='https://github.com/apache/cordova-android.git' />, then the git repo
> pointed to by config.xml will be cloned and used.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]