module Squarectl

Overview

Top-level namespace and configuration holder.

The parsed configuration is kept in class-level state (@@config, @@environments, @@environment_all) so that any component can reach it via Squarectl.config without threading it through. Because this state is global, specs must call .reset_config! between examples (see spec/spec_helper.cr).

Defined in:

squarectl.cr
squarectl/cli.cr
squarectl/cli/completion.cr
squarectl/cli/compose.cr
squarectl/cli/configs.cr
squarectl/cli/info.cr
squarectl/cli/kube.cr
squarectl/cli/secrets.cr
squarectl/cli/swarm.cr
squarectl/commands/compose.cr
squarectl/commands/configs.cr
squarectl/commands/info.cr
squarectl/commands/kompose.cr
squarectl/commands/kubectl.cr
squarectl/commands/networks.cr
squarectl/commands/secrets.cr
squarectl/commands/setup_commands.cr
squarectl/commands/ssl_certificates.cr
squarectl/commands/swarm.cr
squarectl/config/compose_file.cr
squarectl/config/domain.cr
squarectl/config/env_var.cr
squarectl/config/network.cr
squarectl/config/server.cr
squarectl/config/setup_command.cr
squarectl/config/squarectl_config.cr
squarectl/config/squarectl_environment.cr
squarectl/config/ssl_certificate.cr
squarectl/config/ssl_certificate_spec.cr
squarectl/executor.cr
squarectl/shell_completion.cr
squarectl/task.cr
squarectl/task_factory.cr
squarectl/tasks/compose.cr
squarectl/tasks/configs.cr
squarectl/tasks/info.cr
squarectl/tasks/kube.cr
squarectl/tasks/secrets.cr
squarectl/tasks/swarm.cr

Constant Summary

GIT_REF = {{ (`git log -n 1 --format=\"%H\" | head -c 8`).chomp.stringify }}
VERSION = {{ (`shards version /srv/crystaldoc.info/github-jbox-web-squarectl-v1.6.3/src`).chomp.stringify }}

Class Method Summary

Class Method Detail

def self.app_name #

[View source]
def self.compose_v1? #

Whether the config requests Compose v1 (docker-compose) instead of v2 (docker compose). Drives the command prefix in Commands::Compose.


[View source]
def self.config #

[View source]
def self.data_dir #

Project directory conventions, all relative to the current working directory: root_dir/ # the project (cwd) root_dir/kubernetes// # generated Kubernetes manifests root_dir/squarectl/ # data_dir: base.yml lives here root_dir/squarectl/targets/ # per-target compose files (/common.yml, /.yml) root_dir/squarectl/targets/common/ # extra compose files referenced by config


[View source]
def self.env_vars_to_hash #

Snapshot of the process environment as a plain hash, injected into the Crinja template context.


[View source]
def self.environment_all #

The special all environment holding global defaults that TaskFactory merges into every other environment. Returns nil when not defined.


[View source]
def self.environments #

[View source]
def self.executor #

The Executor the CLI hands to every built Task. Memoized to a real Executor by default; specs override it (Squarectl.executor = mock) to capture the commands each subcommand dispatches without shelling out.


[View source]
def self.executor=(executor : Executor) #

[View source]
def self.find_environment(environment, target) #

Resolves the environment selected on the command line for the given target. An exact name match wins; otherwise the name is treated as a substring (prod matches production) but an ambiguous substring matching more than one environment is rejected rather than silently picking the first. Raises on an unknown target/environment, and forbids any non-compose target on the development environment.


[View source]
def self.kubernetes_dir #

Project directory conventions, all relative to the current working directory: root_dir/ # the project (cwd) root_dir/kubernetes// # generated Kubernetes manifests root_dir/squarectl/ # data_dir: base.yml lives here root_dir/squarectl/targets/ # per-target compose files (/common.yml, /.yml) root_dir/squarectl/targets/common/ # extra compose files referenced by config


[View source]
def self.load_config(config_path) #

Reads the config file, renders it as a Crinja (Jinja) template with the current process environment exposed as ENV, then parses the result as YAML. This is why {{ ENV.FOO }} works inside squarectl.yml.


[View source]
def self.reset_config! #

Clears the cached config so a fresh one can be loaded. Used by the test suite.


[View source]
def self.root_dir #

Project directory conventions, all relative to the current working directory: root_dir/ # the project (cwd) root_dir/kubernetes// # generated Kubernetes manifests root_dir/squarectl/ # data_dir: base.yml lives here root_dir/squarectl/targets/ # per-target compose files (/common.yml, /.yml) root_dir/squarectl/targets/common/ # extra compose files referenced by config


[View source]
def self.targets_common_dir #

Project directory conventions, all relative to the current working directory: root_dir/ # the project (cwd) root_dir/kubernetes// # generated Kubernetes manifests root_dir/squarectl/ # data_dir: base.yml lives here root_dir/squarectl/targets/ # per-target compose files (/common.yml, /.yml) root_dir/squarectl/targets/common/ # extra compose files referenced by config


[View source]
def self.targets_dir #

Project directory conventions, all relative to the current working directory: root_dir/ # the project (cwd) root_dir/kubernetes// # generated Kubernetes manifests root_dir/squarectl/ # data_dir: base.yml lives here root_dir/squarectl/targets/ # per-target compose files (/common.yml, /.yml) root_dir/squarectl/targets/common/ # extra compose files referenced by config


[View source]
def self.version #

Human-readable version string, e.g. 1.6.0 (7347781a).


[View source]