Skip to content

Commit

Permalink
Rebrand tric to slic
Browse files Browse the repository at this point in the history
  • Loading branch information
borkweb committed Aug 26, 2022
1 parent 232593d commit 66b5b9a
Show file tree
Hide file tree
Showing 77 changed files with 987 additions and 949 deletions.
50 changes: 25 additions & 25 deletions .env.tric → .env.slic
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
# The distribution version of the tric-stack.yml configuration file.
# The distribution version of the slic-stack.yml configuration file.
# DO NOT MODIFY THIS FILE!
# If you need to override the contents of this file create a .env.tric.local file and customize it.
# If you need to override the contents of this file create a .env.slic.local file and customize it.


# tric cli configuration parameters.
# slic cli configuration parameters.
# ==================================
# The containers will each be assigned an IP address in the `tric` network.
# The containers will each be assigned an IP address in the `slic` network.
# If you have other similar setups, this setting might conflict with existing settings, change this in the override file
# if required.
TRIC_TEST_SUBNET=28
SLIC_TEST_SUBNET=28
# Set to `1` to have more debug information.
CLI_VERBOSITY=0
# These two are better set at run time, but it might come in handy to fix them.
# DOCKER_RUN_UID=0
# DOCKER_RUN_GID=0
# This will force the cli tool to use a specific project to run the tests.
# You should use the `use` command usually.
# TRIC_CURRENT_PROJECT=the-events-calendar
# SLIC_CURRENT_PROJECT=the-events-calendar
# When you `here` at the site level, all selected targets via `use` will have a relative path set.
# TRIC_CURRENT_PROJECT_RELATIVE_PATH=
# SLIC_CURRENT_PROJECT_RELATIVE_PATH=
# When you `use` on a supported subdirectory of a plugin, this stores the subdirectory name.
#TRIC_CURRENT_PROJECT_SUBDIR=
#SLIC_CURRENT_PROJECT_SUBDIR=
# The git domain from which to clone plugins.
TRIC_GIT_DOMAIN=github.com
SLIC_GIT_DOMAIN=github.com
# The git handle from which to clone plugins.
TRIC_GIT_HANDLE=moderntribe
SLIC_GIT_HANDLE=stellarwp

# The path where `tric here` was executed.
# TRIC_HERE_DIR=
# The path where `slic here` was executed.
# SLIC_HERE_DIR=
# The path from which to read plugins from.
TRIC_PLUGINS_DIR=./_plugins
SLIC_PLUGINS_DIR=./_plugins
# The path from which to read themes from.
TRIC_THEMES_DIR=./_wordpress/wp-content/themes
SLIC_THEMES_DIR=./_wordpress/wp-content/themes
# The path from which to read WordPress core code from.
TRIC_WP_DIR=./_wordpress
SLIC_WP_DIR=./_wordpress
# The path where mounted scripts will live
TRIC_SCRIPTS=./containers/scripts
SLIC_SCRIPTS=./containers/scripts

# The build-prompt mode of tric. Set to `0` to avoid prompting/defaulting prompts for composer/npm builds during CLI operations.
TRIC_BUILD_PROMPT=1
# The build-prompt mode of slic. Set to `0` to avoid prompting/defaulting prompts for composer/npm builds during CLI operations.
SLIC_BUILD_PROMPT=1

# The build-subdir mode of tric. Set to `0` to avoid tric from prompting, and running, composer/npm commands during CLI operations.
TRIC_BUILD_SUBDIR=1
# The build-subdir mode of slic. Set to `0` to avoid slic from prompting, and running, composer/npm commands during CLI operations.
SLIC_BUILD_SUBDIR=1

# The interactive mode of tric. Set to `0` to avoid prompts during CLI operations.
TRIC_INTERACTIVE=1
# The interactive mode of slic. Set to `0` to avoid prompts during CLI operations.
SLIC_INTERACTIVE=1

# XDebug configuration parameters, will apply to the `cli`, `wordpress` and `codeception` services.
# ===============================
# The IDE key used to identify connection requests coming from the services.
XDK=tric
XDK=slic
# Whether to enable XDebug in the containers or not.
XDE=0
# The remote host XDebug should connect to.
# This default value should work out of the box on Docker for Mac and Windows, but it will not on Linux.
# Override this value in the .env.tric.local file if required.
# Override this value in the .env.slic.local file if required.
# E.g. to get the current host IP on Debian derivatives: ip route | grep docker0 | awk '{print $9}'
XDH=host.docker.internal
# The remote host port XDebug will connect to. Avoids the default 9000 as your host machine might have php-fpm already
Expand All @@ -64,7 +64,7 @@ XDP=9001
# `db` service configuration parameters.
# ======================================
MYSQL_ROOT_PASSWORD=password
TRIC_DB_LOCALHOST_PORT=9906
SLIC_DB_LOCALHOST_PORT=9906

