github.com/darkowlzz/helm@v2.5.1-0.20171213183701-6707fe0468d4+incompatible/pkg/plugin/installer/local_installer.go (about) 1 /* 2 Copyright 2016 The Kubernetes Authors All rights reserved. 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 */ 15 16 package installer // import "k8s.io/helm/pkg/plugin/installer" 17 18 import ( 19 "path/filepath" 20 21 "k8s.io/helm/pkg/helm/helmpath" 22 ) 23 24 // LocalInstaller installs plugins from the filesystem. 25 type LocalInstaller struct { 26 base 27 } 28 29 // NewLocalInstaller creates a new LocalInstaller. 30 func NewLocalInstaller(source string, home helmpath.Home) (*LocalInstaller, error) { 31 i := &LocalInstaller{ 32 base: newBase(source, home), 33 } 34 return i, nil 35 } 36 37 // Install creates a symlink to the plugin directory in $HELM_HOME. 38 // 39 // Implements Installer. 40 func (i *LocalInstaller) Install() error { 41 if !isPlugin(i.Source) { 42 return ErrMissingMetadata 43 } 44 src, err := filepath.Abs(i.Source) 45 if err != nil { 46 return err 47 } 48 return i.link(src) 49 } 50 51 // Update updates a local repository 52 func (i *LocalInstaller) Update() error { 53 debug("local repository is auto-updated") 54 return nil 55 }