cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject cordova-lib git commit: CB-5578 Adds `clean` module to cordova. This closes #241
Date Wed, 10 Jun 2015 09:04:27 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master b5068a943 -> 09a62c32e


CB-5578 Adds `clean` module to cordova. This closes #241


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

Branch: refs/heads/master
Commit: 09a62c32e9cb4499416d5db2bdc0982c49805622
Parents: b5068a9
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Tue Jun 9 17:10:00 2015 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Wed Jun 10 12:04:04 2015 +0300

----------------------------------------------------------------------
 cordova-lib/src/cordova/clean.js   | 48 +++++++++++++++++++++++++++++++++
 cordova-lib/src/cordova/cordova.js |  3 +--
 2 files changed, 49 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/09a62c32/cordova-lib/src/cordova/clean.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/clean.js b/cordova-lib/src/cordova/clean.js
new file mode 100644
index 0000000..8814ff6
--- /dev/null
+++ b/cordova-lib/src/cordova/clean.js
@@ -0,0 +1,48 @@
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+var path              = require('path'),
+    cordova_util      = require('./util'),
+    HooksRunner       = require('../hooks/HooksRunner'),
+    events            = require('../events'),
+    chain             = require('../util/promise-util').Q_chainmap,
+    superspawn        = require('./superspawn');
+
+// Returns a promise.
+module.exports = function clean(options) {
+    var projectRoot = cordova_util.cdProjectRoot();
+    options = cordova_util.preProcessOptions(options);
+
+    var hooksRunner = new HooksRunner(projectRoot);
+    return hooksRunner.fire('before_clean', options)
+    .then(function () {
+        return chain(options.platforms, function (platform) {
+            events.emit('verbose', 'Running cleanup for ' + platform + ' platform.');
+            var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'clean');
+            return superspawn.spawn(cmd, options.options, {
+                stdio: options.silent ? 'ignore' : 'inherit', // hide script output in silent
mode
+                printCommand: !!options.verbose,              // print command only if --verbose
specified
+                chmod: true
+            });
+        });
+    })
+    .then(function() {
+        return hooksRunner.fire('after_clean', options);
+    });
+};

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/09a62c32/cordova-lib/src/cordova/cordova.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/cordova.js b/cordova-lib/src/cordova/cordova.js
index dd71b39..e792d52 100644
--- a/cordova-lib/src/cordova/cordova.js
+++ b/cordova-lib/src/cordova/cordova.js
@@ -70,5 +70,4 @@ addModuleProperty(module, 'info', './info', true);
 addModuleProperty(module, 'targets', './targets', true);
 addModuleProperty(module, 'requirements', './requirements', true);
 addModuleProperty(module, 'projectMetadata', './project_metadata', true);
-
-
+addModuleProperty(module, 'clean', './clean', true);


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


Mime
View raw message