module Hace

Extended Modules

Defined in:

hace.cr

Constant Summary

ENVIRONMENT = {} of String => String
FAIL_FAST_SHELLS = ["sh", "bash", "zsh", "dash", "ash", "ksh", "mksh"] of ::String

Shells that understand POSIX fail-fast (-e). When a task or Hacefile selects one of these shells without explicit arguments, hace runs the commands with "-e -c" so multi-command tasks stop at the first failure, matching the default /bin/sh behavior. Other shells (python, cmd.exe, ...) only get the script passed via -c.

TASKS_WITH_CLI_ARGS = Set(String).new

Track which tasks explicitly use CLI_ARGS (detected before Crinja expansion)

VARIABLES = {} of String => Value
VERSION = {{ (`shards version /srv/crystaldoc.info/github-ralsina-hace-v1.0.0/src`).chomp.stringify }}

Class Method Summary

Class Method Detail

def self.expand_env_in_value(value : Hace::Value) : Hace::Value #

Expand ${ENV_VAR} references inside a value and everything nested in it, leaving non-string values untouched. This replaces the old trick of rendering the YAML representation and re-parsing it, which silently corrupted strings like "null" or "true" into nil/bool values.


[View source]
def self.expand_env_vars(str : String) : String #

[View source]
def self.expand_glob(str : String) : Array(String) #

[View source]
def self.expand_string(str : String, variables = Hace::VARIABLES) : String #

[View source]
def self.from_yaml_any(any : YAML::Any) : Hace::Value #

Convert a parsed YAML node into the typed Value representation. This is the single place where YAML::Any is allowed to exist.


[View source]
def self.inject_cli_args(cli_args : Array(String)) #

Inject CLI_ARGS and CLI_ARGS_LIST into VARIABLES for template expansion


[View source]
def self.load_dotenv(dotenv_file = nil) #

[View source]
def self.reset_state #

Clear the module-level mutable state (VARIABLES, ENVIRONMENT and the CLI_ARGS tracking set). Intended for use between test scenarios so that values injected by one run (CLI_ARGS, Hacefile variables, env entries) do not leak into the next. Mirrors Croupier::TaskManager.cleanup.


[View source]
def self.to_crinja_value(value : Hace::Value) : Crinja::Value #

[View source]
def self.to_crinja_variables(hash : Hash(String, Value)) : Crinja::Variables #

Convert a Hash(String, Value) to Crinja::Variables


[View source]