Skip to content

Dica-Developer/weplantaforest

Repository files navigation

We Plant A Forest

Join the chat at https://gitter.im/Dica-Developer/weplantaforest

Open Issues Build Status Coverage Status WATCHING YOUR NODE.JS DEPENDENCIES.

Dev Requirements

Build System

We use Gradle as our build system. All commands listed here follow the pattern gradle <task>'. If Gradle is not installed on your system you can use sh gradlew <task> instead.

Useful commands
  • gradlew tasks - list all tasks
  • gradlew eclipse - setup eclipse files
  • gradlew run - start server for UI development
  • gradlew bootRun - start server for development (refreshes static resources)
  • gradlew test - execute unit tests (open report with open build/reports/tests/index.html
  • for executing single test add -Dtest.single=ExampleMainTest
  • for running tests on mysql add -Pmysql
  • gradlew clean - clean the project

IDE Configuration

Setup with the Gradle Integration for Eclipse plugin.

Setup by using the gradle eclipse plugin

Select "Import..." -> "Gradle Project" then build the model and import the plugins you need.

Additional stuff:

Make sure you have the following classes included for static import:

  • lombok
  • org.assertj.core.api.Assertions
  • org.mockito.Matchers
  • com.jayway.restassured.RestAssured

(In Eclipse under Preferences/Java/Editor/Content Assist/Favorites)

Testing and Developing with MySql

  • Create fresh databases:
  • drop database weplantaforest; create database weplantaforest;
  • drop database weplantaforest_test; create database weplantaforest_test;
  • Run tests with MySql from Gradle by adding the flag -Pmysql, e.g. gradle test -Pmysql
  • Run tests with MySql from Eclipse by either:
  • Change existing annotation @IntegrationTest({ "spring.profiles.active=test" }) into @IntegrationTest({ "spring.profiles.active=test,mysql-test" })
  • OR switch the included profiles in application-test.properties
  • Change existing MySql Schema (managed by Flyway)
  • Add to the latest (unreleased) src/main/resources/db/migration/V*.sql script
  • OR create a new script, e.g. src/main/resources/db/migration/V1_2__descriptionOfMyChange.sql

Starting the backend and the UI

./gradlew user:bootRun
./gradlew article-manager:bootRun
ui/node_modules/.bin/http-server --cors ui/client-react/
cd ui; webpack -w

Now you can open a browser window with:

open http://localhost:8080

Troubleshooting

P: I get an error while starting a gradle task. Could not open terminal for stdout: could not get termcap entry

A: Paste following command in current before executing gradle export GRADLE_OPTS=-Dorg.gradle.native=false