Tokei::Api::Services::TokeiService
Service class for executing tokei command
Constants
BITBUCKET_HTTPS = /^https:\/\/bitbucket\.org\/[\w.-]+\/[\w.-]+(?:\.git|\/)?$/
Bitbucket URL patterns
BITBUCKET_SSH = /^git@bitbucket\.org:[\w.-]+\/[\w.-]+(?:\.git|\/)?$/
CLONE_TIMEOUT = ENV["CLONE_TIMEOUT_SECONDS"]?.try(&.to_i) || 30
Timeout for git clone operation (in seconds)
GENERIC_HTTPS = /^https:\/\/[\w.~:-]+\.[\w.~:-]+\/[\w.~:-]+\/[\w.~:-]+(?:\.git|\/)?$/
Generic git URL patterns Allow ~ and other common user/repo characters
GENERIC_SSH = /^git@[\w.~:-]+\.[\w.~:-]+:[\w.~:-]+\/[\w.~:-]+(?:\.git|\/)?$/
GITHUB_HTTPS_EXTRACTION = /https?:\/\/(?:www\.)?github\.com\/([^\/]+)\/([a-zA-Z0-9._-]+?)(?:\.git)?$/
GitHub URL patterns with capture groups for owner and repo The regex captures the owner and repository name, removing any .git extension at the end
GITHUB_HTTPS_VALIDATION = /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+(?:\.git|\/)?$/
Common URL patterns GitHub URL patterns
GITHUB_SSH_EXTRACTION = /git@github\.com:([^\/]+)\/([a-zA-Z0-9._-]+?)(?:\.git)?$/
GITHUB_SSH_VALIDATION = /^git@github\.com:[\w.-]+\/[\w.-]+(?:\.git|\/)?$/
GITLAB_HTTPS = /^https:\/\/gitlab\.com\/[\w.-]+\/[\w.-]+(?:\.git|\/)?$/
GitLab URL patterns
GITLAB_SSH = /^git@gitlab\.com:[\w.-]+\/[\w.-]+(?:\.git|\/)?$/
TEMP_DIR_BASE = ENV["TEMP_DIR"]? || "/tmp/tokei-api"
Base path for temporary directory
TOKEI_TIMEOUT = ENV["TOKEI_TIMEOUT_SECONDS"]?.try(&.to_i) || 30
Timeout for tokei analysis operation (in seconds)
Class methods
Extract owner and repo from GitHub URL