cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nikhi...@apache.org
Subject cordova-lib git commit: CB-9030: Modifies superspawn to support a "chmod" option. When truthy, attempts to set the target file mode to 755 before executing. Specifies this argument as truthy for common CLI operations (compile, run, and steps in plugman)
Date Mon, 18 May 2015 18:56:49 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 64a19456d -> a0f0bbbb7


CB-9030: Modifies superspawn to support a "chmod" option. When truthy,
attempts to set the target file mode to 755 before executing.  Specifies
this argument as truthy for common CLI operations (compile, run, and steps
in plugman).  Didn't add it for hooks runner since that particular mode is
in legacy support.


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/a0f0bbbb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/a0f0bbbb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/a0f0bbbb

Branch: refs/heads/master
Commit: a0f0bbbb7f4e7b9fa2587f0f386125e7c17d646d
Parents: 64a1945
Author: Rob Paveza <Rob.Paveza@microsoft.com>
Authored: Thu May 14 16:09:50 2015 -0700
Committer: Rob Paveza <Rob.Paveza@microsoft.com>
Committed: Thu May 14 16:09:50 2015 -0700

----------------------------------------------------------------------
 cordova-lib/src/cordova/compile.js    | 2 +-
 cordova-lib/src/cordova/emulate.js    | 2 +-
 cordova-lib/src/cordova/platform.js   | 8 ++++----
 cordova-lib/src/cordova/run.js        | 2 +-
 cordova-lib/src/cordova/superspawn.js | 4 ++++
 cordova-lib/src/cordova/targets.js    | 4 ++--
 cordova-lib/src/plugman/install.js    | 2 +-
 cordova-lib/src/plugman/uninstall.js  | 2 +-
 8 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0f0bbbb/cordova-lib/src/cordova/compile.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/compile.js b/cordova-lib/src/cordova/compile.js
