Skip to content
This repository has been archived by the owner on Apr 18, 2019. It is now read-only.

Latest commit

 

History

History
150 lines (112 loc) · 6.66 KB

README.md

File metadata and controls

150 lines (112 loc) · 6.66 KB

Cordova Registry Web


📌 Deprecation Notice

This repository is deprecated and no more work will be done on this by Apache Cordova. You can continue to use this and it should work as-is but any future issues will not be fixed by the Cordova community.

Feel free to fork this repository and improve your fork. Existing forks are listed in Network and Forks.


⚠️ Deprecated! This repo is no longer maintained. Use at your own risk ⚠️


This repo contains the assets for stage.plugins.cordova.io. The site is located in the attachments folder. Below we go over the steps of getting setup, running locally and pushing to the server. The main UI files for the site can be found in the attachments directory.

Setup

Clone this repo & install dependencies

git clone https://git-wip-us.apache.org/repos/asf/cordova-registry-web.git

In your terminal, navigate to the cordova-registry-web directory and npm install. This will install the dependencies required to deploy locally.

We also need to install the grunt-cli and couchapp globally. Type npm install grunt-cli -g and npm install couchapp -g.

Clone Cordova-Registry repo

If you are interested in publishing plugins to your local repo, you will need this repo.

git clone https://git-wip-us.apache.org/repos/asf/cordova-registry.git

Navigate to the cordova-registry directory and run npm install.

Install & Start CouchDB

brew install couchdb

Once installed, start CouchDB. You can do this by running couchdb in your terminal. Go to http://localhost:5984 in your browser to confirm it is working.

Create databases in couch

  • Registry - holds plugins, views and site ui
curl -X PUT http://localhost:5984/registry
  • Downloads - holds download counts
curl -X PUT http://localhost:5984/downloads

Replicate remote databases

If you want to see actual plugins and download counts when you are working locally, you will have to replicate the remote dbs. This could take a while as they are large. An alternative to replicating is to publish plugins locally for testing purposes.

  • IrisCouch
curl -X POST -d '{"source":"http://cordova.iriscouch.com/registry", "target":"http://localhost:5984/registry"}' http://localhost:5984/_replicate -H "Content-Type: application/json"

and

curl -X POST -d '{"source":"http://cordova.iriscouch.com/downloads", "target":"http://localhost:5984/downloads"}' http://localhost:5984/_replicate -H "Content-Type: application/json"

or

  • Cloudant (Actually this got shut down)
curl -X POST -d '{"source":"http://apachecordova.cloudant.com/registry", "target":"http://localhost:5984/registry"}' http://localhost:5984/_replicate -H "Content-Type: application/json"

and

curl -X POST -d '{"source":"http://apachecordova.cloudant.com/downloads", "target":"http://localhost:5984/downloads"}' http://localhost:5984/_replicate -H "Content-Type: application/json"

Potential Errors

A possible error may be that you don't have a local _replicate db. You can create one with:

curl -X PUT http://localhost:5984/_replicate

You could also run into the insecure rewrite rule error. Fix this by setting secure_rewrites to false in your local.ini under [httpd] CouchDB configuriation file. Mine was at /usr/local/etc/couchdb/local.ini.

Deploy Locally

Cordova-registry

Navigate to cordova-registry directory in your terminal and run the following command.

couchapp push app.js http://localhost:5984/registry

Cordova-registry-web

Navigate to cordova-registry-web directory in your terminal and run the following command.

grunt server

You show now be able to view the site at http://localhost:5000 in your browser. The site is setup to use livereload. As you modify & save files in the attachments directory, the browser will automatically reload the page.

NOTE - The Grunt server & watch commands are set up to use livereload - this will automatically reload your browser after the server is done reloading - no more needing to click the refresh button on your browser. The livereload script is put in the HEAD of the index.html page - if you wish to not use it, you will need to comment or remove that from the index.html page.

Updating npm Search Page

First read the README file that is located under npm-search folder. Once you make changes, run gulp build while on npm-search directory. In order to package npm search page with cordova registry website, run grunt npmsearch while on cordova-registry-web folder. After this please validate your changes with grunt server.

Publish Plugins to your local instance

plugman config set registry http://localhost:5984/registry/_design/app/_rewrite

Now you can run commands like plugman publish and the plugins will be published to your local registry db.

Potential Errors

If you keep seeing POST /_session 401 when you try to publish a plugin locally, you need to go delete your user info. In terminal type rm -rf ~/.plugman. Then go to the plugin you want to add and go plugman adduser. Enter in your username, password and email.

Deploy Remotely

Contact Steve or Anis to get username and passwords for remote couchdb instances. Any Cordova committers will be given the information if requested. Currently plugins.cordova.io is hosted on Iris Couch and stage.plugins.cordova.io is hosted on Cloudant. The plan is to move over to Cloudant when this site launches. This will require setting up the default plugman registry to Cloudant. This should be doable by changing the DNS for registry.cordova.io

Cordova-registry

Navigate to cordova-registry directory in your terminal and run the following command.

Note: I don't believe we will be updating cordova-registry often. These commands probably won't be needed much.

couchapp push app.js http://username:password@apachecordova.cloudant.com/registry

or

couchapp push app.js http://username:password@cordova.irishcouch.com/registry

Cordova-registry-web

Navigate to cordova-registry-web directory in your terminal and run the following command.

grunt cloudant

or

grunt iriscouch

If you update your local config.json with credentials and don't want to push those changes up to git (so we don't accidentally commit passwords), run git update-index --assume-unchanged config.json after you have modified your config.json.