On Thu, Mar 6, 2014 at 11:16 AM, Jonathan Bond-Caron <
jbo...@gdesolutions.com> wrote:

> On Wed Mar 5 04:13 PM, Michal Mocny wrote:
> > For cli workflow: hooks (including plugin hooks) can access config.xml
> > <preference>'s for things like the sqllite compile example (recompile
> only if
> > settings changed would be nice), and access <preference> at runtime for
> the
> > console example.
> >
> > For old workflow, perhaps sqllite is documented to manually run the hook
> to
> > recompile whenever you want to change the default setting?
> >
> > Just thinking about alternatives and/or solutions that are actually
> feasible short
> > term.
> >
>
> Ya it could work, maybe something like:
> <preference name="cordova-plugin-console@install" value="--prefer-console
> true" /> (passed to an install script)
>

Thats not what I am suggesting.  I am suggesting:

 <preference name="cordova-plugin-console-some-setting" value="true" />

CLI and Plugman remain oblivious.

Inside hooks, you use regular file access to open config.xml, parse it, and
use that value.  We could provide a node lib to assist with this (finding
the location of config.xml and parsing the file are tasks that we wouldn't
want to have to re-invent).

The point merely being, you can configure what hooks do without changing
our tools.  I think we should prefer to make plugman do as little as
possible (lest it turn into coho ;).


> Keep in mind 'install' options/config (only used once during the install
> process) aren't the same as 'runtime' options/config (dynamic, changed by
> user)
>
> <preference name="cordova-plugin-console:use-console" value="true" />
> (runtime options?)
> <preference name="cordova-plugin-console:color" value="pink" />
>
> Some high level code at how the install script could work:
>
> https://github.com/jbondc/cordova-labs/blob/master/cordova-plugin-echo/plugin.xml#L14
>
> https://github.com/jbondc/cordova-labs/blob/master/cordova-plugin-echo/src/preinstall.js
>
> Not sure if we need a 'postinstall' script, instead in the preinstall.js
> could do something like:
> project.onPostInstall('plugin.name', function(hookApi){
>
>  // do something else..
>
> });
>
> Many ways it could work, this is more pursuing the sandbox idea.
>
>

Reply via email to