class
Crit::Models::Repository
- Crit::Models::Repository
- Reference
- Object
Overview
Repository model class
Provides basic operations for Git repositories such as creation, existence checking, and listing. This class is responsible for the basic management of repositories, while actual Git operations are handled by the service layer.
Example
repo = Crit::Models::Repository.new("my-project")
if !repo.exists?
repo.create
end
Defined in:
models/repository.crConstant Summary
-
MAX_NAME_LENGTH =
100
-
Maximum length for repository names
-
MIN_NAME_LENGTH =
1
-
Minimum length for repository names
-
RESERVED_NAMES =
["new", "admin", "settings", "login", "logout", "api"]
-
Reserved repository names
-
VALID_NAME_REGEX =
/^[a-zA-Z0-9_\-\.]+$/
-
Regular expression for repository name validation
Constructors
-
.new(name : String)
Initializes a new repository instance
Class Method Summary
-
.ensure_repo_dir
Ensures the repository directory exists
-
.list
Lists all repositories
Instance Method Summary
-
#create
Creates a new bare Git repository
-
#exists?
Checks if the repository exists
-
#name : String
Repository name
-
#path
Returns the full path to the repository
Constructor Detail
Initializes a new repository instance
@param name [String] The name of the repository @raise [ArgumentError] If the repository name is invalid
Class Method Detail
Ensures the repository directory exists
@return [Boolean] True if the directory exists or was created successfully
Instance Method Detail
Creates a new bare Git repository
@return [Boolean] True if the repository was created successfully, false otherwise @return [Boolean] False if the repository already exists
Checks if the repository exists
@return [Boolean] True if the repository exists, false otherwise