This module provides a CLI tool for working with the Raincatcher demos and developing the Raincatcher modules. The Raincatcher demo solution has a dependency on many separate modules.
It is possible to manually set up your local development environment without this tool, but this tool provides functionality to do the required steps automatically.
This CLI tool allows developers to:
- Clone the demo solution to a local machine.
- Clone all of the Raincatcher modules that the demo solution requires.
- Run the full demo solution locally.
- Set up for local development by linking all of the Raincatcher modules to the demo solution.
Note: To be able to clone repositories from GitHub using ssh, you must have a ssh key associated with your GitHub account. See this guide for more information.
To get set up for developing Raincatcher locally it is recommended that you set up a separate folder to contain all of the Raincatcher modules and demo apps. (e.g. ~/raincatcher
).
The following steps will assume that the RAINCATCHER_DIRECTORY is the folder that you use for your local development.
If this is your first time working with Raincatcher, perform the following steps to set up your local development environment:
- Clone this CLI tool using the following commands:
# Exporting the working directory for all Raincatcher modules.
export RAINCATCHER_DIRECTORY=~/raincatcher/
mkdir -p $RAINCATCHER_DIRECTORY
cd $RAINCATCHER_DIRECTORY
git clone [email protected]:feedhenry-raincatcher/raincatcher-cli.git
- Add the
wfm
script to your PATH. For example, in your.bashrc
file, add:
export PATH="$PATH:$RAINCATCHER_DIRECTORY/raincatcher-cli"
- With the
wfm
command now available, clone all of the Raincatcher modules to your local machine using the following command:
wfm clone
- Use the following command to install all of the dependencies for each Raincatcher module:
wfm install
- Run the following command to link all of the Raincatcher modules to modules that depend on them. This command will run the
npm link
command for any Raincatcher module dependencies. This useful when you intend to modify multiple modules and see the results in the demo app immediately.
wfm link
Having run all of the commands above the following folder structure will have been created.
├── RAINCATCHER_DIRECTORY
│ ├── raincatcher-cli
│ ├── modules
│ │ ├── raincatcher-camera
│ │ ├── raincatcher-file
│ │ ├── raincatcher-map
│ │ ├── raincatcher-mediator
│ │ ├── raincatcher-message
│ │ ├── raincatcher-result
│ │ ├── raincatcher-risk-assessment
│ │ ├── raincatcher-schedule
│ │ ├── raincatcher-signature
│ │ ├── raincatcher-sync
│ │ ├── raincatcher-template-build
│ │ ├── raincatcher-user
│ │ ├── raincatcher-vehicle-inspection
│ │ ├── raincatcher-workflow
│ │ └── raincatcher-workorder
│ ├── raincatcher-demo-auth
│ ├── raincatcher-demo-cloud
│ ├── raincatcher-demo-mobile
│ └── raincatcher-demo-portal
Having cloned all of the required Raincatcher repositories to your local development environment, you are now ready to start local development.
-
Install MongoDB locally or containerised
-
Install Redis
- On Linux: https://redis.io/topics/quickstart
- On Mac
brew install redis
- Install tmux
- On Linux:
apt-get install tmux
- On Mac: https://gist.github.com/simme/1297707.
- Install tmuxinator (Ruby required)
gem install tmuxinator
- Install grunt (Node.js required)
npm install -g grunt
- Start the Raincatcher node processes (mongo will be started automatically if you installed it locally, else the Docker container should already be running):
wfm start
Each of the terminals started by tmux can be interacted with individually to stop/restart each node process.
Note If you do not have Docker installed you must first install it.
To run a containerised version of MongoDB run:
docker run --name raincatcher-mongo -p 27017:27017 -d mongo:2
There should now be a running instance of MongoDB running inside a container with port 27017
accessible by the appt.
To confirm that the MongoDB container is running as expected, run:
docker ps
and ensure that the raincatcher-mongo
container is running.
There may already be a container named raincatcher-mongo
,
if this container is running then there is no need to create a new MongoDB container. If the container is stopped and you wish
to have a new container, delete the old raincatcher-mongo
by running:
docker rm raincatcher-mongo
and run the docker run
command again.
If this is not the issue then port 27017
on your local machine may have already be claimed by another running instance of MongoDB.
If this is the case, shut down that MongoDB and run the docker run
command again.
The wfm start
task will start mongo automatically. However the raincatcher-cli provides the wfm mongo {start|stop|status}
command take manual control of the mongo process:
wfm mongo start
wfm mongo status
wfm mongo stop
The commands wfm status
and wfm pull
will run their respective git commands on all folders in the repository.
The command wfm clean
will remove the node_modules folder in each of the app folders only.
The command wfm install
will run npm install in each of the app and module folders.