Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3E27B18AAE for ; Wed, 10 Jun 2015 09:04:28 +0000 (UTC) Received: (qmail 42239 invoked by uid 500); 10 Jun 2015 09:04:28 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 42184 invoked by uid 500); 10 Jun 2015 09:04:27 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 42164 invoked by uid 99); 10 Jun 2015 09:04:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2015 09:04:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 92297DFBC8; Wed, 10 Jun 2015 09:04:27 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: an-selm@apache.org To: commits@cordova.apache.org Message-Id: <64dda7ffd3134d55bb7df473cd0958b3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cordova-lib git commit: CB-5578 Adds `clean` module to cordova. This closes #241 Date: Wed, 10 Jun 2015 09:04:27 +0000 (UTC) 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 Authored: Tue Jun 9 17:10:00 2015 +0300 Committer: Vladimir Kotikov 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