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-create
- Create a new project
SYNOPSIS
tj create
[--flag=arg] [--flag]
DESCRIPTION
Creates a new project. It will lead you through a series of prompts to set up required project information, such as name, location, template, database info, etc. Using the specified information, it will run the installation process below.
tj
will execute init(1) if the VM is uninitializedtj
will clone the selected starter templatetj
will run the starter template's Juicefile(5)install
commandtj
will create all of the necessary project files, such as:Customfile
containing DNS and synced folder settingsinit-custom.sql
containing database setupproject.conf
containing server settingswp-cli.local.yml
containing VM paths- Finally,
tj
will provision the VM to put the new configuration into effect
If you've never used tj
before (meaning, this is your first create(1)), then
that last step might take awhile. After that's done, you should be able to
access your new project at the specified url. It's that easy!
GLOBAL OPTIONS
-n
,--name
=stringName of the project
-l
,--location
=pathLocation of the local project
-t
,--template
=repositoryStarter template to install
--template-revision
,--template-branch
=revisionRevision hash or branch to checkout for starter template (default is master)
-u
,--url
=urlDevelopment URL for the project
-r
,--repository
=repositoryInitialize a new git(1) remote repository
-i
,--import-db
=pathImport an existing database
--bare
,--no-template
Create a project without a starter template
--skip-repo
Skip repository prompts and use default settings
--skip-db
Skip database prompts and use default settings
--use-defaults
Skip all prompts and use default settings
--no-wp
Project is not a wordpress(7) install
--no-wp-cli
,--no-wp-cli-config
Skip creating the local wp-cli(1) config file
--no-db
Project does not need a database
--no-env
Project does not need a
.env
file--no-config
,--no-juicefile
Project does not have a Juicefile(5) config
--modify-wp-config
,--wp-config-modify
Modify
wp-config.php
file contents with project configuration (this flag automatically disables the.env
file when used)--no-ssl
,--no-https
Project does not need SSL support