-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure move to single repo. Project now includes pipesdl, pipesp…
…ool, pipescli, examples, plugins and, documentation
- Loading branch information
Showing
44 changed files
with
1,816 additions
and
37 deletions.
There are no files selected for viewing
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"flag" | ||
"fmt" | ||
"github.com/cbergoon/pipes/pkg/dl" | ||
"github.com/pkg/errors" | ||
"io/ioutil" | ||
"log" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
func main() { | ||
|
||
flag.Usage = func() { | ||
fmt.Printf("[USAGE]: pdlc [-out-file|-minify-output] <in-file-name>\n") | ||
flag.PrintDefaults() | ||
} | ||
|
||
var optOutputFile string | ||
flag.StringVar(&optOutputFile, "out-file", "", "name of output file with extension") | ||
|
||
var optMinifyOutput bool | ||
flag.BoolVar(&optMinifyOutput, "minify-output", true, "minifies output file json contents") | ||
|
||
flag.Parse() | ||
|
||
args := flag.Args() | ||
|
||
if len(args) != 1 { | ||
flag.Usage() | ||
os.Exit(-1) | ||
} | ||
|
||
|
||
inFileName := args[0] | ||
|
||
source, err := ioutil.ReadFile(inFileName) | ||
if err != nil { | ||
log.Fatal(errors.Wrapf(err, "compile failed: could not read input file %s", inFileName)) | ||
} | ||
|
||
l := dl.NewLexer(string(source)) | ||
p := dl.NewParser(l) | ||
|
||
pd, err := p.ParseProgram() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
var definition []byte | ||
if optMinifyOutput { | ||
definition, err = json.Marshal(pd) | ||
if err != nil { | ||
log.Fatal(errors.Wrap(err, "compile failed: could not marshal definition")) | ||
} | ||
} else { | ||
definition, err = json.MarshalIndent(pd, "", " ") | ||
if err != nil { | ||
log.Fatal(errors.Wrap(err, "compile failed: could not marshal definition")) | ||
} | ||
} | ||
|
||
outFileName := "" | ||
if optOutputFile != "" { | ||
outFileName = optOutputFile | ||
}else{ | ||
outFileName = strings.TrimSuffix(inFileName, filepath.Ext(inFileName)) + ".cpdl" | ||
} | ||
|
||
err = ioutil.WriteFile(outFileName, definition, 0644) | ||
if err != nil { | ||
log.Fatal(errors.Wrapf(err, "compile failed: could not write output file %s", outFileName)) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"io/ioutil" | ||
"log" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
|
||
"github.com/cbergoon/pipes/pkg/dl" | ||
"github.com/pkg/errors" | ||
) | ||
|
||
func main() { | ||
|
||
flag.Usage = func() { | ||
fmt.Printf("[USAGE]: pdlrc [-out-file] <in-file-name>\n") | ||
flag.PrintDefaults() | ||
} | ||
|
||
var optOutputFile string | ||
flag.StringVar(&optOutputFile, "out-file", "", "name of output file with extension") | ||
|
||
flag.Parse() | ||
|
||
args := flag.Args() | ||
|
||
if len(args) != 1 { | ||
flag.Usage() | ||
os.Exit(-1) | ||
} | ||
|
||
inFileName := args[0] | ||
|
||
source, err := ioutil.ReadFile(inFileName) | ||
if err != nil { | ||
log.Fatal(errors.Wrapf(err, "reverse compile failed: could not read input file %s", inFileName)) | ||
} | ||
|
||
definition, err := dl.GenerateDLFromPipelineDefinitionJSON(source) | ||
if err != nil { | ||
log.Fatal(errors.Wrap(err, "reverse compile failed: failed to generate DL")) | ||
} | ||
|
||
outFileName := "" | ||
if optOutputFile != "" { | ||
outFileName = optOutputFile | ||
} else { | ||
outFileName = strings.TrimSuffix(inFileName, filepath.Ext(inFileName)) + ".pdl" | ||
} | ||
|
||
err = ioutil.WriteFile(outFileName, []byte(definition), 0644) | ||
if err != nil { | ||
log.Fatal(errors.Wrapf(err, "reverse compile failed: could not write output file %s", outFileName)) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/urfave/cli" | ||
) | ||
|
||
func main() { | ||
app := cli.NewApp() | ||
|
||
app.Version = "19.99.0" | ||
app.Name = "kənˈtrīv" | ||
app.HelpName = "contrive" | ||
|
||
app.Commands = []cli.Command{ | ||
{ | ||
Name: "add", | ||
Aliases: []string{"a"}, | ||
Usage: "add a task to the list", | ||
Flags: []cli.Flag{ | ||
cli.BoolFlag{Name: "forever, forevvarr"}, | ||
}, | ||
Action: func(c *cli.Context) error { | ||
fmt.Println("added task: ", c.Args().First(), c.Bool("forever")) | ||
return nil | ||
}, | ||
Before: func(c *cli.Context) error { | ||
fmt.Fprintf(c.App.Writer, "brace for impact\n") | ||
return nil | ||
}, | ||
After: func(c *cli.Context) error { | ||
fmt.Fprintf(c.App.Writer, "did we lose anyone?\n") | ||
return nil | ||
}, | ||
}, | ||
{ | ||
Name: "complete", | ||
Aliases: []string{"c"}, | ||
Usage: "complete a task on the list", | ||
Action: func(c *cli.Context) error { | ||
fmt.Println("completed task: ", c.Args().First()) | ||
return nil | ||
}, | ||
}, | ||
{ | ||
Name: "template", | ||
Aliases: []string{"t"}, | ||
Usage: "options for task templates", | ||
Subcommands: []cli.Command{ | ||
{ | ||
Name: "add", | ||
Usage: "add a new template", | ||
Action: func(c *cli.Context) error { | ||
fmt.Println("new task template: ", c.Args().First()) | ||
return nil | ||
}, | ||
}, | ||
{ | ||
Name: "remove", | ||
Usage: "remove an existing template", | ||
Action: func(c *cli.Context) error { | ||
fmt.Println("removed task template: ", c.Args().First()) | ||
return nil | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
err := app.Run(os.Args) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
### Pipes Documentation | ||
|
||
1. [Getting Started](http://github.com/cbergoon/pipes/docs/getting_started.md) | ||
2. [Overview](http://github.com/cbergoon/pipes/docs/overview.md) | ||
3. [Pipeline](http://github.com/cbergoon/pipes/docs/pipline.md) | ||
2. [Definition Language](http://github.com/cbergoon/pipes/docs/definition_language.md) | ||
2. [Worker Pool](http://github.com/cbergoon/pipes/docs/worker_pool.md) | ||
2. [CLI](http://github.com/cbergoon/pipes/docs/cli.md) | ||
2. [Daemon](http://github.com/cbergoon/pipes/docs/daemon.md) | ||
2. [Plugins](http://github.com/cbergoon/pipes/docs/plugins.md) |
Empty file.
Empty file.
Empty file.
Empty file.
File renamed without changes
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"pipeline":{"name":"MyPipeline"},"processes":[{"typeName":"Generator","processName":"Alfa","sink":false,"inputs":null,"outputs":["Out1","Out2"],"state":null},{"typeName":"DynamicJs","processName":"Beta","sink":false,"inputs":["In"],"outputs":["Out"],"state":{"gg":"kk","src":"o = {\n \"MyVal\": In1 + \"hello\" + In2\n };\n console.log(\"hellofrom js\");\n Out = JSON.stringify(o);"}}],"connections":[{"originProcessName":"Alfa","originPortName":"Out1","destinationProcessName":"Beta","destinationPortName":"In1"},{"originProcessName":"Alfa","originPortName":"Out2","destinationProcessName":"Beta","destinationPortName":"In2"},{"originProcessName":"Beta","originPortName":"Out","destinationProcessName":"Charlie","destinationPortName":"In"}]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CREATE PIPELINE "MyPipeline"; | ||
|
||
ADD "Alfa" OF "Generator" OUTPUTS = ("Out1", "Out2"); | ||
ADD "Beta" OF "DynamicJs" | ||
INPUTS = ("In1", "In2") | ||
OUTPUTS = ("Out") | ||
SET "src" = 'o = { | ||
"MyVal": In1 + "hello" + In2 | ||
}; | ||
console.log("hellofrom js"); | ||
Out = JSON.stringify(o);', | ||
"gg" = "kk"; | ||
ADD SINK "Charlie" OF "Printer" INPUTS = ("In"); | ||
|
||
CONNECT "Alfa":"Out1" TO "Beta":"In1"; | ||
CONNECT "Alfa":"Out2" TO "Beta":"In2"; | ||
CONNECT "Beta":"Out" TO "Charlie":"In"; |
Oops, something went wrong.