You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2020/11/17 10:46:40 UTC

[camel-k] 06/12: Address comments. Clean-up code.

This is an automated email from the ASF dual-hosted git repository.

nferraro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 9b2d0b229a778f03a3613be3de63222f0f89dae5
Author: Doru Bercea <gh...@ibm.com>
AuthorDate: Tue Nov 10 16:05:28 2020 -0500

    Address comments. Clean-up code.
---
 pkg/builder/runtime/quarkus.go |  9 ---------
 pkg/cmd/local_run.go           | 18 +++++-------------
 pkg/cmd/util_commands.go       |  4 ++--
 3 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/pkg/builder/runtime/quarkus.go b/pkg/builder/runtime/quarkus.go
index dbc3e33..a98faba 100644
--- a/pkg/builder/runtime/quarkus.go
+++ b/pkg/builder/runtime/quarkus.go
@@ -259,14 +259,5 @@ func ProcessQuarkusTransitiveDependencies(mc maven.Context, content []byte) ([]v
 		Checksum: "sha1:" + runnerChecksum,
 	})
 
-	// currentpath, errr := os.Getwd()
-	// if errr != nil {
-	// 	return nil, errr
-	// }
-	// _, err = util.CopyFile(path.Join(mc.Path, "target", runner), path.Join(currentpath, runner))
-	// if err != nil {
-	// 	return nil, err
-	// }
-
 	return artifacts, nil
 }
diff --git a/pkg/cmd/local_run.go b/pkg/cmd/local_run.go
index 2031e52..5959a8e 100644
--- a/pkg/cmd/local_run.go
+++ b/pkg/cmd/local_run.go
@@ -30,9 +30,9 @@ func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCm
 	}
 
 	cmd := cobra.Command{
-		Use:     "local-run [files to inspect]",
-		Short:   "Run a Camel integration locally.",
-		Long:    `Run a Camel integration locally using existing integration files.`,
+		Use:     "local-run [integration files]",
+		Short:   "Run integration locally.",
+		Long:    `Run integration locally using the input integration files.`,
 		PreRunE: decode(&options),
 		RunE: func(_ *cobra.Command, args []string) error {
 			if err := options.validate(args); err != nil {
@@ -55,7 +55,7 @@ func newCmdLocalRun(rootCmdOptions *RootCmdOptions) (*cobra.Command, *localRunCm
 		},
 	}
 
-	cmd.Flags().StringArrayP("properties-file", "p", nil, "File containing integration properties.")
+	cmd.Flags().StringArray("property-file", nil, "Add a property file to the integration.")
 	cmd.Flags().StringArrayP("dependency", "d", nil, `Additional top-level dependency with the format:
 <type>:<dependency-name>
 where <type> is one of {`+strings.Join(acceptedDependencyTypes, "|")+`}.`)
@@ -65,19 +65,11 @@ where <type> is one of {`+strings.Join(acceptedDependencyTypes, "|")+`}.`)
 
 type localRunCmdOptions struct {
 	*RootCmdOptions
-	PropertiesFiles        []string `mapstructure:"properties-files"`
+	PropertiesFiles        []string `mapstructure:"property-files"`
 	AdditionalDependencies []string `mapstructure:"dependencies"`
 }
 
 func (command *localRunCmdOptions) validate(args []string) error {
-	for _, additionalDependency := range command.AdditionalDependencies {
-		fmt.Printf("Dep: %v\n", additionalDependency)
-	}
-
-	for _, prop := range command.PropertiesFiles {
-		fmt.Printf("Prop: %v\n", prop)
-	}
-
 	// Validate additional dependencies specified by the user.
 	err := validateIntegrationForDependencies(args, command.AdditionalDependencies)
 	if err != nil {
diff --git a/pkg/cmd/util_commands.go b/pkg/cmd/util_commands.go
index 213ea6b..5ec0a34 100644
--- a/pkg/cmd/util_commands.go
+++ b/pkg/cmd/util_commands.go
@@ -88,10 +88,10 @@ func RunLocalIntegration(properties []string, dependencies []string, routes []st
 	fmt.Printf("executing: %s", strings.Join(cmd.Args, " "))
 
 	// Add directory where the properties file resides.
-	os.Setenv("CAMEL_K_CONF_D", strings.Join(confDirectories(properties), ","))
+	cmd.Env = append(cmd.Env, "CAMEL_K_CONF_D="+strings.Join(confDirectories(properties), ","))
 
 	// Add files to the command line under the CAMEL_K_ROUTES flag.
-	os.Setenv("CAMEL_K_ROUTES", strings.Join(formatRoutes(routes), ","))
+	cmd.Env = append(cmd.Env, "CAMEL_K_ROUTES="+strings.Join(formatRoutes(routes), ","))
 
 	return cmd.Run()
 }