Development Basics

Continuous integration

A bunch of frontend and backend tools run on Travis CI and Appveyor once a commit has been pushed.

Continuous inspection

Scrutenizer and Coveralls are our weapons of choice to keep track on the quality of our codebase.

Edit on GitHub

Coding Standards

General

We prefer the Allman style and tabs to indent code:

if ($hello === 'world')
{
	$output = 'hello';
}
else
{
	$output = 'world';
}

Styles

We prefer NCSS to give our PostCSS a semantic meaning:

.rs-text-hello
{
	&.rs-is-active
	{
		display: block;
	}
}
Edit on GitHub

Linux Environment

Consider to use the docker container before spending hours to get your local environment running.

Install Git

Install Git on your local environment:

apt-get install git

Config Git

Config your name and email:

git config --global user.name {Your Name}
git config --global user.email {your.name@domain.com}

Install Node

Install Node on your local environment:

apt-get install nodejs

Install Grunt

Install Grunt on your local environment:

npm install --global grunt-cli

Install FontForge

Install FontForge on your local environment:

add-apt-repository ppa:fontforge/fontforge
apt-get update
apt-get install fontforge

Install PHP

Install PHP on your local environment:

apt-get install php php-cli php-dev

Install Composer

Install Composer on your local environment:

apt-get install composer

Install SQLite

Install the SQLite bundle on your local environment:

apt-get install sqlite php-sqlite

Install MSSQL

Install the MSSQL bundle on your local environment:

apt-get install msodbcsql mssql-server unixodbc-dev
pecl install pdo_sqlsrv

Config MSSQL

Add the extension to your php.ini file:

extension=pdo_sqlsrv.so

Create a test database:

CREATE DATABASE test
GO

Set the root password:

sqlcmd -U sa -P {your-password}

Install MySQL

Install the MySQL bundle on your local environment:

apt-get install mysql-server mysql-client php-mysql

Config MySQL

Create a test database:

mysql -u root -e 'create database test'

Set the root password:

mysqladmin -u root password test

Install PostgreSQL

Install the PostgreSQL bundle on your local environment:

apt-get install postgresql php-pgsql

Config PostgreSQL

Create a test database:

psql -U postgres -c 'create database test' 

Set the root password:

psql -U postgres -c 'alter user postgres with password '\'test\'

Install Xdebug

Install Xdebug on your local environment:

apt-get install php-xdebug

Install Sendmail

Install Sendmail on your local environment:

apt-get install sendmail

Tweak /etc/hosts if messages stuck in the Sendmail queue:

127.0.0.1 {your-hostname}.localdomain {your-hostname} localhost
Edit on GitHub

Windows Environment

Consider to use the docker container before spending hours to get your local environment running.

Install Git

Install Git on your local environment:

iex ((New-Object System.Net.WebClient).DownloadString('https://powershell.redaxscript.com/git-setup.ps1'))

Config Git

Config your name and email:

git config --global user.name {Your Name}
git config --global user.email {your.name@domain.com}

Install Node

Install Node on your local environment:

iex ((New-Object System.Net.WebClient).DownloadString('https://powershell.redaxscript.com/node-setup.ps1'))

Install Grunt

Install Grunt on your local environment:

npm install --global grunt-cli

Install FontForge

Install FontForge on your local environment:

iex ((New-Object System.Net.WebClient).DownloadString('https://powershell.redaxscript.com/fontforge-setup.ps1'))

Install PHP

Install PHP on your local environment:

iex ((New-Object System.Net.WebClient).DownloadString('https://powershell.redaxscript.com/php-setup.ps1'))

Install Composer

Install Composer on your local environment:

iex ((New-Object System.Net.WebClient).DownloadString('https://powershell.redaxscript.com/composer-setup.ps1'))

Install MySQL

Install the MySQL bundle on your local environment:

iex ((New-Object System.Net.WebClient).DownloadString('https://powershell.redaxscript.com/mysql-setup.ps1'))

Install PostgreSQL

Install the PostgreSQL bundle on your local environment:

iex ((New-Object System.Net.WebClient).DownloadString('https://powershell.redaxscript.com/postgresql-setup.ps1'))

Install Papercut

Install Papercut on your local environment:

iex ((New-Object System.Net.WebClient).DownloadString('https://powershell.redaxscript.com/papercut-setup.ps1'))
Edit on GitHub

Frontend Tools

Install

Install the tools described in this section:

composer install
npm install

Serve

Serve local development server:

grunt serve [options]

--D, --debug-mode
--W, --webfont-compat
--O, --open-browser

Browse your working copy:

http://localhost:8000

Lint

Validate your CSS code for consistence:

grunt stylelint
grunt colorguard

Validate your JavaScript code for consistence:

grunt eslint

Validate your HTML code for consistence:

grunt ncsslint
grunt htmlhint

Build

Build styles, scripts and fonts at once:

grunt build

Build the styles:

grunt build-styles

Build the scripts:

grunt build-scripts

Build the fonts:

grunt build-fonts

Optimize

Create table of contents for your assets and optimize images:

grunt optimize
Edit on GitHub

Backend Tools

Install

Install the tools described in this section:

composer install
npm install

Lint

Validate your PHP code for consistence:

grunt phpcpd
grunt phpcs
grunt phpstan
grunt phpmd

Unit Testing

Run the unit testing suite:

grunt test-unit

Run the unit testing suite in parallel:

grunt test-unit-parallel

Run the unit testing with mutation:

grunt test-unit-mutation

Run the unit testing suite against your MSSQL database:

DB_URL=mssql://sa:test@127.0.0.1/test grunt test-unit

Run the unit testing suite against your MySQL database:

DB_URL=mysql://root:test@127.0.0.1/test grunt test-unit

Run the unit testing suite against your PostgreSQL database:

DB_URL=postgres://postgres:test@127.0.0.1/test grunt test-unit

Acceptance Testing

Start local development server:

grunt start-server

Start local selenium hub:

grunt start-hub

Run the acceptance testing suite:

grunt test-acceptance

Run the acceptance testing suite in parallel:

grunt test-acceptance-parallel
Edit on GitHub

Docker Container

Installation

Clone from GitHub:

git clone https://github.com/redaxscript/redaxscript-docker.git

Run the container:

docker-compose up

Usage

Browse your working copy:

http://localhost:8000
Edit on GitHub