You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2018/09/12 07:21:34 UTC

[camel-k] branch integration-name updated (5114cb9 -> 7999a42)

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

acosentino pushed a change to branch integration-name
in repository https://gitbox.apache.org/repos/asf/camel-k.git.


    omit 5114cb9  Support set integration name for kamel run
     add d8bfcac  Route loaders should derive language from 'kamel run --language' #46
     new 65d05d3  Support set integration name for kamel run
     new 7999a42  Support set integration name for kamel run, sanitize the name

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (5114cb9)
            \
             N -- N -- N   refs/heads/integration-name (7999a42)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go   |  5 ++
 pkg/build/api/types.go                             |  5 +-
 pkg/build/local/local_builder.go                   |  5 +-
 pkg/client/cmd/run.go                              |  3 +-
 pkg/stub/action/integration/build.go               |  5 +-
 pkg/util/kubernetes/sanitize.go                    |  5 ++
 .../java/org/apache/camel/k/jvm/Application.java   | 16 ++--
 .../main/java/org/apache/camel/k/jvm/Routes.java   | 88 +++++++++++++++++++++
 .../java/org/apache/camel/k/jvm/RoutesLoader.java  | 15 ++++
 .../jvm/{RouteLoaders.java => RoutesLoaders.java}  | 91 ++++++++++------------
 .../org/apache/camel/k/jvm/ApplicationTest.java    | 16 ++++
 .../test/java/org/apache/camel/k/jvm/MyRoutes.java | 16 ++++
 ...outeLoadersTest.java => RoutesLoadersTest.java} | 44 ++++++++---
 .../test/resources/{routes.js => routes.mytype}    |  0
 14 files changed, 238 insertions(+), 76 deletions(-)
 create mode 100644 runtime/jvm/src/main/java/org/apache/camel/k/jvm/Routes.java
 rename runtime/jvm/src/main/java/org/apache/camel/k/jvm/{RouteLoaders.java => RoutesLoaders.java} (74%)
 rename runtime/jvm/src/test/java/org/apache/camel/k/jvm/{RouteLoadersTest.java => RoutesLoadersTest.java} (70%)
 copy runtime/jvm/src/test/resources/{routes.js => routes.mytype} (100%)


[camel-k] 01/02: Support set integration name for kamel run

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 65d05d37ce99efe2b732797ff7948410cb38682d
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Sep 12 08:21:31 2018 +0200

    Support set integration name for kamel run
---
 pkg/client/cmd/run.go | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/pkg/client/cmd/run.go b/pkg/client/cmd/run.go
index 5ec40d7..964b9cc 100644
--- a/pkg/client/cmd/run.go
+++ b/pkg/client/cmd/run.go
@@ -35,7 +35,8 @@ import (
 
 type RunCmdOptions struct {
 	*RootCmdOptions
-	Language string
+	Language        string
+	IntegrationName string
 }
 
 func NewCmdRun(rootCmdOptions *RootCmdOptions) *cobra.Command {
@@ -51,6 +52,7 @@ func NewCmdRun(rootCmdOptions *RootCmdOptions) *cobra.Command {
 	}
 
 	cmd.Flags().StringVarP(&options.Language, "language", "l", "", "Programming Language used to write the file")
+	cmd.Flags().StringVarP(&options.IntegrationName, "integrationName", "i", "", "The integration name")
 	cmd.ParseFlags(os.Args)
 
 	return &cmd
@@ -77,12 +79,18 @@ func (o *RunCmdOptions) run(cmd *cobra.Command, args []string) error {
 
 	namespace := o.Namespace
 
-	name := kubernetes.SanitizeName(args[0])
-	if name == "" {
-		name = "integration"
+	name := ""
+	if o.IntegrationName != "" {
+		name = o.IntegrationName
+	} else {
+		name = kubernetes.SanitizeName(args[0])
+		if name == "" {
+			name = "integration"
+		}
 	}
 
 	codeName := args[0]
+
 	if idx := strings.LastIndexByte(args[0], os.PathSeparator); idx > -1 {
 		codeName = codeName[idx:]
 	}


[camel-k] 02/02: Support set integration name for kamel run, sanitize the name

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7999a42e4c388f4d7d52b92843663e789e9a01be
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Wed Sep 12 09:20:56 2018 +0200

    Support set integration name for kamel run, sanitize the name
---
 pkg/client/cmd/run.go           | 3 ++-
 pkg/util/kubernetes/sanitize.go | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/pkg/client/cmd/run.go b/pkg/client/cmd/run.go
index 964b9cc..aacb05c 100644
--- a/pkg/client/cmd/run.go
+++ b/pkg/client/cmd/run.go
@@ -52,7 +52,7 @@ func NewCmdRun(rootCmdOptions *RootCmdOptions) *cobra.Command {
 	}
 
 	cmd.Flags().StringVarP(&options.Language, "language", "l", "", "Programming Language used to write the file")
-	cmd.Flags().StringVarP(&options.IntegrationName, "integrationName", "i", "", "The integration name")
+	cmd.Flags().StringVarP(&options.IntegrationName, "name", "", "", "The integration name")
 	cmd.ParseFlags(os.Args)
 
 	return &cmd
@@ -82,6 +82,7 @@ func (o *RunCmdOptions) run(cmd *cobra.Command, args []string) error {
 	name := ""
 	if o.IntegrationName != "" {
 		name = o.IntegrationName
+		name = kubernetes.SanitizeName(name)
 	} else {
 		name = kubernetes.SanitizeName(args[0])
 		if name == "" {
diff --git a/pkg/util/kubernetes/sanitize.go b/pkg/util/kubernetes/sanitize.go
index cb6b823..e42c554 100644
--- a/pkg/util/kubernetes/sanitize.go
+++ b/pkg/util/kubernetes/sanitize.go
@@ -18,9 +18,12 @@ limitations under the License.
 package kubernetes
 
 import (
+	"path"
 	"regexp"
 	"strings"
 	"unicode"
+
+	"github.com/stoewer/go-strcase"
 )
 
 var disallowedChars *regexp.Regexp
@@ -31,7 +34,9 @@ func init() {
 
 func SanitizeName(name string) string {
 	name = strings.Split(name, ".")[0]
+	name = path.Base(name)
 	name = strings.ToLower(name)
+	name = strcase.KebabCase(name)
 	name = disallowedChars.ReplaceAllString(name, "")
 	name = strings.TrimFunc(name, isDisallowedStartEndChar)
 	return name