Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
.Trashes
ehthumbs.db
Thumbs.db
.vscode/
.vscode/
.idea/
8 changes: 4 additions & 4 deletions devtool/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
)

var descCmd = &cobra.Command{
Use: "dev",
Short: "Developer tool for basic work ",
Long: `This command helps you to work flogo contributions `,
PersistentPreRun: func(cmd *cobra.Command, args []string) {},
Use: "dev",
Short: "Developer tool for basic work ",
Long: `This command helps you to work flogo contributions `,
Run: func(cmd *cobra.Command, args []string) {

},
}
var GOPATH string
Expand Down
9 changes: 5 additions & 4 deletions devtool/gen-action.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
)

var genAction = &cobra.Command{
Use: "gen-action",
Short: "Generate activity scaffold",
Long: `This subcommand helps you generate activity-scaffold`,

Use: "gen-action",
Short: "Generate activity scaffold",
Long: `This subcommand helps you generate activity-scaffold`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {},
Run: func(cmd *cobra.Command, args []string) {

var actionContrib string

if len(args) < 1 {
Expand Down
8 changes: 4 additions & 4 deletions devtool/gen-activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
)

var genActivity = &cobra.Command{
Use: "gen-activity",
Short: "Generate activity scaffold",
Long: `This subcommand helps you generate activity-scaffold`,

Use: "gen-activity",
Short: "Generate activity scaffold",
Long: `This subcommand helps you generate activity-scaffold`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {},
Run: func(cmd *cobra.Command, args []string) {
var activityContrib string

Expand Down
8 changes: 4 additions & 4 deletions devtool/gen-trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
)

var genTrigger = &cobra.Command{
Use: "gen-trigger",
Short: "Generate activity scaffold",
Long: `This subcommand helps you generate activity-scaffold`,

Use: "gen-trigger",
Short: "Generate activity scaffold",
Long: `This subcommand helps you generate activity-scaffold`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {},
Run: func(cmd *cobra.Command, args []string) {
var triggerContrib string

Expand Down
7 changes: 4 additions & 3 deletions devtool/sync-metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import (
)

var syncMetadata = &cobra.Command{
Use: "sync-metadata",
Short: "sync descriptor json and metadata",
Long: `This subcommand creates descriptor json from metadata`,
Use: "sync-metadata",
Short: "sync descriptor json and metadata",
Long: `This subcommand creates descriptor json from metadata`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {},
Run: func(cmd *cobra.Command, args []string) {
pwd, err := os.Getwd()

Expand Down
53 changes: 53 additions & 0 deletions devtool/upgrade.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package devtool

import (
"fmt"
"os"
"path/filepath"

"github.com/project-flogo/cli/api"
"github.com/project-flogo/cli/common"
"github.com/project-flogo/cli/util"
"github.com/spf13/cobra"
)

func init() {
descCmd.AddCommand(updateMaster)
}

const (
fJsonFile = "flogo.json"
corePath = "github.com/project-flogo/master"
)

var updateMaster = &cobra.Command{
Use: "upgrade-master",
Short: "Update all contributions to master",
Long: `This subcommand helps you to upgrade all contributions to master branch`,
Run: func(cmd *cobra.Command, args []string) {
project := common.CurrentProject()

imports, err := util.GetAppImports(filepath.Join(project.Dir(), fJsonFile), project.DepManager(), true)
if err != nil {
fmt.Fprintf(os.Stderr, "Error updating all contributions: %v\n", err)
os.Exit(1)
}
//Update each package in imports
for _, imp := range imports.GetAllImports() {

err = api.UpdatePkg(project, imp.GoImportPath()+"@master")

if err != nil {
fmt.Fprintf(os.Stderr, "Error updating contribution/dependency: %v\n", err)
os.Exit(1)
}
}

err = api.UpdatePkg(project, corePath+"@master")

if err != nil {
fmt.Fprintf(os.Stderr, "Error updating contribution/dependency: %v\n", err)
os.Exit(1)
}
},
}