# Automation Tools

Start by cloning the repository from here (opens new window)

git clone git@gitlab.com:three11/wp-automation.git

Make sure that it is located in a place different than your project root.

For example /Users/YOUR_USER_NAME/server/tools.

If the automation is not configured, please see Installation and configuration

# Usage

# Create a new WordPress project

bash create wordpress-test             # wordpress-test is the name of your project

# Checkout an already existing WordPress project

bash checkout wordpress-test           # wordpress-test is the name of your project

# Create a new static project

bash create-static static-test         # static-test is the name of your project

# Create a new multiple pages static project

bash create-static static-test true    # static-test is the name of your project

# Checkout an already existing static project

bash checkout-static static-test       # static-test is the name of your project

# Installation and configuration

Skip 1, 2, 3 and 4 if you are on Linux. Instead install Ruby 2+ directly

  1. Install Homebrew (opens new window)

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. Install rbenv (opens new window)

    brew install rbenv
    
  3. Install the latest Ruby (opens new window) version with rbenv

    rbenv install 2.5.0
    
  4. Set the above version of Ruby as global

    rbenv global 2.5.0
    
  5. Restart your terminal (using CMD+Q)

  6. Install gitlab's CLI (opens new window)

    gem install gitlab
    

    You may need to use sudo

  7. In your user directory create a .bash_profile file if one does not exist. In that file place the following:

    # Initialize rbenv
    eval "$(rbenv init -)"
    
  8. Install WP CLI (opens new window) Follow the guide in the docs (opens new window).

    curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
    
    # then
    php wp-cli.phar --info
    
    # then
    chmod +x wp-cli.phar
    
    # then
    sudo mv wp-cli.phar /usr/local/bin/wp
    
    # then check if everything is ok
    wp --info
    
  9. Restart your terminal (using CMD+Q)

# Environment seutp

  1. Create a env-config.local file in the root of the repository folder: touch env-config.local && code env-config.local

  2. Copy the contents of the env-config file into the env-config.local file. Edit the variables in the local file as needed:

    SERVER_NAME=http://scriptex.int                                             # This is your local server's URL
    SERVER_ROOT=/Users/devmachine1/server/                                      # This is your local server's root folder
    PROJECTS_DIR=projects/                                                      # This is your local server's projects folder
    MAMP_MYSQL=/Applications/MAMP/Library/bin                                   # This is the path to the MAMP's mysql binary executable file
    STARTER_REPO=git@gitlab.com:three11/wp-starter.git                          # This is the SSH path to the starter repository
    STARTER_REPO_STATIC=git@gitlab.com:three11/html-starter.git                 # This is the SSH path to the starter repository
    STARTER_REPO_STATIC_MULTI=git@gitlab.com:three11/html-starter-multi.git     # This is the SSH path to the multiple pages starter repository
    GITLAB_TOKEN=o1KGwsidMq_mNzvYWPRU                                           # This is your GitLab access token
    
  3. Add the following export to your .bash_profile if is is missing:

    export PATH=$PATH:/Users/YOUR_USER_NAME/server/YOUR_TOOLS_FOLDER/wp-automation
    
  4. Restart your terminal (using CMD+Q)