Carbon::FileManager
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
Reads the version string from shard.yml and parses it into a Carbon::Version
Automatically finds and synchronizes all version-bearing files in the project
Optional helper to generate or update a typed version.cr file
Updates a C/C++ header #define VERSION file
Updates a Crystal version.cr file, preserving structure