config

package
v0.1.1-no-docker2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2015 License: BSD-3-Clause, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidFilePath indicates that a file path outside of the tree or
	// repository root directory was specified in the config.
	ErrInvalidFilePath = errors.New("invalid file path specified in config (above config root dir or source unit dir)")
)
View Source
var Filename = "Srcfile"

Filename is the name of the file that configures a directory tree or repository. It is intended to be used by repository authors.

View Source
var Overrides = map[string]*Repository{
	"src.sourcegraph.com/sourcegraph": {
		URI: "src.sourcegraph.com/sourcegraph",
		Tree: Tree{
			SkipDirs: []string{"app/node_modules", "app/bower_components"},
			SkipUnits: []struct{ Name, Type string }{
				{Name: ".", Type: "ruby"},
				{Name: "app", Type: "CommonJSPackage"},
			},
		},
	},
	"code.google.com/p/rsc": {
		URI: "code.google.com/p/rsc",
		Tree: Tree{
			SkipDirs: []string{"cmd/numbers", "cc"},
		},
	},
	"github.com/emicklei/go-restful": {
		URI: "github.com/emicklei/go-restful",
		Tree: Tree{
			SkipDirs: []string{"examples"},
		},
	},
	"github.com/golang/go": {
		URI: "github.com/golang/go",
		Tree: Tree{
			Config:   map[string]interface{}{"GOROOT": "."},
			SkipDirs: []string{"test", "misc", "doc", "lib", "include"},
		},
	},
	"code.google.com/p/go": {
		URI: "code.google.com/p/go",
		Tree: Tree{
			Config:   map[string]interface{}{"GOROOT": "."},
			SkipDirs: []string{"test", "misc", "doc", "lib", "include"},
		},
	},
	"github.com/joyent/node": {
		URI: "github.com/joyent/node",
		Tree: Tree{
			SkipDirs: []string{"tools", "deps", "test", "src"},
			SourceUnits: []*unit.SourceUnit{
				{
					Name:  "node",
					Type:  "CommonJSPackage",
					Dir:   ".",
					Files: []string{"lib/*.js"},
					Config: map[string]interface{}{
						"jsg": map[string]interface{}{
							"plugins": map[string]interface{}{
								"node": map[string]string{"coreModulesDir": "lib/"},
								"$(JSG_DIR)/node_modules/tern-node-api-doc/node-api-doc": map[string]string{
									"apiDocDir":      "doc/api/",
									"apiSrcDir":      "lib/",
									"generateJSPath": "tools/doc/generate.js",
								},
							},
						},
					},
				},
			},
		},
	},
	"github.com/ruby/ruby": {
		URI: "github.com/ruby/ruby",
		Tree: Tree{
			SkipDirs: []string{"test", "ext"},
			SourceUnits: []*unit.SourceUnit{
				{
					Name:   ".",
					Type:   "ruby",
					Dir:    ".",
					Config: map[string]interface{}{"noCachedStdlibYardoc": false},
					Files: []string{
						"*.c",
						"lib/*.rb",
						"lib/cgi/*.rb",
						"lib/cgi/session/*.rb",
						"lib/drb/*.rb",
						"lib/irb/*.rb",
						"lib/irb/cmd/*.rb",
						"lib/irb/ext/*.rb",
						"lib/irb/lc/*.rb",
						"lib/irb/lc/ja/*.rb",
						"lib/matrix/*.rb",
						"lib/minitest/*.rb",
						"lib/net/*.rb",
						"lib/net/http/*.rb",
						"lib/optparse/*.rb",
						"lib/racc/*.rb",
						"lib/rake/*.rb",
						"lib/rake/contrib/*.rb",
						"lib/rake/ext/*.rb",
						"lib/rake/loaders/*.rb",
						"lib/rbconfig/*.rb",
						"lib/rdoc/*.rb",
						"lib/rdoc/context/*.rb",
						"lib/rdoc/generator/*.rb",
						"lib/rdoc/markdown/*.rb",
						"lib/rdoc/markup/*.rb",
						"lib/rdoc/parser/*.rb",
						"lib/rdoc/rd/*.rb",
						"lib/rdoc/ri/*.rb",
						"lib/rdoc/stats/*.rb",
						"lib/rexml/*.rb",
						"lib/rexml/dtd/*.rb",
						"lib/rexml/formatters/*.rb",
						"lib/rexml/light/*.rb",
						"lib/rexml/parsers/*.rb",
						"lib/rexml/validation/*.rb",
						"lib/rinda/*.rb",
						"lib/rss/*.rb",
						"lib/rss/content/*.rb",
						"lib/rss/dublincore/*.rb",
						"lib/rss/maker/*.rb",
						"lib/rubygems/*.rb",
						"lib/rubygems/commands/*.rb",
						"lib/rubygems/core_ext/*.rb",
						"lib/rubygems/ext/*.rb",
						"lib/rubygems/package/*.rb",
						"lib/rubygems/package/tar_reader/*.rb",
						"lib/rubygems/request_set/*.rb",
						"lib/rubygems/resolver/*.rb",
						"lib/rubygems/security/*.rb",
						"lib/rubygems/source/*.rb",
						"lib/rubygems/util/*.rb",
						"lib/shell/*.rb",
						"lib/test/*.rb",
						"lib/test/unit/*.rb",
						"lib/uri/*.rb",
						"lib/webrick/*.rb",
						"lib/webrick/httpauth/*.rb",
						"lib/webrick/httpservlet/*.rb",
						"lib/xmlrpc/*.rb",
						"lib/yaml/*.rb",
					},
				},
			},
		},
	},
}