index 616f262..3728b67 100644
--- a/cordova-lib/src/cordova/compile.js
+++ b/cordova-lib/src/cordova/compile.js
@@ -34,7 +34,7 @@ module.exports = function compile(options) {
     options.platforms.forEach(function(platform) {
         ret = ret.then(function() {
             var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'build');
-            return superspawn.spawn(cmd, options.options, { stdio: 'inherit', printCommand:
true });
+            return superspawn.spawn(cmd, options.options, { stdio: 'inherit', printCommand:
true, chmod: true });
         });
     });
     ret = ret.then(function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0f0bbbb/cordova-lib/src/cordova/emulate.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/emulate.js b/cordova-lib/src/cordova/emulate.js
index 20c2e7a..3b09545 100644
--- a/cordova-lib/src/cordova/emulate.js
+++ b/cordova-lib/src/cordova/emulate.js
@@ -39,7 +39,7 @@ module.exports = function emulate(options) {
             var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'run');
             var args = ['--emulator'].concat(options.options);
 
-            return superspawn.spawn(cmd, args, {stdio: 'inherit', printCommand: true});
+            return superspawn.spawn(cmd, args, {stdio: 'inherit', printCommand: true, chmod:
true});
         }));
     }).then(function() {
         return hooksRunner.fire('after_emulate', options);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0f0bbbb/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index fd49bd0..12af90b 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -149,7 +149,7 @@ function addHelper(cmd, hooksRunner, projectRoot, targets, opts) {
                     }
                 }).then(function(args) {
                     var bin = path.join(platDetails.libDir, 'bin', cmd == 'add' ? 'create'
: 'update');
-                    var copts = { stdio: 'inherit' };
+                    var copts = { stdio: 'inherit', chmod: true };
                     if ('spawnoutput' in opts) {
                         copts = { stdio: opts.spawnoutput };
                     }
@@ -368,7 +368,7 @@ function check(hooksRunner, projectRoot) {
                 d_cur = Q.defer();
             add(h, scratch, [p], {spawnoutput: {stdio: 'ignore'}})
             .then(function() {
-                superspawn.maybeSpawn(path.join(scratch, 'platforms', p, 'cordova', 'version'))
+                superspawn.maybeSpawn(path.join(scratch, 'platforms', p, 'cordova', 'version'),
[], { chmod: true })
                 .then(function(avail) {
                     if (!avail) {
                         /* Platform version script was silent, we can't work with this */
@@ -386,7 +386,7 @@ function check(hooksRunner, projectRoot) {
                 d_avail.resolve('install-failed');
             });
 
-            superspawn.maybeSpawn(path.join(projectRoot, 'platforms', p, 'cordova', 'version'))
+            superspawn.maybeSpawn(path.join(projectRoot, 'platforms', p, 'cordova', 'version'),
[], { chmod: true })
             .then(function(v) {
                 d_cur.resolve(v || '');
             }).catch(function () {
@@ -460,7 +460,7 @@ function list(hooksRunner, projectRoot) {
     .then(function() {
         // Acquire the version number of each platform we have installed, and output that
too.
         return Q.all(platforms_on_fs.map(function(p) {
-            return superspawn.maybeSpawn(path.join(projectRoot, 'platforms', p, 'cordova',
'version'))
+            return superspawn.maybeSpawn(path.join(projectRoot, 'platforms', p, 'cordova',
'version'), [], { chmod: true })
             .then(function(v) {
                 if (!v) return p;
                 return p + ' ' + v;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0f0bbbb/cordova-lib/src/cordova/run.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/run.js b/cordova-lib/src/cordova/run.js
index 50c9b4f..b5c1e27 100644
--- a/cordova-lib/src/cordova/run.js
+++ b/cordova-lib/src/cordova/run.js
@@ -38,7 +38,7 @@ module.exports = function run(options) {
         // Deploy in parallel (output gets intermixed though...)
         return Q.all(options.platforms.map(function(platform) {
             var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'run');
-            return superspawn.spawn(cmd, options.options, { printCommand: true, stdio: 'inherit'
});
+            return superspawn.spawn(cmd, options.options, { printCommand: true, stdio: 'inherit',
chmod: true });
         }));
     }).then(function() {
         return hooksRunner.fire('after_run', options);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0f0bbbb/cordova-lib/src/cordova/superspawn.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/superspawn.js b/cordova-lib/src/cordova/superspawn.js
index 500cd7c..92c16c4 100644
--- a/cordova-lib/src/cordova/superspawn.js
+++ b/cordova-lib/src/cordova/superspawn.js
@@ -61,6 +61,7 @@ function maybeQuote(a) {
 //          'inherit' means pipe the input & output. This is required for anything that
prompts.
 //   env: Map of extra environment variables.
 //   cwd: Working directory for the command.
+//   chmod: If truthy, will attempt to set the execute bit before executing on non-Windows
platforms.
 // Returns a promise that succeeds only for return code = 0.
 exports.spawn = function(cmd, args, opts) {
     args = args || [];
@@ -94,6 +95,9 @@ exports.spawn = function(cmd, args, opts) {
     if (opts.env) {
         spawnOpts.env = _.extend(_.extend({}, process.env), opts.env);
     }
+    if (opts.chmod && !iswin32) {
+        fs.chmodSync(cmd, '755');
+    }
 
     events.emit(opts.printCommand ? 'log' : 'verbose', 'Running command: ' + maybeQuote(cmd)
+ ' ' + args.map(maybeQuote).join(' '));
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0f0bbbb/cordova-lib/src/cordova/targets.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/targets.js b/cordova-lib/src/cordova/targets.js
index 49f0a84..ed0d40b 100644
--- a/cordova-lib/src/cordova/targets.js
+++ b/cordova-lib/src/cordova/targets.js
@@ -35,14 +35,14 @@ function displayDevices(projectRoot, platform, options) {
     var caller = { 'script': 'list-devices' };
     events.emit('log', 'Available ' + platform + ' devices:');
     var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'lib', 'list-devices');
-    return superspawn.spawn(cmd, options, { stdio: 'inherit' }).catch(handleError.bind(caller));
+    return superspawn.spawn(cmd, options, { stdio: 'inherit', chmod: true }).catch(handleError.bind(caller));
 }
 
 function displayVirtualDevices(projectRoot, platform, options) {
     var caller = { 'script': 'list-emulator-images' };
     events.emit('log', 'Available ' + platform + ' virtual devices:');
     var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'lib', 'list-emulator-images');
-    return superspawn.spawn(cmd, options, { stdio: 'inherit' }).catch(handleError.bind(caller));
+    return superspawn.spawn(cmd, options, { stdio: 'inherit', chmod: true }).catch(handleError.bind(caller));
 }
 
 module.exports = function targets(options) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0f0bbbb/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js b/cordova-lib/src/plugman/install.js
index 169a5d3..80ee2d8 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -288,7 +288,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir,
opt
         if (options.platformVersion) {
             return Q(options.platformVersion);
         }
-        return Q(superspawn.maybeSpawn(path.join(project_dir, 'cordova', 'version')));
+        return Q(superspawn.maybeSpawn(path.join(project_dir, 'cordova', 'version'), [],
{ chmod: true }));
     }).then(function(platformVersion) {
         options.platformVersion = platformVersion;
         return callEngineScripts(theEngines);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/a0f0bbbb/cordova-lib/src/plugman/uninstall.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/uninstall.js b/cordova-lib/src/plugman/uninstall.js
index ea8b087..9fdc2e4 100644
--- a/cordova-lib/src/plugman/uninstall.js
+++ b/cordova-lib/src/plugman/uninstall.js
@@ -88,7 +88,7 @@ module.exports.uninstallPlatform = function(platform, project_dir, id, plugins_d
         if (options.platformVersion) {
             return Q(options.platformVersion);
         }
-        return Q(superspawn.maybeSpawn(path.join(project_dir, 'cordova', 'version')));
+        return Q(superspawn.maybeSpawn(path.join(project_dir, 'cordova', 'version'), [],
{ chmod: true }));
     }).then(function(platformVersion) {
         options.platformVersion = platformVersion;
         return runUninstallPlatform(current_stack, platform, project_dir, plugin_dir, plugins_dir,
options);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message