From 590e9e539b264e868fdf261fc8cbaaea9506287b Mon Sep 17 00:00:00 2001 From: joeduffy Date: Thu, 31 Aug 2017 10:45:15 -0700 Subject: [PATCH] Rename Lumi.yaml to Pulumi.yaml And also eliminate lots of accumulated cruft around "packfiles", etc. in the workspace code. --- .../basic/minimal/{Lumi.yaml => Pulumi.yaml} | 0 pkg/engine/pack.go | 2 +- pkg/resource/plugin/langruntime_plugin.go | 12 ++----- pkg/resource/plugin/provider_plugin.go | 13 ++----- pkg/workspace/paths.go | 35 +------------------ 5 files changed, 6 insertions(+), 56 deletions(-) rename examples/basic/minimal/{Lumi.yaml => Pulumi.yaml} (100%) diff --git a/examples/basic/minimal/Lumi.yaml b/examples/basic/minimal/Pulumi.yaml similarity index 100% rename from examples/basic/minimal/Lumi.yaml rename to examples/basic/minimal/Pulumi.yaml diff --git a/pkg/engine/pack.go b/pkg/engine/pack.go index 11b2bb31c..2408a2601 100644 --- a/pkg/engine/pack.go +++ b/pkg/engine/pack.go @@ -40,7 +40,7 @@ func (eng *Engine) readPackageFromArg(arg string) (*pkginfo, error) { if err != nil { return nil, errors.Errorf("could not locate a package to load: %v", err) } else if pkgpath == "" { - return nil, errors.Errorf("no package found at: %v", err) + return nil, errors.Errorf("no package found by searching upwards from '%v'", path) } path = pkgpath } else { diff --git a/pkg/resource/plugin/langruntime_plugin.go b/pkg/resource/plugin/langruntime_plugin.go index ac3aa1113..99b829333 100644 --- a/pkg/resource/plugin/langruntime_plugin.go +++ b/pkg/resource/plugin/langruntime_plugin.go @@ -4,13 +4,11 @@ package plugin import ( "fmt" - "path/filepath" "strings" "github.com/golang/glog" "github.com/pulumi/pulumi-fabric/pkg/tokens" - "github.com/pulumi/pulumi-fabric/pkg/workspace" lumirpc "github.com/pulumi/pulumi-fabric/sdk/proto/go" ) @@ -27,15 +25,9 @@ type langhost struct { // NewLanguageRuntime binds to a language's runtime plugin and then creates a gRPC connection to it. If the // plugin could not be found, or an error occurs while creating the child process, an error is returned. func NewLanguageRuntime(host Host, ctx *Context, runtime string) (LanguageRuntime, error) { - // Setup the search paths; first, the naked name (found on the PATH); next, the fully qualified name. + // Go ahead and attempt to load the plugin from the PATH. srvexe := LanguagePluginPrefix + strings.Replace(runtime, tokens.QNameDelimiter, "_", -1) - paths := []string{ - srvexe, // naked PATH. - filepath.Join(workspace.InstallRoot(), srvexe), // qualified name. - } - - // Now go ahead and attempt to load the plugin. - plug, err := newPlugin(host, ctx, paths, fmt.Sprintf("langhost[%v]", runtime)) + plug, err := newPlugin(host, ctx, []string{srvexe}, fmt.Sprintf("langhost[%v]", runtime)) if err != nil { return nil, err } diff --git a/pkg/resource/plugin/provider_plugin.go b/pkg/resource/plugin/provider_plugin.go index a965bde3b..650bb187f 100644 --- a/pkg/resource/plugin/provider_plugin.go +++ b/pkg/resource/plugin/provider_plugin.go @@ -4,7 +4,6 @@ package plugin import ( "fmt" - "path/filepath" "strings" "github.com/golang/glog" @@ -13,7 +12,6 @@ import ( "github.com/pulumi/pulumi-fabric/pkg/resource" "github.com/pulumi/pulumi-fabric/pkg/tokens" "github.com/pulumi/pulumi-fabric/pkg/util/contract" - "github.com/pulumi/pulumi-fabric/pkg/workspace" lumirpc "github.com/pulumi/pulumi-fabric/sdk/proto/go" ) @@ -30,16 +28,9 @@ type provider struct { // NewProvider attempts to bind to a given package's resource plugin and then creates a gRPC connection to it. If the // plugin could not be found, or an error occurs while creating the child process, an error is returned. func NewProvider(host Host, ctx *Context, pkg tokens.Package) (Provider, error) { - // Setup the search paths; first, the naked name (found on the PATH); next, the fully qualified name. + // Go ahead and attempt to load the plugin from the PATH. srvexe := ProviderPluginPrefix + strings.Replace(string(pkg), tokens.QNameDelimiter, "_", -1) - paths := []string{ - srvexe, // naked PATH. - filepath.Join( - workspace.InstallRoot(), workspace.InstallRootLibdir, string(pkg), srvexe), // qualified name. - } - - // Now go ahead and attempt to load the plugin. - plug, err := newPlugin(host, ctx, paths, fmt.Sprintf("resource[%v]", pkg)) + plug, err := newPlugin(host, ctx, []string{srvexe}, fmt.Sprintf("resource[%v]", pkg)) if err != nil { return nil, err } diff --git a/pkg/workspace/paths.go b/pkg/workspace/paths.go index 590feef04..4b8a06b6a 100644 --- a/pkg/workspace/paths.go +++ b/pkg/workspace/paths.go @@ -14,28 +14,12 @@ import ( "github.com/pulumi/pulumi-fabric/pkg/tokens" ) -const ProjectFile = "Lumi" // the base name of a Project. +const ProjectFile = "Pulumi" // the base name of a Project. const Dir = ".lumi" // the default name of the LumiPack output directory. -const PackFile = "Lumipack" // the base name of a compiled LumiPack. -const BinDir = "bin" // the default name of the LumiPack binary output directory. const EnvDir = "env" // the default name of the LumiPack environment directory. const DepDir = "packs" // the directory in which dependencies exist, either local or global. const SettingsFile = "workspace" // the base name of a markup file for shared settings in a workspace. -const InstallRootEnvvar = "LUMIROOT" // the envvar describing where Lumi has been installed. -const InstallRootLibdir = "packs" // the directory in which the Lumi standard library exists. -const DefaultInstallRoot = "/usr/local/lumi" // where Lumi is installed by default. - -// InstallRoot returns Lumi's installation location. This is controlled my the LUMIROOT envvar. -func InstallRoot() string { - // TODO[pulumi/pulumi-fabric#208]: support Windows. - root := os.Getenv(InstallRootEnvvar) - if root == "" { - return DefaultInstallRoot - } - return root -} - // EnvPath returns a path to the given environment's default location. func EnvPath(env tokens.QName) string { path := filepath.Join(Dir, EnvDir) @@ -77,17 +61,6 @@ func DetectPackage(path string, d diag.Sink) (string, error) { if err != nil { return "", err } - - // See if there's a compiled package in the expected location. - pack := filepath.Join(curr, Dir, BinDir, PackFile) - for _, ext := range encoding.Exts { - packfile := pack + ext - if IsPack(packfile, d) { - return packfile, nil - } - } - - // Now look for uncompiled project files. for _, file := range files { name := file.Name() path := filepath.Join(curr, name) @@ -126,12 +99,6 @@ func IsProject(path string, d diag.Sink) bool { return isMarkupFile(path, ProjectFile, d) } -// IsPack returns true if the path references what appears to be a valid package. If problems are detected -- like -// an incorrect extension -- they are logged to the provided diag.Sink (if non-nil). -func IsPack(path string, d diag.Sink) bool { - return isMarkupFile(path, PackFile, d) -} - // IsSettings returns true if the path references what appears to be a valid settings file. If problems are detected -- // like an incorrect extension -- they are logged to the provided diag.Sink (if non-nil). func IsSettings(path string, d diag.Sink) bool {