Functions

This section is empty.

Types

type External

type External struct {
	// Scanners is the default set of scanners to use. If not specified, all
	// scanners in the SRCLIBPATH will be used.
	Scanners []*srclib.ToolRef
}

An External configuration file, represented by this struct, can set system- and user-level settings for srclib.

func SrclibPathConfig

func SrclibPathConfig() (*External, error)

SrclibPathConfig gets the srclib path configuration (which lists all available scanners). It reads it from SRCLIBPATH/.srclibconfig if that file exists, and otherwise it walks SRCLIBPATH for available scanners.

type Options

type Options struct {
	Repo   string `long:"repo" description:"repository URI" value-name:"URI"`
	Subdir string `long:"subdir" description:"subdirectory in repository" value-name:"DIR"`
}

type Repository

type Repository struct {
	// URI is the repository's clone URI.
	URI string `json:",omitempty"`

	// Tree is the configuration for the top-level directory tree in the
	// repository.
	Tree
}

Repository represents the config for an entire repository.

func ReadRepository

func ReadRepository(dir string, repoURI string) (*Repository, error)

ReadRepository parses and validates the configuration for a repository. If no Srcfile exists, it returns the default configuration for the repository. If an overridden configuration is specified for the repository (hard-coded in the Go code), then it is used instead of the Srcfile or the default configuration.

type Tree

type Tree struct {
	// SourceUnits is a list of source units in the repository, either specified
	// manually in the Srcfile or discovered automatically by the scanner.
	SourceUnits []*unit.SourceUnit `json:",omitempty"`

	// Scanners to use to scan for source units in this tree.
	Scanners []*srclib.ToolRef `json:",omitempty"`

	// SkipDirs is a list of directory trees that are skipped. That is, any
	// source units (produced by scanners) whose Dir is in a skipped dir tree is
	// not processed further.
	SkipDirs []string `json:",omitempty"`

	// SkipUnits is a list of source units that are skipped. That is,
	// any scanned source units whose name and type exactly matches a
	// name and type pair in SkipUnits is skipped.
	SkipUnits []struct{ Name, Type string } `json:",omitempty"`

	// Config is an arbitrary key-value property map. Properties are copied
	// verbatim to each source unit that is scanned in this tree.
	Config map[string]interface{} `json:",omitempty"`
}

Tree represents the config for a directory and its subdirectories.

func ReadCached added in v0.0.9

func ReadCached(bdfs vfs.FileSystem) (*Tree, error)

ReadCached reads a Tree's configuration from all of its source unit definition files (which may either be in a local VFS rooted at a .srclib-cache/<COMMITID> dir, or a remote VFS). It does not read the Srcfile; the Srcfile's directives are already accounted for in the cached source unit definition files.

bdfs should be a VFS obtained from a call to (buildstore.RepoBuildStore).Commit.

Jump to

Keyboard shortcuts

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