Skip to content

chrishokamp/handycat

Repository files navigation

Introduction

Welcome to HandyCAT, a flexible web-based CAT tool for translation process research.

Quickstart

The frontend is built entirely with javascript, using the Angular framework.

To set up your development environment, it's strongly recommended that you use the development stack consisting of:

  • bower - for frontend package management
  • grunt - for automating the build and deployment, running tests, and providing the development server (using packages from npm)
  • npm - for managing the node js dependencies

Make sure you are running a 64-bit version of Linux.

Installation

  1. Install node and npm if you don't already have them:
$ sudo apt-get install nodejs
$ sudo apt-get install npm
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
  1. Install Chrome if you don't have it already.
  2. Install git: sudo apt install git
  3. Clone (or fork) the repo: git clone https://github.com/chrishokamp/handycat.git
  4. Install grunt: sudo npm install -g grunt
  5. Install grunt-cli: sudo npm install -g grunt-cli
  6. Install bower: sudo npm install -g bower
  7. Run sudo npm install from the top directory (handycat/)
  8. Run bower install from the top directory (handycat/)
  9. Build bootstrap ui manually:
$ cd app/bower_components/angular-ui-bootstrap
$ npm install
$ grunt
  1. Install mongodb

  2. Install redis:

$ sudo add-apt-repository ppa:chris-lea/redis-server
$ sudo apt-get update
$ sudo apt-get install redis-server
  1. Install the XLIFF creator and vocabulary server microservices

First, install pm2 because it makes things easy

$ sudo npm install -g pm2

Now install the microservice dependencies:

$ cd microservices/vocabulary_server
$ npm install
$ cd ../xliff_creator
$ npm install
  1. to use the autoreload and watch changes functionalities, you'll need ruby and compass.
$ sudo gem install compass
$ sudo gem install sass

Finally, once you've done all that, you're ready to start developing!

Development

  1. start mongodb sudo mongod --fork --logpath=mongod.log --smallfiles

  2. start the microservices

$ cd handycat/
$ pm2 start microservices/vocabulary_server/web.js
$ pm2 start microservices/xliff_creator/web.js
  1. start HandyCAT with live reload
$ grunt express-server

grunt express-server will fire up a server which watches all of the files in the repo, and automagically reloads whenever you change something.

Note: the command was previously grunt serve, but this was changed so that both the server and the UI reload automagically.

Code Style

  • use two spaces to indent javascript

Style

  • the project uses sass and makes use of mixins and css variables in the app/styles/ directory
  • you need at least sass 3.3 -- do sass -v to check your version, gem install sass to install/update

Microservices

In order to implement new features in HandyCAT, you may need to implement new backend services as well. These should go in the microservices/ directory. The urls to the microservice should then be proxied throught the express server.

Testing

Building and Deploying

  • The command grunt handycat_builds will build the client application into handycat_builds/

  • To deploy the application to a public server, copy the handycat_builds/ directory to your server, and change the environment to "production" by uncommenting this line

    • you can put everything together by doing:
tar czf handycat_build.tar.gz handycat_builds
  • if you need to change the port, one way is just to change the hardcoded port number here

Language Codes

Some parts of the application rely upon the language tags in the XLIFF being in a format that we understand. HandyCAT adheres to the XLIFF 2.0 requirements for the srcLang (required) and trgLang (optional) attributes, and assumes that language codes are in a format like this.