class

Carbon::FileManager

Inherits Reference < Object

Constants

C_HEADER_VERSION_REGEX = /^(\s*#define\s+[A-Za-z0-9_]*VERSION\s+)(["'])([^"'\r\n]+)\2(\s*(?:\/.*)?)$/

Regex for C/C++ header #define ...VERSION "..."

CRYSTAL_VERSION_REGEX = /^(\s*(?:pub\s+)?(?:[A-Z0-9_]+::)?VERSION\s*=\s*)(["'])([^"'\r\n]+)\2(\s*(?:#.*)?)$/

Regex for Crystal VERSION constant: VERSION = "0.1.0"

VERSION_LINE_REGEX = /^(\s*version:\s*)(["']?)([^"'\r\n#]+)\2(\s*(?:#.*)?)$/

Regex to capture: 1: Leading whitespace and "version:" 2: Opening quote (optional) 3: Version value 4: Trailing whitespace and optional comment

Class methods

ensure_shard_yml(shard_path : Path | String = "shard.yml", name : String | Nil = nil, initial_version : Version = Version.new(0, 1, 0)) : Bool

Creates a default shard.yml if one does not exist

Source
read_shard_version(shard_path : Path | String = "shard.yml") : Version | Nil

Reads the version string from shard.yml and parses it into a Carbon::Version

Source
sync_all_targets(new_version : Version | String, repo_root : Path | String = ".") : Array(Path)

Automatically finds and synchronizes all version-bearing files in the project

Source
sync_version_cr(version_cr_path : Path | String, version : Version, module_name : String) : Bool

Optional helper to generate or update a typed version.cr file

Source
update_c_header_version_file(file_path : Path | String, new_version : Version | String) : Bool

Updates a C/C++ header #define VERSION file

Source
update_crystal_version_file(file_path : Path | String, new_version : Version | String) : Bool

Updates a Crystal version.cr file, preserving structure

Source
update_shard_version(shard_path : Path | String, new_version : Version | String) : Bool

Updates shard.yml with the new version, preserving quotes, indentation, and comments

Source