Differences between revisions 7 and 8
Revision 7 as of 2013-08-19 23:10:03
Size: 3842
Editor: timkim
Comment:
Revision 8 as of 2017-03-13 23:17:48
Size: 0
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Plugin Registry =

We use [[https://github.com/isaacs/npmjs.org|npmjs.org]]. Make sure to set '''''secure_rewrites''''' to false in your CouchDB config (You can use ''futon'' for that).

== Install Locally ==

 1. Install couchdb:
  * http://wiki.apache.org/couchdb/Installation
  * Follow instructions in the link above for your platform.

 2. Start up couchdb:
  * '''''sudo couchdb'''''
  * Should launch on http://127.0.0.1:5984/ by default

 3. Set up admin on couchdb: http://guide.couchdb.org/draft/security.html

 4. Check out Futon panel for couchdb: http://127.0.0.1:5984/_utils/

 5. Sign in as admin:
  * Click on the 'Login' link in the bottom right (kinda hard to find) and use credentials set in step 3

 6. Turn secure_rewrites to false:
  * Go to Tools/Configuration
  * Search for secure_rewrites under the section httpd
  * Make sure secure_rewrites is set to false

 7. install couchapp
  * sudo npm install couchapp -g

 8. Clone npmjs.org: https://github.com/imhotep/npmjs.org
  * Follow the "Installing" part of the readme, but don't synch from the npm registry.

 9. Replicate from cordova registry
  * Haven't actually gotten this step to work atm - getting weird error:
  * ''''' curl -X POST -H "Content-Type:application/json" http://127.0.0.1:5984/_replicate -d '{"source":"http://registry.cordova.io/", "target":"registry"}' '''''
  * Or use Futon panel: Click on Tools/Replicator and use UI

 10. Launch the registry locally:
  * ''''' cd npmjs.org '''''
  * ''''' couchapp serve registry/app.js http://127.0.0.1:5984/registry -d www/attachments/ '''''

 11. Use plugin-registry to interact with registry locally: https://github.com/imhotep/plugman-registry
  * See https://github.com/imhotep/plugman-registry/blob/master/index.js variable local_registry to make sure it's pointing in the right place

= plugin.xml tags =

To publish a Cordova plugin. One has to specify a couple of things. As per npm, '''''id''''' and '''''version''''' ''<plugin>'' attributes are required. Everything else is optional. <name> is a human readable name and does not have to follow npm's rules (no spaces).

There are new XML tags that are pretty self explanatory: ''<author>'', ''<description>'', ''<license>'', ''<keywords>'' (comma separated keywords). They help with search and discovery.

= plugman =

Plugman creates a package.json based on Cordova's plugin.xml which is required by npm. It stores its configuration, log file and cache in a folder named ''.plugman'' in the user's directory so that it doesn't interfere with npm's own configuration. It implements and maps the following actions:

 * '''adduser''': adds a user to the registry
 * '''publish''': creates a package.json based on the plugin.xml and publishes it to the registry
 * '''unpublish''': unpublishes package from registry
 * '''search''': searches a plugin given some keywords
 * '''fetch''': fetches a plugin from cache (if present) or from registry

= plugman =

plugman can be pointed at any registry by running

  * {{{$ plugman config set registry http://localhost:5984/registry/_design/app/_rewrite # useful for local debugging }}}

plugman has new commands to handle ''adduser'', ''publish'', ''unpublish'', ''search''. One can install a plugin from registry by specifying the plugin_name if that plugin is not already in the Cordova project's plugins directory.

== Examples ==

 * {{{$ plugman --plugin plugin_name --project /path/to/project --platform ios}}}
 * {{{$ plugman adduser}}}
 * {{{$ plugman publish path/to/plugin}}}
 * {{{$ plugman unpublish plugin[@version]}}}
 * {{{$ plugman search keyword1[,keyword2,...,keywordn]}}}

= Missing =

npm does not support ''download counts'' or ''popularity'' for packages. We might be able to add that later.