koality_tools 0.4.4 copy "koality_tools: ^0.4.4" to clipboard
koality_tools: ^0.4.4 copied to clipboard

A collection of useful scripts for various projects.

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

# 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

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