gemfile

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetReverseDependencies

func GetReverseDependencies(gemName string, gemfile *Gemfile) []string

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 Gem

type Gem struct {
	Name         string
	Version      string
	Dependencies []string
	Groups       []string // e.g., "default", "development", "test", "production"
}

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
}

GemStatus represents the status information for a gem

type Gemfile

type Gemfile struct {
	Path string
	Gems map[string]*Gem
}

func Parse

func Parse(path string) (*Gemfile, error)

func (*Gemfile) GetGemCount

func (g *Gemfile) GetGemCount() int

func (*Gemfile) GetGemsAsList

func (g *Gemfile) GetGemsAsList() []*Gem

func (*Gemfile) LoadGroupsFromGemfile

func (g *Gemfile) LoadGroupsFromGemfile(gemfilePath string) error

LoadGroupsFromGemfile parses the Gemfile to extract group information It updates the gems map with group information

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) IsOutdated

func (oc *OutdatedChecker) IsOutdated(gemName, currentVersion string) (bool, string)

IsOutdated checks if a gem version is outdated and returns the latest version

type RubygemeInfo

type RubygemeInfo struct {
	Version       string `json:"version"`
	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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL