class Crit::Services::RepoService

Overview

Repository service class

Provides Git-specific operations for repositories such as listing files, getting file content, and listing branches. This service layer interacts with Git commands to perform operations on repositories.

Example

# List files in a repository
files = Crit::Services::RepoService.list_files("my-project", "master")

Defined in:

services/repo_service.cr

Class Method Summary

Class Method Detail

def self.get_file_content(repo_name : String, ref : String = "master", path : String = "") #

Gets file content for a specific file in a repository

@param repo_name [String] The name of the repository @param ref [String] The Git reference (branch, tag, or commit) @param path [String] The path to the file within the repository @return [String] The content of the file @return [Nil] If the repository or file doesn't exist


[View source]
def self.list_branches(repo_name : String) #

Gets list of branches for a repository

@param repo_name [String] The name of the repository @return [Array] Array of branch names @return [Array] Empty array if the repository doesn't exist or has no branches


[View source]
def self.list_files(repo_name : String, ref : String = "master", path : String = "") #

Gets file listing for a repository at a specific path and reference

@param repo_name [String] The name of the repository @param ref [String] The Git reference (branch, tag, or commit) @param path [String] The path within the repository @return [Array<{type: String, mode: String, hash: String, name: String}>] Array of file entries @return [Nil] If the repository or path doesn't exist


[View source]