# `wordpress` service configuration parameters.
# =============================================
Expand Down
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ test/_plugin_store
# Ignore the local version of WordPress and the plugins files used in local development and testing.
_wordpress
_plugins
# Any .using file created by the tric cli tool.
# Any .using file created by the slic cli tool.
.using
# Any .env.tric.* file created to override the tric cli tool configuration or to configure the runs.
.env.tric.local
.env.tric.run
# Any .env.slic.* file created to override the slic cli tool configuration or to configure the runs.
.env.slic.local
.env.slic.run

# Any .build-version file created by the tric cli tool.
# Any .build-version file created by the slic cli tool.
.build-version
# Any .remote-version file created by the tric cli tool.
# Any .remote-version file created by the slic cli tool.
.remote-version
# Any architecture detection flag file.
.architecture_arm64
.architecture_x86

# tric own cache directory
# slic own cache directory
.cache
100 changes: 50 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tric
# slic

The tric (**T**EC **R**eliable **I**solation **C**ontainers) CLI command provides a containerized and consistent environment for running automated tests.
The slic (**T**EC **R**eliable **I**solation **C**ontainers) CLI command provides a containerized and consistent environment for running automated tests.

## Installation

Expand All @@ -10,129 +10,129 @@ The tric (**T**EC **R**eliable **I**solation **C**ontainers) CLI command provide

## Usage

The `tric` command has many subcommands. You can discover what those are by typing `tric` or `tric help`. If you want
more details on any of the subcommands, simply type: `tric [subcommand] help`.
The `slic` command has many subcommands. You can discover what those are by typing `slic` or `slic help`. If you want
more details on any of the subcommands, simply type: `slic [subcommand] help`.

### Telling `tric` Where to Look
### Telling `slic` Where to Look

The `tric` command needs a place to look for plugins, themes, and WordPress. By default, `tric` creates a `_plugins` and
`_wordpress` directory within the local checkout of `tric`. In most cases, developers like to run automated tests
The `slic` command needs a place to look for plugins, themes, and WordPress. By default, `slic` creates a `_plugins` and
`_wordpress` directory within the local checkout of `slic`. In most cases, developers like to run automated tests
against the paths where they are actively working on code–which likely lives elsewhere.

Good news! You can use the `tric here` sub-command to re-point `tric`'s paths so it looks in the places you wish. There
are two locations you can tell `tric` to look.
Good news! You can use the `slic here` sub-command to re-point `slic`'s paths so it looks in the places you wish. There
are two locations you can tell `slic` to look.

#### WordPress Directory

The first option is to navigate to the root of your site (likely where `wp-config.php` lives) and run the `tric here`
The first option is to navigate to the root of your site (likely where `wp-config.php` lives) and run the `slic here`
command.

```bash
# Change to your root directory of your site (where your wp-config.php file lives)
cd /path/to/your/site

tric here
slic here
```

By running `tric here` at the site level, this allows you to set plugins, themes, or the site itself as the location
By running `slic here` at the site level, this allows you to set plugins, themes, or the site itself as the location
from which to run tests. This also has the benefit of running tests within the WP version that your site uses.

##### Some Notes

Note: This is a somewhat opinionated option as there are some assumptions that are made:

1. That the WordPress directory _is_ the path you are indicating or in a sub-directory called `wp/`.
2. That the `wp-content/` (or `content/`) directory is a sub-directory of the location in which you are typing `tric here`.
2. That the `wp-content/` (or `content/`) directory is a sub-directory of the location in which you are typing `slic here`.

#### Plugins Directory

If you want to defer all of the WP site configuration to a dynamically pulled codebase and _just_ worry about testing
plugins, you can run the `tric here` command right from the plugins directory. Doing so will restrict `tric` to running
plugins, you can run the `slic here` command right from the plugins directory. Doing so will restrict `slic` to running
tests on plugins _only_ and ignore themes and site-level tests.

```bash
# Change to your plugin containing dir (likely some path to wp-content/plugins)
cd /path/to/your/wp-content/plugins

tric here
slic here
```

![tric here](docs/images/tric-here.gif)
![slic here](docs/images/slic-here.gif)

### Initializing a Plugin

With your desired plugin containing directory set, you will need to initialize plugins so that they are prepped and ready
for `tric`-based automated test running. You do that using `tric init [plugin]`.
for `slic`-based automated test running. You do that using `slic init [plugin]`.

Example:

```bash
tric init event-tickets
slic init event-tickets
```

![tric init](docs/images/tric-init.gif)
![slic init](docs/images/slic-init.gif)

What this command does:

1. The plugin is **cloned** if it does not already exist in the plugin directory.
2. Generates a `.env.testing.tric` env file in the plugin.
3. Generates a `test-config.tric.php` file in the plugin.
4. Generates a `codeception.tric.yml` file in the plugin.
2. Generates a `.env.testing.slic` env file in the plugin.
3. Generates a `test-config.slic.php` file in the plugin.
4. Generates a `codeception.slic.yml` file in the plugin.
5. Prompts for confirmation on running `composer` and `npm` installs on the plugin (and its common dir if present).

### Using a Plugin and Running Tests

Ok. You have `tric` set up. You've initialized your plugins. Now you want to run some tests. You need to tell `tric` which
Ok. You have `slic` set up. You've initialized your plugins. Now you want to run some tests. You need to tell `slic` which
plugin you wish to use and then you can run tests to your heart's content!

```bash
tric use event-tickets
tric run wpunit
slic use event-tickets
slic run wpunit
```

#### `tric use [plugin]`
#### `slic use [plugin]`

The `tric use [plugin]` sub-command sets which plugin codeception will point to for test running. If you don't pass a
The `slic use [plugin]` sub-command sets which plugin codeception will point to for test running. If you don't pass a
target, the current working directory will be tried.

If you are unsure which plugins are available for use, you can execute `tric info`.
If you are unsure which plugins are available for use, you can execute `slic info`.

If you don't remember which plugin you are currently using, you can run `tric using`.
If you don't remember which plugin you are currently using, you can run `slic using`.

There are a few flavors of `tric use`:
There are a few flavors of `slic use`:

* `tric use` – Attempts to set the current working directory as the current `tric` target (codeception, composer, npm, etc commands will run against that plugin).
* `tric use [plugin]` – Sets a specific plugin (regardless of the current working directory) as the current `tric` target.
* `tric use [plugin]/common` – Sets a plugin as the current `tric` target to the `common/` directory of the plugin.
* `tric using` – Tells you which plugin you are currently "using" (i.e. the last plugin on which you ran `tric use [plugin]`).
* `slic use` – Attempts to set the current working directory as the current `slic` target (codeception, composer, npm, etc commands will run against that plugin).
* `slic use [plugin]` – Sets a specific plugin (regardless of the current working directory) as the current `slic` target.
* `slic use [plugin]/common` – Sets a plugin as the current `slic` target to the `common/` directory of the plugin.
* `slic using` – Tells you which plugin you are currently "using" (i.e. the last plugin on which you ran `slic use [plugin]`).

**NOTE: you cannot `tric use [plugin]` on multiple plugins at once. The `tric` command relies on its `.env.tric.run` file
**NOTE: you cannot `slic use [plugin]` on multiple plugins at once. The `slic` command relies on its `.env.slic.run` file
to dictate which plugin it is pointing at.**

#### `tric run [testsuite]`
#### `slic run [testsuite]`

The `tric run [testsuite]` does precisely what you would expect. It runs the test suite against the plugin that is currently
being targeted by `tric use [plugin]`. This command is essentially a `codecept run` command, so you can pass all of the
The `slic run [testsuite]` does precisely what you would expect. It runs the test suite against the plugin that is currently
being targeted by `slic use [plugin]`. This command is essentially a `codecept run` command, so you can pass all of the
typical Codeception arguments for `codecept run`.

### Killing Tests or Stopping `tric`
### Killing Tests or Stopping `slic`

If you find yourself wanting to bring down the containers–whether to save on resources, bail out of tests, etc–you can
do so with the `tric down` sub-command. Running `tric-down` will shut down the containers regardless of what is being
do so with the `slic down` sub-command. Running `slic-down` will shut down the containers regardless of what is being
run with them.

_Note: you may need to open a new shell window to run that command if another `tric` command is in progress._
_Note: you may need to open a new shell window to run that command if another `slic` command is in progress._

### Other commands worth knowing

Honestly, all of them are worth knowing. But here are a few important ones worth remembering:

* `tric cli` – run WP CLI commands within the container stack.
* `tric composer` – run composer commands against the current plugin target.
* `tric composer-cache` – make composer faster by using your machine's compose cache directory.
* `tric debug` – activates/deactivates debug output.
* `tric info` – displays current `tric` environment settings.
* `tric npm` – run npm commands against the current plugin target.
* `tric shell` – drop into bash in the containerized environment.
* `tric target` – run the same command against multiple targets. ![Example](docs/images/tric-target-example.png "tric target example")
* `tric xdebug [status|on|off]` – shows/sets xdebug status and info.
* `slic cli` – run WP CLI commands within the container stack.
* `slic composer` – run composer commands against the current plugin target.
* `slic composer-cache` – make composer faster by using your machine's compose cache directory.
* `slic debug` – activates/deactivates debug output.
* `slic info` – displays current `slic` environment settings.
* `slic npm` – run npm commands against the current plugin target.
* `slic shell` – drop into bash in the containerized environment.
* `slic target` – run the same command against multiple targets. ![Example](docs/images/slic-target-example.png "slic target example")
* `slic xdebug [status|on|off]` – shows/sets xdebug status and info.
Loading

0 comments on commit 66b5b9a

Please sign in to comment.