Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RlangBackend = api.LanguageBackend{ Name: "rlang", Specfile: "Rconfig.json", Lockfile: "Rconfig.lock.json", IsAvailable: rIsAvailable, FilenamePatterns: []string{"*.r", "*.R"}, Quirks: api.QuirksNone, GetPackageDir: getRPkgDir, Search: func(query string) []api.PkgInfo { pkgs := []api.PkgInfo{} for _, hit := range SearchPackages(query) { pkg := api.PkgInfo{ Name: hit.Source.Package, Description: hit.Source.Title, Version: hit.Source.Version, HomepageURL: hit.Source.URL, DocumentationURL: "", SourceCodeURL: hit.Source.Repository, BugTrackerURL: hit.Source.BugReports, Author: hit.Source.Author, License: hit.Source.License, Dependencies: getImports(hit.Source.Imports), } pkgs = append(pkgs, pkg) } return pkgs }, Info: func(name api.PkgName) api.PkgInfo { if pkg := SearchPackage(string(name)); pkg != nil { hit := *pkg return api.PkgInfo{ Name: hit.Source.Package, Description: hit.Source.Title, Version: hit.Source.Version, HomepageURL: hit.Source.URL, DocumentationURL: "", SourceCodeURL: hit.Source.Repository, BugTrackerURL: hit.Source.BugReports, Author: hit.Source.Author, License: hit.Source.License, Dependencies: getImports(hit.Source.Imports), } } return api.PkgInfo{} }, Add: func(ctx context.Context, packages map[api.PkgName]api.PkgSpec, projectName string) { for name, info := range packages { RAdd(ctx, RPackage{ Name: string(name), Version: string(info), }) } }, Remove: func(ctx context.Context, packages map[api.PkgName]bool) { for name := range packages { RRemove(ctx, RPackage{Name: string(name)}) _ = util.GetExitCode([]string{ "R", "-q", "-e", "remove.packages('" + normalizePkgName(string(name)) + "')", }, false, true) } }, Lock: RLock, Install: func(ctx context.Context) { createRPkgDir() for _, pkg := range RGetSpecFile().Packages { if !installRPkg(pkg.Name) { RRemove(ctx, pkg) RLock(ctx) } } }, ListSpecfile: func(mergeAllGroups bool) map[api.PkgName]api.PkgSpec { pkgs := map[api.PkgName]api.PkgSpec{} for _, pkg := range RGetSpecFile().Packages { pkgs[api.PkgName(pkg.Name)] = api.PkgSpec(pkg.Version) } return pkgs }, ListLockfile: func() map[api.PkgName]api.PkgVersion { pkgs := map[api.PkgName]api.PkgVersion{} for _, pkg := range RGetSpecFile().Packages { pkgs[api.PkgName(pkg.Name)] = api.PkgVersion(pkg.Version) } return pkgs }, Guess: func(ctx context.Context) (map[string][]api.PkgName, bool) { util.NotImplemented() return nil, false }, InstallReplitNixSystemDependencies: nix.DefaultInstallReplitNixSystemDependencies, }
RlangBackend is a custom UPM backend for R
Functions ¶
Types ¶
type CranHit ¶
type CranHit struct { Index string `json:"_index"` Type string `json:"_type"` ID string `json:"_id"` Score float32 `json:"_score"` Source CranHitSource `json:"_source"` }
CranHit represents the JSON we get about a single package from a package search
func SearchPackage ¶
SearchPackage searches for the first package result
func SearchPackages ¶
SearchPackages searches for the top (<= 50) package results
type CranHitSource ¶
type CranHitSource struct { Date string `json:"date"` Author string `json:"Author"` MD5sum string `json:"MD5sum"` NeedsCompilation string `json:"NeedsCompilation"` URL string `json:"URL"` Title string `json:"Title"` Packaged string `json:"Packaged"` Encoding string `json:"Encoding"` DatePublished string `json:"Date/Publication"` Version string `json:"Version"` Maintainer string `json:"Maintainer"` Enhances string `json:"Enhances"` Imports string `json:"Imports"` Authors string `json:"Authors@R"` RevDeps int `json:"revdeps"` BugReports string `json:"BugReports"` Suggests string `json:"Suggests"` Depends string `json:"Depends"` LinkingTo string `json:"LinkingTo"` Package string `json:"Package"` License string `json:"License"` CranDBFileDate string `json:"crandb_file_date"` RoxygenNote string `json:"RoxygenNote"` Type string `json:"Type"` Description string `json:"Description"` Repository string `json:"Repository"` }
CranHitSource represents the JSON we get about the information for a single package from a package search
type CranHits ¶
type CranHits struct { Total int `json:"total"` MaxScore float32 `json:"max_score"` Hits []CranHit `json:"hits"` }
CranHits represents the JSON we get about the packages from a package search
type CranResponse ¶
type CranResponse struct { Took int `json:"took"` TimedOut bool `json:"timed_out"` Shards CranShards `json:"_shards"` Hits CranHits `json:"hits"` }
CranResponse represents the JSON we get from a package search
type CranShards ¶
type CranShards struct { Total int `json:"total"` Successful int `json:"successful"` Skipped int `json:"skipped"` Failed int `json:"failed"` }
CranShards represents the JSON we get about unimportant data so it doesn't matter
Click to show internal directories.
Click to hide internal directories.