github.com/rohankumardubey/draft-classic@v0.16.0/pkg/plugin/installer/local_installer.go (about) 1 package installer 2 3 import ( 4 "path/filepath" 5 6 "github.com/Azure/draft/pkg/draft/draftpath" 7 "github.com/Azure/draft/pkg/plugin" 8 ) 9 10 // LocalInstaller installs plugins from the filesystem 11 type LocalInstaller struct { 12 base 13 } 14 15 // NewLocalInstaller creates a new LocalInstaller 16 func NewLocalInstaller(source string, home draftpath.Home) (*LocalInstaller, error) { 17 18 i := &LocalInstaller{ 19 base: newBase(source, home), 20 } 21 22 return i, nil 23 } 24 25 // Install creates a symlink to the plugin directory in $DRAFT_HOME 26 func (i *LocalInstaller) Install() error { 27 if !isPlugin(i.Source) { 28 return plugin.ErrMissingMetadata 29 } 30 31 src, err := filepath.Abs(i.Source) 32 if err != nil { 33 return err 34 } 35 36 return i.link(src) 37 } 38 39 // Update updates a local repository 40 func (i *LocalInstaller) Update() error { 41 debug("local repository is auto-updated") 42 return nil 43 }