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 CD7D211442 for ; Thu, 24 Apr 2014 23:23:05 +0000 (UTC) Received: (qmail 74739 invoked by uid 500); 24 Apr 2014 23:22:23 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 74698 invoked by uid 500); 24 Apr 2014 23:22:21 -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 74662 invoked by uid 99); 24 Apr 2014 23:22:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2014 23:22:18 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gorkem.ercan@gmail.com designates 209.85.160.175 as permitted sender) Received: from [209.85.160.175] (HELO mail-yk0-f175.google.com) (209.85.160.175) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Apr 2014 23:22:14 +0000 Received: by mail-yk0-f175.google.com with SMTP id 131so2701933ykp.34 for ; Thu, 24 Apr 2014 16:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=sHiMDcRHQ6pkMEML2yWEH7M3M79GlpurP7NR6cWN5OI=; b=aoPMNjlmDZ5FffTjyz9GwhQ0TiV10PQkaZNauoOem4DNPp/b7bLpyoWJWZmBw19VPB 1gHh20mJyZPcqBJN7OeMORHTwA9X3nd+BYVt7xefetQB7OAZA2gBYdwhs+UF4EIubyCw jAuRw1OTei9kGyGHIMBQPnMSTuS//p9JGvhvD/tCOjw6sqlHlxIS4sVCrUnI+lRARLIH 2U0P7maMPIV/At7B03+d3cnP/24xjyyT4caO6CrAAwChcYNfgj/odfKEwuITo6IrsEYX g7d6fXRI9w6SfiLszZHxUFWopMbXbein0TyGAAaY2IWSOpBey6I/waH4pY5JRjRrfouc lzmA== MIME-Version: 1.0 X-Received: by 10.236.134.140 with SMTP id s12mr6698447yhi.138.1398381711114; Thu, 24 Apr 2014 16:21:51 -0700 (PDT) Received: by 10.170.85.66 with HTTP; Thu, 24 Apr 2014 16:21:51 -0700 (PDT) In-Reply-To: References: <20140417214643.E0C2B9923CF@tyr.zones.apache.org> Date: Thu, 24 Apr 2014 19:21:51 -0400 Message-ID: Subject: Re: [GitHub] cordova-cli pull request: CB-6469 - Restore plugins from config.xm... From: Gorkem Ercan To: "dev@cordova.apache.org" Content-Type: multipart/alternative; boundary=20cf303a36dd26c75b04f7d21ddc X-Virus-Checked: Checked by ClamAV on apache.org --20cf303a36dd26c75b04f7d21ddc Content-Type: text/plain; charset=UTF-8 I guess this is essentially moving save command as a flag to cordova plugin * commands and restore becomes harder to discover. We need to consider the platforms too since next stop is implementing "cordova save/restore platforms" -- Gorkem On Thu, Apr 24, 2014 at 5:05 PM, Michal Mocny wrote: > Gorkem, > > I also found an old JIRA duplicate issue for this which had listed an old > suggestion I think is interesting: > https://issues.apache.org/jira/browse/CB-4624 > > Specifically, instead of introducing save/restore commands, we could mirror > "npm install" and its use of "--save": > - npm install -> cordova plugin add > - restores deps > - npm install foo -> cordova plugin add foo > - install foo, but don't add it to deps > - npm install foo --save -> cordova plugin add foo --save > - install foo, and do add it to deps > - npm install --save -> cordova plugin add --save > - don't install anything, just save the current installed plugins into > deps > > Just something to consider. > > (note, just tried it again and npm install --save doesn't actually do what > I want.. wonder if its supported..) > > -Michal > > > On Wed, Apr 23, 2014 at 11:39 PM, Michal Mocny > wrote: > > > Gorkem, as an orthogonal issue to the syntax we use, I think there is > > another small problem with this patch as-is. > > > > "cordova plugin add org.apache.cordova.file-transfer && cordova plugin > > save" would have my application explicitly depend on > > org.apache.cordova.file. If in the future the dependency is > > removed/moved/renamed, my app would explicitly try to install it when > > running "cordova plugin restore". > > > > As a first version I think this is acceptable, but I think we may want a > > better solution eventually. > > > > > > On Tue, Apr 22, 2014 at 1:18 PM, Michal Mocny > wrote: > > > >> > >> > >> > >> On Tue, Apr 22, 2014 at 11:37 AM, Gorkem Ercan >wrote: > >> > >>> On Fri, Apr 18, 2014 at 7:21 PM, Michal Mocny > >>> wrote: > >>> > >>> > On Fri, Apr 18, 2014 at 4:11 PM, Gorkem Ercan < > gorkem.ercan@gmail.com > >>> > >wrote: > >>> > > >>> > > On Thu, Apr 17, 2014 at 3:46 PM, Michal Mocny > > >>> > wrote: > >>> > > > >>> > > > Took a quick glance. General questions: > >>> > > > - why the need for save? Why not just alter the list on each > >>> cordova > >>> > > > plugin add/rm? > >>> > > > > >>> > > > >>> > > I do not want to force this workflow. Calling save does not bring > >>> much > >>> > > overhead, considering plugin list does not probably change > >>> constantly. > >>> > > > >>> > > >>> > If you are going to make this choice, then I would not like to > >>> > automatically install on prepare. There should be an explicit "load" > >>> > command. (those names are wrong, but you get the point). > >>> > > >>> > Either we automatically manage plugin installs, or explicitly manage > >>> them. > >>> > I'm happy to start with explicit and support opt-in to automatic > >>> handling > >>> > later once we have confidence in the feature. > >>> > > >>> > >>> Makes sense... adding a 'restore' command and removing from prepare. We > >>> can > >>> add an auto-restore config in the next iteration. > >>> > >> > >> Excellent, thanks. > >> > >> > >>> > >>> > >>> > > >>> > > >>> > > > >>> > > > >>> > > > - wouldn't "cordova plugin rm foo && cordova prepare" re-install > >>> that > >>> > > > plugin right now? > >>> > > > > >>> > > > >>> > > This workflow would require an explicit update to config.xml if a > >>> plugin > >>> > is > >>> > > persisted in there. This is a good point, I shall update plugins rm > >>> to > >>> > > print a warning about it. > >>> > > >>> > > >>> > > > >>> > > > - why the name and not ? I think this > >>> > > functionality > >>> > > > should overlap with the plugin.xml spec. > >>> > > > > >>> > > > > >>> > > feature tag lives in the w3c widget spec which has advantages for > >>> those > >>> > > (like myself) who does provide tools for editing config,xml. > >>> > > > >>> > > >>> > We are no longer using that spec, and I as we move more functionality > >>> from > >>> > plugins.xml into config.xml we should strive to keep them in line. > It > >>> also > >>> > makes our docs easier. > >>> > > >>> > > >>> Tools developers are people too :) I think plugin.xml and config.xml > has > >>> two different audiences, I think there is a comparatively small > >>> intersection of developers who are interested on both. At the moment, > we > >>> are pretty much within the w3c spec with the top-level config.xml and I > >>> do > >>> not see the benefit of breaking it. > >>> > >> > >> Actually, I am thinking about tools devs. Namely, our tools devs who > >> should be using the same config parsing and handlers for dependency > >> management, etc. > >> > >> Anyway. You are putting in the sweat and blood on this feature, so you > >> get double the voting power on this as far as I'm concerned. Still, I > >> think we should bring this to the attention of the list to see how > everyone > >> feels. Sound fair? I'll start a quick thread. > >> > >> > >>> > >>> > >>> > > >>> > > > >>> > > > >>> > > > >>> > > > I haven't put the PR through testing yet. > >>> > > > > >>> > > > > >>> > > > On Thu, Apr 17, 2014 at 5:54 PM, Jesse > >>> > wrote: > >>> > > > > >>> > > > > Yeah, that looks weird. > >>> > > > > > >>> > > > > @purplecabbage > >>> > > > > risingj.com > >>> > > > > > >>> > > > > > >>> > > > > On Thu, Apr 17, 2014 at 2:46 PM, kamrik > >>> wrote: > >>> > > > > > >>> > > > > > Github user kamrik commented on a diff in the pull request: > >>> > > > > > > >>> > > > > > > >>> > > > > >>> https://github.com/apache/cordova-cli/pull/165#discussion_r11755812 > >>> > > > > > > >>> > > > > > --- Diff: src/save.js --- > >>> > > > > > @@ -0,0 +1,71 @@ > >>> > > > > > +/** > >>> > > > > > + 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 cordova_util = require('./util'), > >>> > > > > > + ConfigParser = require('./ConfigParser'), > >>> > > > > > + path = require('path'), > >>> > > > > > + xml =require('./xml-helpers') > >>> > > > > > + Q = require('q'), > >>> > > > > > + events = require('./events'); > >>> > > > > > + > >>> > > > > > +; > >>> > > > > > + > >>> > > > > > + > >>> > > > > > +module.exports = function save(target){ > >>> > > > > > + var projectHome = cordova_util.cdProjectRoot(); > >>> > > > > > + var configPath = > >>> cordova_util.projectConfig(projectHome); > >>> > > > > > + var configXml = new ConfigParser(configPath); > >>> > > > > > + var pluginsPath = path.join(projectHome, 'plugins'); > >>> > > > > > + var plugins = cordova_util.findPlugins(pluginsPath); > >>> > > > > > + > >>> > > > > > + return Q.all(plugins.map(function(plugin){ > >>> > > > > > + var currentPluginPath = > path.join(pluginsPath,plugin); > >>> > > > > > + var name = readPluginName(currentPluginPath); > >>> > > > > > + var id = plugin; > >>> > > > > > + var version = readPluginVersion(currentPluginPath); > >>> > > > > > + var features = configXml.doc.findall('feature'); > >>> > > > > > + for(var i=0; i >>> > > > > > + if(features[i].attrib.name === name){ > >>> > > > > > + events.emit('results', 'An entry for "'+ > >>> plugin+ '" > >>> > > > > already > >>> > > > > > exists'); > >>> > > > > > + return Q(); > >>> > > > > > + } > >>> > > > > > + } > >>> > > > > > + configXml.addFeature(name, > JSON.parse('[{"name":"id", > >>> > > > > > "value":"'+id+'"},{"name":"version", > >>> "value":"'+version+'"}]')); > >>> > > > > > --- End diff -- > >>> > > > > > > >>> > > > > > I might be missing something, but why JSON.parse() rather > >>> than > >>> > > just > >>> > > > > > literal array of objects? > >>> > > > > > > >>> > > > > > > >>> > > > > > --- > >>> > > > > > 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. > >>> > > > > > --- > >>> > > > > > > >>> > > > > > >>> > > > > >>> > > > >>> > > >>> > >> > >> > > > --20cf303a36dd26c75b04f7d21ddc--