[camel-k] branch master updated (d8bfcac -> db677d6)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[camel-k] branch master updated (d8bfcac -> db677d6)

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

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


    from d8bfcac  Route loaders should derive language from 'kamel run --language' #46
     new 19dc6d0  Support set integration name for kamel run
     new e42b5d8  Support set integration name for kamel run, sanitize the name
     new db677d6  Added dep

The 3 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:
 Gopkg.lock                      |  9 +++++++++
 pkg/client/cmd/run.go           | 17 +++++++++++++----
 pkg/util/kubernetes/sanitize.go |  5 +++++
 3 files changed, 27 insertions(+), 4 deletions(-)

Reply | Threaded
Open this post in threaded view
|

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

nferraro
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 19dc6d08ee99aee1e7c2437fe92f93a2266c3dd6
Author: Andrea Cosentino <[hidden email]>
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:]
  }

Reply | Threaded
Open this post in threaded view
|

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

nferraro
In reply to this post by nferraro
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 e42b5d80acc0c2d46847bca3e476882166ead94e
Author: Andrea Cosentino <[hidden email]>
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

Reply | Threaded
Open this post in threaded view
|

[camel-k] 03/03: Added dep

nferraro
In reply to this post by nferraro
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 db677d67753d3e968a9858daa6d75fdb8dd1795a
Author: Andrea Cosentino <[hidden email]>
AuthorDate: Wed Sep 12 09:35:39 2018 +0200

    Added dep
---
 Gopkg.lock | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Gopkg.lock b/Gopkg.lock
index 2751fd4..c9859df 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -342,6 +342,14 @@
   version = "v1.0.2"
 
 [[projects]]
+  digest = "1:65c01b68bc4f813c18cdd48c98c38867dd0681b9584138c0403a0865b9bfdfb2"
+  name = "github.com/stoewer/go-strcase"
+  packages = ["."]
+  pruneopts = "NUT"
+  revision = "c8136b55823dc6af966d084a06056c5575f6400f"
+  version = "v1.0.1"
+
+[[projects]]
   digest = "1:bacb8b590716ab7c33f2277240972c9582d389593ee8d66fc10074e0508b8126"
   name = "github.com/stretchr/testify"
   packages = ["assert"]
@@ -705,6 +713,7 @@
     "github.com/pkg/errors",
     "github.com/sirupsen/logrus",
     "github.com/spf13/cobra",
+    "github.com/stoewer/go-strcase",
     "github.com/stretchr/testify/assert",
     "k8s.io/api/apps/v1",
     "k8s.io/api/core/v1",