Documentation
¶
Index ¶
- func DetectFramework(gf *Gemfile) (framework string, version string)
- func ExtractBundleVersion(path string) string
- func ExtractGitHubOwnerRepo(uri string) (owner, repo string, ok bool)
- func ExtractRubyVersion(path string) string
- func GetReverseDependencies(gemName string, gemfile *Gemfile) []string
- type AnalysisResult
- type DependencyInfo
- type DependencyNode
- type DependencyResult
- type Gem
- type GemHealth
- type GemStatus
- type Gemfile
- type HealthChecker
- type HealthScore
- type OutdatedChecker
- func (oc *OutdatedChecker) GetDescription(gemName string) string
- func (oc *OutdatedChecker) GetHomepage(gemName string) string
- func (oc *OutdatedChecker) GetSourceCodeURI(gemName string) string
- func (oc *OutdatedChecker) GetVersionCreatedAt(gemName string) string
- func (oc *OutdatedChecker) IsOutdated(gemName, currentVersion string) (bool, string, error)
- type RubygemeInfo
- type Vulnerability
- type VulnerabilityChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectFramework ¶ added in v1.0.6
DetectFramework detects the primary framework (Rails, Sinatra, etc.) from installed gems
func ExtractBundleVersion ¶ added in v1.0.6
ExtractBundleVersion extracts the Bundle version from Gemfile.lock
func ExtractGitHubOwnerRepo ¶ added in v1.1.0
ExtractGitHubOwnerRepo extracts GitHub owner and repo from source URIs Handles: https://github.com/owner/repo, https://github.com/owner/repo.git, http://github.com/owner/repo, etc.
func ExtractRubyVersion ¶ added in v1.0.6
ExtractRubyVersion extracts the Ruby version from Gemfile.lock
func GetReverseDependencies ¶
GetReverseDependencies returns a list of gems that depend on the given gem This is useful for local calculations without needing to rebuild the tree
Types ¶
type AnalysisResult ¶
type AnalysisResult struct {
TotalGems int
OutdatedGems []string
VulnerableGems []string
FirstLevelGems []string // Names of directly installed gems (from Gemfile, not transitive)
AllGems []*Gem
GemStatuses []*GemStatus
Summary string
Details string
}
func Analyze ¶
func Analyze(gemfile *Gemfile) *AnalysisResult
type DependencyInfo ¶
type DependencyInfo struct {
GemName string
Version string
ForwardDeps []string // What this gem depends on
ReverseDeps []string // What depends on this gem
ForwardDepsCount int
ReverseDepsCount int
// Tree structures
ForwardTree *DependencyNode // Tree of what this gem depends on
ReverseTree *DependencyNode // Tree of what depends on this gem
}
type DependencyNode ¶
type DependencyNode struct {
Name string
Version string
Children []*DependencyNode
Depth int
}
type DependencyResult ¶
type DependencyResult struct {
SelectedGem string
DependencyInfo *DependencyInfo
AllGems map[string]*Gem // For version lookups
}
func AnalyzeDependencies ¶
func AnalyzeDependencies(gemfile *Gemfile, selectedGemName string) *DependencyResult
AnalyzeDependencies analyzes dependencies for a selected gem
type GemHealth ¶ added in v1.1.0
type GemHealth struct {
Score HealthScore `json:"score"`
LastRelease time.Time `json:"last_release"` // from rubygems version_created_at
GitHubPushedAt time.Time `json:"github_pushed_at"` // from github pushed_at
Stars int `json:"stars"`
OpenIssues int `json:"open_issues"`
Archived bool `json:"archived"`
Disabled bool `json:"disabled"`
MaintainerCount int `json:"maintainer_count"`
RateLimited bool `json:"rate_limited"` // GitHub rate limit hit, data partial
FetchedAt time.Time `json:"fetched_at"`
}
GemHealth contains health indicators for a gem
type GemStatus ¶
type GemStatus struct {
Name string
Version string
Groups []string // e.g., "default", "development", "test"
IsOutdated bool
LatestVersion string // Latest available version
IsVulnerable bool
VulnerabilityInfo string // Detailed vulnerability info
HomepageURL string // Homepage or source code URL
Description string // Gem description from rubygems.org
Health *GemHealth // Gem health data (nil until fetched)
OutdatedFailed bool // true if outdated check failed with an error
}
GemStatus represents the status information for a gem
type Gemfile ¶
type Gemfile struct {
Path string
Gems map[string]*Gem
FirstLevelGems []string // Names of gems listed in DEPENDENCIES section
}
func (*Gemfile) GetGemCount ¶
func (*Gemfile) GetGemsAsList ¶
func (*Gemfile) LoadGroupsFromGemfile ¶
LoadGroupsFromGemfile parses the Gemfile to extract group information It updates the gems map with group information
type HealthChecker ¶ added in v1.1.0
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker fetches health data from RubyGems and GitHub APIs
func NewHealthChecker ¶ added in v1.1.0
func NewHealthChecker() *HealthChecker
NewHealthChecker creates a new health checker
func (*HealthChecker) FetchHealth ¶ added in v1.1.0
func (hc *HealthChecker) FetchHealth(gemName, sourceCodeURI, homepageURI, versionCreatedAtStr, ownersURL string) (*GemHealth, error)
FetchHealth fetches health data for a gem from RubyGems and GitHub Returns (*GemHealth, error). If GitHub rate limited, returns partial data with RateLimited=true
type HealthScore ¶ added in v1.1.0
type HealthScore int
HealthScore represents the health tier of a gem
const ( HealthUnknown HealthScore = iota HealthHealthy HealthWarning HealthCritical )
func ComputeHealthScore ¶ added in v1.1.0
func ComputeHealthScore(h *GemHealth) HealthScore
ComputeHealthScore computes the health score based on available data
func (HealthScore) String ¶ added in v1.1.0
func (hs HealthScore) String() string
type OutdatedChecker ¶
type OutdatedChecker struct {
// contains filtered or unexported fields
}
OutdatedChecker checks if gems are outdated by querying rubygems.org
func NewOutdatedChecker ¶
func NewOutdatedChecker() *OutdatedChecker
NewOutdatedChecker creates a new checker with HTTP client
func (*OutdatedChecker) GetDescription ¶
func (oc *OutdatedChecker) GetDescription(gemName string) string
GetDescription returns the description for a gem, using cached data or fetching if needed
func (*OutdatedChecker) GetHomepage ¶
func (oc *OutdatedChecker) GetHomepage(gemName string) string
GetHomepage returns the homepage URL for a gem, using cached data or fetching if needed
func (*OutdatedChecker) GetSourceCodeURI ¶ added in v1.1.0
func (oc *OutdatedChecker) GetSourceCodeURI(gemName string) string
GetSourceCodeURI returns the source code URI for a gem, using cached data or fetching if needed
func (*OutdatedChecker) GetVersionCreatedAt ¶ added in v1.1.0
func (oc *OutdatedChecker) GetVersionCreatedAt(gemName string) string
GetVersionCreatedAt returns the version created at timestamp for a gem, using cached data or fetching if needed
func (*OutdatedChecker) IsOutdated ¶
func (oc *OutdatedChecker) IsOutdated(gemName, currentVersion string) (bool, string, error)
IsOutdated checks if a gem version is outdated and returns the latest version and any error
type RubygemeInfo ¶
type RubygemeInfo struct {
Version string `json:"version"`
VersionCreatedAt string `json:"version_created_at"`
HomepageURI string `json:"homepage_uri"`
SourceCodeURI string `json:"source_code_uri"`
Info string `json:"info"`
}
RubygemeInfo represents gem data from rubygems.org API
type Vulnerability ¶
type Vulnerability struct {
GemName string
AffectedVersions []string // e.g., "< 6.1.4", ">= 6.0.0, < 6.0.5"
Description string
CVE string
}
Vulnerability represents a known vulnerability
type VulnerabilityChecker ¶
type VulnerabilityChecker struct {
// contains filtered or unexported fields
}
VulnerabilityChecker checks if gems have known vulnerabilities
func NewVulnerabilityChecker ¶
func NewVulnerabilityChecker() *VulnerabilityChecker
NewVulnerabilityChecker creates a new checker with known vulnerabilities
func (*VulnerabilityChecker) HasVulnerability ¶
func (vc *VulnerabilityChecker) HasVulnerability(gemName, version string) (bool, string, string)
HasVulnerability checks if a gem has known vulnerabilities Returns (hasVulnerability, cveID, description)