Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Document Analyzer and Project #690

Merged
merged 1 commit into from
Jun 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/golang/dep/internal/gps"
)

// Analyzer implements gps.ProjectAnalyzer.
type Analyzer struct{}

// HasDepMetadata determines if a dep manifest exists at the specified path.
Expand All @@ -21,6 +22,8 @@ func (a Analyzer) HasDepMetadata(path string) bool {
return err == nil && fileOK
}

// DeriveManifestAndLock reads and returns the manifest at path/ManifestName or nil if one is not found.
// The Lock is always nil for now.
func (a Analyzer) DeriveManifestAndLock(path string, n gps.ProjectRoot) (gps.Manifest, gps.Lock, error) {
if !a.HasDepMetadata(path) {
return nil, nil, nil
Expand All @@ -42,6 +45,7 @@ func (a Analyzer) DeriveManifestAndLock(path string, n gps.ProjectRoot) (gps.Man
return m, nil, nil
}

// Info returns the name and version of this ProjectAnalyzer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...god what a terrible method name, i thought i'd gotten annoyed at this and improved it before 😢 will just have to do it later

func (a Analyzer) Info() (string, int) {
return "dep", 1
}
3 changes: 2 additions & 1 deletion project.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ func findProjectRoot(from string) (string, error) {
}
}

// A Project holds a Manifest and optional Lock for a project.
type Project struct {
// AbsRoot is the absolute path to the root directory of the project.
AbsRoot string
// ImportRoot is the import path of the project's root directory.
ImportRoot gps.ProjectRoot
Manifest *Manifest
Lock *Lock
Lock *Lock // Optional
}

// MakeParams is a simple helper to create a gps.SolveParameters without setting
Expand Down