Skip to content

A dart CLI tool containing helpful scripts for working with various other CLI tools.

License

Notifications You must be signed in to change notification settings

CodeKoalas/koality_tools

Repository files navigation

Koality Tools

Generated by the Very Good CLI 🤖


Getting Started 🚀

The tools can be activated globally via:

dart pub global activate koality_tools && koality setup

Usage

# Setup command
$ koality setup

# Test command
$ koality test

# Refactor command
$ koality refactor --old koality_flutter --new my_awesome_app

# Scaffold native files for project.
$ koality scaffold --bundle com.codekoalas.koalityFlutter --app-name Koality Flutter

# POEditor download locales command
$ koality poeditor locales

# POEditor upload terms command
$ koality poeditor upload

# Kubectl command to clean pods
$ koality kubectl clean-pods --namespace my-namespace --status Evicted

# Kubectl command to describe pods (partial text search)
$ koality kubectl describe --namespace my-namespace cert

# Kubectl command to exec into a pod (partial text search)
$ koality kubectl exec --namespace my-namespace nginx

# Firebase command to configure Firebase options files.
$ koality firebase configure --dev my-firebase-project-id-dev --prod my-firebase-project-id

# Firebase command to setup Firebase tools locally.
$ koality firebase setup

# MySQL command to create a database with a user/pass combo.
$ koality mysql create database --host localhost --user user --password root --database my_database

# Drupal commands for ease of use.
$ koality drupal lint --fix-errors --drupal-root ./ --modules-root ./docroot/modules/custom --themes-root ./docroot/themes/custom

# DevOps command for generating files and updating Gitlab projects for using Gitlab Auto DevOps.
$ koality devops generate --site-name cool-site --database-name coolsite_dev --site-type drupal --container-path registry.gitlab.com/path/to/container/image

# Show CLI version
$ koality --version

# Show usage help
$ koality --help

Running Tests with/without coverage 🧪

To run all unit tests use the following command (you can omit --coverage|-c to skip coverage report):

$ koality test --coverage

To also generate an HTML coverage report you can use the --generate|-g flag. .

# Generate coverage report in HTML with Koality Tools.
$ koality test --coverage --generate

# Generate coverage report in HTML for multiple coverage info files.
$ koality test --coverage --generate --generate-files coverage/lcov.info coverage/lcov-integration.info

If you want to generate the report separately you can use lcov

Running POEditor commands. 🔤

If using POEditor for translations in a project, there are several helpful commands for downloading locales and for also uploading terms to the project.

# This will download the locales into assets/locales/[locale].po
$ koality poeditor locales --key=[read API key goes here] --project=[project ID here] --locales=[path to locales file]

And for uploading terms:

# This will 
$ koality poeditor upload --key=[write API key goes here] --project=[project ID here] --file=[path where json file will be generated]

Running Kubectl commands. 🕹️

For some helpful kubectl commands, these are Koality scripts to help manage and maintain clusters.

# This will delete any pods within a namespace matching a specific status. (Status defaults to "Evicted")
$ koality kubectl clean-pods --namespace gitlab-managed-apps --status CrashLoopBackOff
# This will exec into any pod within a namespace matching text strings. (Namespace defaults to "gitlab-managed-apps" and
# can be configured in the .koality_config.json file)
$ koality kubectl exec --namespace gitlab-managed-apps safet

This will return a list of pods matching the passed text args (can pass multiple arguments, e.g. safet grow cert will return any pod matching any of those strings) and allow you to select the one you want to exec into.

# This will describe any pods within a namespace matching text strings. (Namespace defaults to "gitlab-managed-apps" and
# can be configured in the .koality_config.json file)
$ koality kubectl describe --namespace gitlab-managed-apps safet

This will return a list of pods matching the passed text args (can pass multiple arguments, e.g. safet grow cert will return any pod matching any of those strings) and allow you to select the one you want to describe.

Running Parse Commands. 🪄

For commands that deal with parsing the pubspec.yaml file the parse command can be used.

# This will read the pubspec.yaml file and parse the version (Defaults to writing to stdout)
$ koality parse version

# It can also write the version to a file
$ koality parse version -o /path/to/version.txt

Runnng Firebase Commands. 🔥

# This command will configure firebase_option.dart files for connecting to a Firebase instance.
# It will create two files, one for a prod instance and one for dev.
$ koality firebase configure --dev my-firebase-project-id-dev --prod my-firebase-project-id

# This command will install Firebase CLI tools and create a firebase.json file with some
# opinionated defaults.
$ koality firebase setup

# This command will start the firebase emulators for the passed firebase project ID.
$ koality firebase emulators -p koality-tools

Running MySQL Commands. 🔐

# This command will create a new database with the passed name (or allow skipping if it exists/command fails)
# and then will create a user with a password and grant them all priviledges to the database. Great for local use
# to make sure you have a user that can do anything to the database.
$ koality mysql create database --host localhost --user root --password root --database my_database

Running Drupal Commands. 💧

# This command will look for the phpcs/phpcbf commands inside the `vendor` directory from where the Drupal root is.
# Default ignored directories are "vendor,node_modules,bower_components", default checked extensions are
# php,module,inc,install,test,profile,theme,css,info,txt,md,yml. Checks inside "./docroot/modules/custom" and
# "./docroot/themes/custom" by default.
$ koality drupal lint

Running DevOps Commands. 🛠️

# This command will create a directory called 'autodevops' in the current directory and then copy over some
# YAML files that include the values needed for our Gitlab Auto DevOps helm chart to deploy the site.
$ koality devops generate --site-name my-drupal-site --database-name koality_drupal_dev --site-type drupal --files-path autodevops --container-path registry.gitlab.com/path/to/container/image

Running Config Commands. ⚙️

# This command will update the Gitlab API config values.
$ koality config gitlab --api-token mycoolapitoken --api-url https://gitlab.mydomain.com/api/v4

Running Apple Commands. 🖥️

$ koality apple required-apis --recursive --path /path/to/codebase

About

A dart CLI tool containing helpful scripts for working with various other CLI tools.

Resources

License

Stars

Watchers

Forks

Packages

No packages published