WordPress development made easy

tj is a command line utility that generates, manages and deploys WordPress development sites.

Watch Intro Video

Introduction

Meet tj, a tool that helps you create new local WordPress development sites, manage existing sites, and deploy them, all from the command line.

tj handles all of the hard stuff: creation of a local development environment, managing local and remote WordPress sites, and the most annoying part of all, actually deploying those sites. Say goodbye to MAMP!

tj is built on top of tried and true open source libraries such as Capistrano for deployment, Vagrant for local development, and even a little bit of WP-CLI for database migration.

Requirements

tj requires Vagrant and VirtualBox to be able to create virtual machines for local development. Please download and install both of these before getting started. If you plan on using tj for deployments, you should also ensure that your remote servers have WP-CLI installed in order for tj to be able to handle database migration.

I recommend one of the latest versions of Ruby MRI (2.2, 2.1, 2.0). tj requires at least MRI 1.9.3. For the full report, check out the Travis CI build status, where I test against an array of Ruby interpreters.

I also recommend you set up SSH-keys for GitHub. Internally, tj uses git clone with SSH URLs, so things might break if you don't have your keys set up properly.

Installation

gem install theme-juice

NAME

tj - WordPress development made easy

SYNOPSIS

tj [command] [--flag=arg] [--flag]

GLOBAL OPTIONS

--vm-box=repository

Force vagrant(1) box for use as VM*

--vm-path=path

Force path to VM*

--vm-ip=ip

Force IP address of VM*

--vm-prefix=string

Force directory prefix for project in VM*

--from-path, --in-path=path

Run Juicefile(5) commands from the passed path instead of from the current directory.

--from-srv, --in-srv=path

Run Juicefile(5) commands from the passed srv path instead of from the current host directory path when using the --inside-vm flag.

--inside-vm, --in-vm

Run Juicefile(5) commands from inside of the virtual machine instead of your host machine.

--yolo, --yes

Say yes to anything and everything, and maybe even get a few surprises

--boring

Prints all output without any fancy formatting

--no-unicode

Prints all output without unicode characters

--no-colors, --no-color

Prints all output without color

--no-animations

Prints all output without animations**

--robot

Prints all output with absolutely no formatting

--no-landrush

Disable the landrush(1) gem for managing DNS*

--no-port-forward, --no-port-forwarding

Disable automatic port forwarding*

--verbose

Prints out additional logging information

--quiet, --shh

Suppresses all command output

--trace

Raises any exceptions caught during runtime

--dryrun, --dry-run

Run a command without actually doing anything

--nginx, --no-apache

Create conf files for nginx(7) instead of apache(7)*

* Flag is really only applicable on init(1) before the VM has been created, unless a new (unused) vm-path is specified.

** Coming soon (possibly)

PRIMARY COMMANDS

Run tj help [command] to view an individual command's man page.

init(1), up

Initialize the VM

create(1), new, mk

Create a new project (also runs init(1) if VM is uninitialized)

setup(1)

Setup an existing project (alias for create(1) --bare)

delete(1), rm, remove, trash

Delete a project

deploy(1), server, remote

Deploy and manage a project

SECONDARY COMMANDS

version, --version, -v

Print the current version

env, --env=[property]

Print environment properties

list, ls, projects, apps, sites

List all projects

vm, vagrant, vvv=[command[,command]...]

Manage development environment via vagrant(1). Commands are proxied to your Vagrant installation so that they can be run from any directory.

CONFIG COMMANDS

These run the corresponding command from your project's config file. They accept any number of arguments, since the behavior and handling of input is defined within the config file itself. Below are the commands defined within the Theme Juice starter template.

install=[arg[,arg]...]

Run installation for project

watch=[arg[,arg]...]

Manage and run development build tools

assets=[arg[,arg]...]

Manage front-end dependencies for project

vendor=[arg[,arg]...]

Manage back-end dependencies for project

dist=[arg[,arg]...]

Package project for distribution

wp=[arg[,arg]...]

Manage project's wordpress(7) installation with wp-cli(1)

backup=[arg[,arg]...]

Backup project

test=[arg[,arg]...]

Manage and run project tests

CONFIG FILE

A YAML Juicefile(5) configuration can be used to store commonly-used build scripts (and deploy(1) info), similar to npm(1) scripts. Each command block sequence can be mapped to an individual project's build tool, allowing a streamlined set of commands to be used across multiple projects that utilize different tools. Below are descriptions for the default commands within the Theme Juice starter template's Juicefile.

commands

Collection of various command block sequences

commands.install

Command sequence used to properly install and build project

commands.watch

Command used to manage development build tools

commands.assets

Command used to manage front-end dependencies

commands.vendor

Command used to manage back-end dependencies

commands.wp

Command used to manage WordPress installation

commands.dist

Commands used to package project for distribution

commands.backup

Commands used to backup project

commands.test

Command used to manage and run project tests

Placeholder arguments can be used within any command block sequence to allow splat or indexed arguments to be passed to the corresponding command when executed.

%args%, %arguments%

Splat argument placeholder e.g. cmd %args%

%argN%, %argumentN%

Where n is the argument index e.g. cmd %arg1% | cmd %arg2%

When naming your configuration file, use the recommended Juicefile, or .tj.yaml naming convention. The raw filename regex matcher is below if you want to be a little different.

/^(((\.)?(tj)|((J|j)uicefile))(\.y(a)?ml)?$)/

ENVIRONMENT

All of the global options have a corresponding ENV variable that can be set to permanently use the specified value each time tj(1) is run. This is useful if you're using an alternate vagrant(1) box, or if you need to disable certain features due to limited support i.e. on Windows.

TJ_VM_BOX=repository

Force vagrant(1) box for use as VM

TJ_PATH=path

Force path to VM

TJ_IP=ip

Force IP address of VM

TJ_PREFIX=string

Force directory prefix for project in VM

TJ_YOLO=bool

Say yes to anything and everything, and maybe even get a few surprises

TJ_BORING=bool

Prints all output without any fancy formatting

TJ_NO_UNICODE=bool

Prints all output without unicode characters

TJ_NO_COLORS=bool

Prints all output without color

TJ_NO_ANIMATIONS=bool

Prints all output without animations (coming soon)

TJ_NO_LANDRUSH=bool

Disable the landrush(1) gem for managing DNS

TJ_NO_PORT_FORWARD=bool

Disable automatic port forwarding

TJ_VERBOSE=bool

Prints out additional logging information

TJ_QUIET=bool

Suppresses all command output

TJ_TRACE=bool

Raises any exceptions caught during runtime

TJ_DRYRUN=bool

Run a command without actually doing anything

TJ_NGINX=bool

Create conf files for nginx(7) instead of apache(7)