Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DDF7017FFC for ; Thu, 30 Oct 2014 14:04:08 +0000 (UTC) Received: (qmail 45205 invoked by uid 500); 30 Oct 2014 14:04:08 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 45173 invoked by uid 500); 30 Oct 2014 14:04:08 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 45156 invoked by uid 99); 30 Oct 2014 14:04:08 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Oct 2014 14:04:08 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D5BF9980748; Thu, 30 Oct 2014 14:04:07 +0000 (UTC) From: agrieve To: dev@cordova.apache.org Reply-To: dev@cordova.apache.org References: In-Reply-To: Subject: [GitHub] cordova-coho pull request: Cb-7904: Pull request for nightlys Content-Type: text/plain Message-Id: <20141030140407.D5BF9980748@tyr.zones.apache.org> Date: Thu, 30 Oct 2014 14:04:07 +0000 (UTC) Github user agrieve commented on a diff in the pull request: https://github.com/apache/cordova-coho/pull/58#discussion_r19605982 --- Diff: src/nightly.js --- @@ -0,0 +1,148 @@ +/* +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 executil = require('./executil'); +var optimist = require('optimist'); +var flagutil = require('./flagutil'); +var repoutil = require('./repoutil'); +var repoupdate = require('./repo-update'); +var retrieveSha = require('./retrieve-sha'); +var npmpublish = require('./npm-publish'); +var versionutil = require('./versionutil'); +var gitutil = require('./gitutil'); +var fs = require('fs'); +var path = require('path'); + +module.exports = function*(argv) { + var repos = flagutil.computeReposFromFlag('nightly'); + var cli = repoutil.getRepoById('cli'); + var cordovaLib = repoutil.getRepoById('lib'); + var opt = flagutil.registerHelpFlag(optimist); + + argv = opt + .usage('Publish CLI & LIB to NPM under nightly tag. \n' + + 'Cordova platform add uses latest commits to the platforms. \n' + + 'Usage: $0 nightly' + ) + .options('pretend', { + desc: 'Don\'t actually publish to npm, just print what would be run.', + type:'boolean' + }) + .argv; + + if(argv.h) { + optimist.showHelp(); + process.exit(1); + } + + //Update Repos + yield repoupdate.updateRepos(repos); + + //Remove any local changes for cli & lib + yield repoutil.forEachRepo([cordovaLib, cli], function*() { + gitutil.resetFromOrigin(); + }); + + //get SHAS from platforms + var SHAJSON = yield retrieveSha(repos); + + //save SHAJSON in cordova-cli repo + yield repoutil.forEachRepo([cli], function*() { + //need to get the path to cordova-cli using executil + var cordovaclidir = yield executil.execHelper(executil.ARGS('pwd'), true, true); + fs.writeFile((path.join(cordovaclidir, 'shas.json')), JSON.stringify(SHAJSON, null, 4), 'utf8', function(err) { + if (err) return console.log (err); + }); + + }); + + //Update platform references at cordova-lib/src/cordova/platformsConfig.json + var cordovalibdir; + yield repoutil.forEachRepo([cordovaLib], function*() { + //need to get the path to cordova-lib using executil + cordovalibdir = yield executil.execHelper(executil.ARGS('pwd'), true, true); + }); + + yield updatePlatformsFile(path.join(cordovalibdir, 'src/cordova/platformsConfig.json'), SHAJSON); + + + var currentDate = new Date(); + var nightlyVersion = '-nightly.' + currentDate.getFullYear() + '.' + + currentDate.getMonth() + '.' + currentDate.getDate(); + var cordovaLibVersion; + //update package.json version for cli + lib, update lib reference for cli + yield repoutil.forEachRepo([cordovaLib, cli], function*(repo) { + var dir = yield executil.execHelper(executil.ARGS('pwd'), true, true); + var packageJSON = require(dir+'/package.json'); + packageJSON.version = versionutil.removeDev(packageJSON.version) + nightlyVersion; + + if(repo.id === 'lib'){ + cordovaLibVersion = packageJSON.version; + } else { + packageJSON.dependencies['cordova-lib'] = cordovaLibVersion; + } + + fs.writeFile(dir+'/package.json', JSON.stringify(packageJSON, null, 4), 'utf8', function(err) { --- End diff -- writeFileSync --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org For additional commands, e-mail: dev-help@cordova.apache.org