From 46272c77798d60f289a30f8f3b295230614306ef Mon Sep 17 00:00:00 2001 From: Fabiano Chiaretto Fernandes <58859234+fabianofernandeszup@users.noreply.github.com> Date: Fri, 16 Oct 2020 15:01:58 -0300 Subject: [PATCH] Fix templates outputs (#281) * Fix template output Signed-off-by: Fabiano Chiareto Fernandes * Fix python output Signed-off-by: Fabiano Chiareto Fernandes * Update config.json Template Node Js Signed-off-by: Fabiano Chiareto Fernandes * Fix output template node Signed-off-by: Fabiano Chiareto Fernandes * Fix output template node Signed-off-by: Fabiano Chiareto Fernandes * Fix output template powershell Signed-off-by: Fabiano Chiareto Fernandes * Fix output template shell-bat Signed-off-by: Fabiano Chiareto Fernandes * Fix output template go Signed-off-by: Fabiano Chiareto Fernandes * Fix outputs all templates Signed-off-by: Fabiano Chiareto Fernandes * Fix outputs tempalte powershell Signed-off-by: Fabiano Chiareto Fernandes --- .../languages/csharp/src/formula/formula.cs | 10 ++-- .../languages/go/src/pkg/formula/formula.go | 6 +-- .../go/src/pkg/formula/formula_test.go | 4 +- .../java/com/ritchie/formula/Formula.java | 4 +- .../java/com/ritchie/formula/FormulaTest.java | 6 +-- .../create_formula/languages/node/config.json | 47 +++++++++++-------- .../languages/node/src/formula/formula.js | 10 ++-- .../languages/php/src/formula/formula.php | 8 ++-- .../powershell/src/formula/formula.ps1 | 6 +-- .../create_formula/languages/python3/Makefile | 4 +- .../languages/rust/src/src/formula/mod.rs | 4 +- .../shell-bat/src/unix/formula/formula.sh | 2 +- .../typescript/src/formula/Formula.ts | 4 +- 13 files changed, 61 insertions(+), 54 deletions(-) diff --git a/templates/create_formula/languages/csharp/src/formula/formula.cs b/templates/create_formula/languages/csharp/src/formula/formula.cs index fb9adc23..2f084c2a 100644 --- a/templates/create_formula/languages/csharp/src/formula/formula.cs +++ b/templates/create_formula/languages/csharp/src/formula/formula.cs @@ -17,17 +17,17 @@ public Hello(string intext, string inlist, string inbool, string insecret) Console.WriteLine("Hello World!"); Console.ForegroundColor = ConsoleColor.Green; - Console.WriteLine($"My name is {input1}"); + Console.WriteLine($"My name is {input1}."); Console.ForegroundColor = ConsoleColor.Blue; if (input3 == "true") { - Console.WriteLine("I’ve already created formulas using Ritchie."); + Console.WriteLine("I've already created formulas using Ritchie."); } else { - Console.WriteLine("I’m excited in creating new formulas using Ritchie."); + Console.WriteLine("I'm excited in creating new formulas using Ritchie."); } Console.ForegroundColor = ConsoleColor.Yellow; - Console.WriteLine($"Today, I want to automate {input2}"); + Console.WriteLine($"Today, I want to automate {input2}."); Console.ForegroundColor = ConsoleColor.Cyan; - Console.WriteLine($"My secret is {input4}"); + Console.WriteLine($"My secret is {input4}."); Console.ResetColor(); } diff --git a/templates/create_formula/languages/go/src/pkg/formula/formula.go b/templates/create_formula/languages/go/src/pkg/formula/formula.go index 0e74a9b2..8057fc0a 100644 --- a/templates/create_formula/languages/go/src/pkg/formula/formula.go +++ b/templates/create_formula/languages/go/src/pkg/formula/formula.go @@ -20,14 +20,14 @@ type Formula struct { func (f Formula) Run(writer io.Writer) { var result string - result += fmt.Sprintf("Hello world!\n") + result += fmt.Sprintf("Hello World!\n") result += color.FgGreen.Render(fmt.Sprintf("My name is %s.\n", f.Text)) if f.Boolean { - result += color.FgBlue.Render(fmt.Sprintln("I’ve already created formulas using Ritchie.")) + result += color.FgBlue.Render(fmt.Sprintln("I've already created formulas using Ritchie.")) } else { - result += color.FgRed.Render(fmt.Sprintln("I’m excited in creating new formulas using Ritchie.")) + result += color.FgRed.Render(fmt.Sprintln("I'm excited in creating new formulas using Ritchie.")) } result += color.FgYellow.Render(fmt.Sprintf("Today, I want to automate %s.\n", f.List)) diff --git a/templates/create_formula/languages/go/src/pkg/formula/formula_test.go b/templates/create_formula/languages/go/src/pkg/formula/formula_test.go index eba886d7..3f170e6d 100644 --- a/templates/create_formula/languages/go/src/pkg/formula/formula_test.go +++ b/templates/create_formula/languages/go/src/pkg/formula/formula_test.go @@ -31,7 +31,7 @@ func TestFormula_Run(t *testing.T) { wantWriter: func() string { return fmt.Sprintf("Hello world!\n") + color.FgGreen.Render(fmt.Sprintf("My name is Dennis.\n")) + - color.FgBlue.Render(fmt.Sprintln("I’ve already created formulas using Ritchie.")) + + color.FgBlue.Render(fmt.Sprintln("I've already created formulas using Ritchie.")) + color.FgYellow.Render(fmt.Sprintf("Today, I want to automate everything.\n")) + color.FgCyan.Render(fmt.Sprintf("My secret is Ritchie.\n")) }(), @@ -47,7 +47,7 @@ func TestFormula_Run(t *testing.T) { wantWriter: func() string { return fmt.Sprintf("Hello world!\n") + color.FgGreen.Render(fmt.Sprintf("My name is Dennis.\n")) + - color.FgBlue.Render(fmt.Sprintln("I’m excited in creating new formulas using Ritchie.")) + + color.FgBlue.Render(fmt.Sprintln("I'm excited in creating new formulas using Ritchie.")) + color.FgYellow.Render(fmt.Sprintf("Today, I want to automate everything.\n")) + color.FgCyan.Render(fmt.Sprintf("My secret is Ritchie.\n")) }(), diff --git a/templates/create_formula/languages/java8/src/main/java/com/ritchie/formula/Formula.java b/templates/create_formula/languages/java8/src/main/java/com/ritchie/formula/Formula.java index 19c3907f..f029e1b2 100644 --- a/templates/create_formula/languages/java8/src/main/java/com/ritchie/formula/Formula.java +++ b/templates/create_formula/languages/java8/src/main/java/com/ritchie/formula/Formula.java @@ -22,9 +22,9 @@ public void Run() { System.out.println(Chalk.on(String.format("My name is %s.", inputText)).green()); if (inputBoolean) { - System.out.println(Chalk.on("I’ve already created formulas using Ritchie.").cyan()); + System.out.println(Chalk.on("I've already created formulas using Ritchie.").cyan()); } else { - System.out.println(Chalk.on("I’m excited in creating new formulas using Ritchie.").red()); + System.out.println(Chalk.on("I'm excited in creating new formulas using Ritchie.").red()); } System.out.println(Chalk.on(String.format("Today, I want to automate %s.", inputList)).yellow()); diff --git a/templates/create_formula/languages/java8/src/test/java/com/ritchie/formula/FormulaTest.java b/templates/create_formula/languages/java8/src/test/java/com/ritchie/formula/FormulaTest.java index 8e06f433..6f840055 100644 --- a/templates/create_formula/languages/java8/src/test/java/com/ritchie/formula/FormulaTest.java +++ b/templates/create_formula/languages/java8/src/test/java/com/ritchie/formula/FormulaTest.java @@ -30,7 +30,7 @@ public void runTrueInput() { assertEquals("Hello World!\n" + "\u001B[32mMy name is Hello.\u001B[39m\n" + - "\u001B[36mI’ve already created formulas using Ritchie.\u001B[39m\n" + + "\u001B[36mI've already created formulas using Ritchie.\u001B[39m\n" + "\u001B[33mToday, I want to automate world.\u001B[39m\n" + "\u001B[35mMy secret is pass.\u001B[39m\n", outContent.toString()); } @@ -41,7 +41,7 @@ public void runFalseInput() { assertEquals("Hello World!\n" + "\u001B[32mMy name is Hello.\u001B[39m\n" + - "\u001B[31mI’m excited in creating new formulas using Ritchie.\u001B[39m\n" + + "\u001B[31mI'm excited in creating new formulas using Ritchie.\u001B[39m\n" + "\u001B[33mToday, I want to automate world.\u001B[39m\n" + "\u001B[35mMy secret is pass.\u001B[39m\n", outContent.toString()); } @@ -52,7 +52,7 @@ public void runNoSecresInput() { assertEquals("Hello World!\n" + "\u001B[32mMy name is Hello.\u001B[39m\n" + - "\u001B[31mI’m excited in creating new formulas using Ritchie.\u001B[39m\n" + + "\u001B[31mI'm excited in creating new formulas using Ritchie.\u001B[39m\n" + "\u001B[33mToday, I want to automate world.\u001B[39m\n" + "\u001B[35mMy secret is .\u001B[39m\n", outContent.toString()); } diff --git a/templates/create_formula/languages/node/config.json b/templates/create_formula/languages/node/config.json index aaae50d0..2cf98bea 100644 --- a/templates/create_formula/languages/node/config.json +++ b/templates/create_formula/languages/node/config.json @@ -5,39 +5,46 @@ "cache": { "active": true, "newLabel": "Type new value. ", - "qty": 6 + "qty": 3 }, - "label": "Type : ", - "name": "sample_text", + "label": "Type your name: ", + "name": "input_text", "type": "text", - "tutorial": "Add a text for this field.", + "tutorial": "Your prefer name", "required": true }, { - "default": "in1", + "default": "false", "items": [ - "in_list1", - "in_list2", - "in_list3", - "in_listN" + "false", + "true" ], - "label": "Pick your : ", - "name": "sample_list", - "type": "text", - "tutorial": "Select an item for this field.", + "label": "Have you ever used Ritchie? ", + "name": "input_boolean", + "type": "bool", + "tutorial": "Choose one option", "required": false }, { - "default": "false", + "default": "everything", "items": [ - "false", - "true" + "daily tasks", + "workflows", + "toils", + "everything" ], - "label": "Pick: ", - "name": "sample_bool", - "type": "bool", - "tutorial": "Select true or false for this field.", + "label": "What do you want to automate? ", + "name": "input_list", + "type": "text", + "tutorial": "Select what you want to automate with Ritchie", "required": false + }, + { + "label": "Tell us a secret: ", + "name": "input_password", + "type": "password", + "tutorial": "Type a secret", + "required": true } ] } \ No newline at end of file diff --git a/templates/create_formula/languages/node/src/formula/formula.js b/templates/create_formula/languages/node/src/formula/formula.js index 8ef82d91..b25219f6 100644 --- a/templates/create_formula/languages/node/src/formula/formula.js +++ b/templates/create_formula/languages/node/src/formula/formula.js @@ -2,14 +2,14 @@ const clc = require("cli-color") function Run(inputText, inputBoolean, inputList, inputPassword) { console.log("Hello World!") - console.log(clc.green("My name is "+ inputText )); + console.log(clc.green("My name is "+ inputText +".")) if(inputBoolean){ - console.log(clc.blue('I’ve already created formulas using Ritchie.')); + console.log(clc.blue("I've already created formulas using Ritchie.")) } else { - console.log(clc.red('I’m excited in creating new formulas using Ritchie.')); + console.log(clc.red("I'm excited in creating new formulas using Ritchie.")) } - console.log(clc.yellow("Today, I want to automate "+ inputList)); - console.log(clc.cyan("My secret is " + inputPassword)); + console.log(clc.yellow("Today, I want to automate "+ inputList +".")) + console.log(clc.cyan("My secret is " + inputPassword +".")) } const formula = Run diff --git a/templates/create_formula/languages/php/src/formula/formula.php b/templates/create_formula/languages/php/src/formula/formula.php index 761a9b80..5ddc1b19 100644 --- a/templates/create_formula/languages/php/src/formula/formula.php +++ b/templates/create_formula/languages/php/src/formula/formula.php @@ -2,9 +2,9 @@ use Codedungeon\PHPCliColors\Color; function Run($input1, $input2, $input3) { - echo "Hello World! \n"; - echo Color::GREEN, "You receive $input1 in text. \n"; - echo Color::RED, "You receive $input2 in list. \n"; - echo Color::BLUE, "You receive $input3 in boolean. \n"; + echo "Hello World!\n"; + echo Color::GREEN, "You receive $input1 in text.\n"; + echo Color::RED, "You receive $input2 in list.\n"; + echo Color::BLUE, "You receive $input3 in boolean.\n"; } ?> diff --git a/templates/create_formula/languages/powershell/src/formula/formula.ps1 b/templates/create_formula/languages/powershell/src/formula/formula.ps1 index 86b23866..9680ec06 100644 --- a/templates/create_formula/languages/powershell/src/formula/formula.ps1 +++ b/templates/create_formula/languages/powershell/src/formula/formula.ps1 @@ -3,8 +3,8 @@ Function runFormula () { $sample_list = $env:SAMPLE_LIST $sample_bool = $env:SAMPLE_BOOL - Write-Host "Hello, World!" + Write-Host "Hello World!" Write-Host "You receive $sample_text in text." - Write-Host "You receive $sample_list in list. " - Write-Host "You receive $sample_bool in boolean. " + Write-Host "You receive $sample_list in list." + Write-Host "You receive $sample_bool in boolean." } diff --git a/templates/create_formula/languages/python3/Makefile b/templates/create_formula/languages/python3/Makefile index b2f3d3ad..5623a112 100644 --- a/templates/create_formula/languages/python3/Makefile +++ b/templates/create_formula/languages/python3/Makefile @@ -9,12 +9,12 @@ build: python-build sh_unix bat_windows docker python-build: mkdir -p $(BIN_FOLDER) cp -r src/* $(BIN_FOLDER) - pip3 install -r $(BIN_FOLDER)/requirements.txt --user + pip3 install -r $(BIN_FOLDER)/requirements.txt --user --disable-pip-version-check sh_unix: echo '#!/bin/bash' > $(BIN_FOLDER)/$(BINARY_NAME) echo 'if [ -f /.dockerenv ] ; then' >> $(BIN_FOLDER)/$(BINARY_NAME) - echo 'pip3 install -r "$$(dirname "$$0")"/requirements.txt --user >> /dev/null' >> $(BIN_FOLDER)/$(BINARY_NAME) + echo 'pip3 install -r "$$(dirname "$$0")"/requirements.txt --user --disable-pip-version-check >> /dev/null' >> $(BIN_FOLDER)/$(BINARY_NAME) echo 'fi' >> $(BIN_FOLDER)/$(BINARY_NAME) echo 'python3 "$$(dirname "$$0")"/main.py' >> $(BIN_FOLDER)/$(BINARY_NAME) chmod +x $(BIN_FOLDER)/$(BINARY_NAME) diff --git a/templates/create_formula/languages/rust/src/src/formula/mod.rs b/templates/create_formula/languages/rust/src/src/formula/mod.rs index 78aa5a69..3c7c74e2 100755 --- a/templates/create_formula/languages/rust/src/src/formula/mod.rs +++ b/templates/create_formula/languages/rust/src/src/formula/mod.rs @@ -5,11 +5,11 @@ pub fn run(input_text: String, input_bool: bool, input_list: String, input_passw println!("{}", format!("My name is {}.", input_text).green()); if input_bool { - println!("{}", "I’ve already created formulas using Ritchie.".red()) + println!("{}", "I've already created formulas using Ritchie.".red()) } else { println!( "{}", - "I’m excited in creating new formulas using Ritchie.".red() + "I'm excited in creating new formulas using Ritchie.".red() ) } diff --git a/templates/create_formula/languages/shell-bat/src/unix/formula/formula.sh b/templates/create_formula/languages/shell-bat/src/unix/formula/formula.sh index e5a95326..4c537b8b 100644 --- a/templates/create_formula/languages/shell-bat/src/unix/formula/formula.sh +++ b/templates/create_formula/languages/shell-bat/src/unix/formula/formula.sh @@ -1,7 +1,7 @@ #!/bin/sh runFormula() { - echo "Hello World! " + echo "Hello World!" echoColor "green" "My name is $INPUT_TEXT." if [ "$INPUT_BOOLEAN" = "true" ]; then diff --git a/templates/create_formula/languages/typescript/src/formula/Formula.ts b/templates/create_formula/languages/typescript/src/formula/Formula.ts index 90f7a426..af40a1b5 100644 --- a/templates/create_formula/languages/typescript/src/formula/Formula.ts +++ b/templates/create_formula/languages/typescript/src/formula/Formula.ts @@ -6,9 +6,9 @@ function run(inputText: string, inputBoolean: boolean, inputList: string, inputP console.log(chalk.green(`My name is ${inputText}.`)) if (inputBoolean) { - console.log(chalk.blue('I’ve already created formulas using Ritchie.')) + console.log(chalk.blue(`I've already created formulas using Ritchie.`)) } else { - console.log(chalk.red('I’m excited in creating new formulas using Ritchie.')) + console.log(chalk.red(`I'm excited in creating new formulas using Ritchie.`)) } console.log(chalk.yellow(`Today, I want to automate ${inputList}.`))