Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
Fix templates outputs (#281)
Browse files Browse the repository at this point in the history
* Fix template output

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Fix python output

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Update config.json Template Node Js

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Fix output template node

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Fix output template node

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Fix output template powershell

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Fix output template shell-bat

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Fix output template go

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Fix outputs all templates

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>

* Fix outputs tempalte powershell

Signed-off-by: Fabiano Chiareto Fernandes <fabiano.fernandes@zup.com.br>
  • Loading branch information
fabianofernandeszup authored Oct 16, 2020
1 parent b854bdf commit 46272c7
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 54 deletions.
10 changes: 5 additions & 5 deletions templates/create_formula/languages/csharp/src/formula/formula.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("Ive already created formulas using Ritchie.");
Console.WriteLine("I've already created formulas using Ritchie.");
} else {
Console.WriteLine("Im 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("Ive 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("Im 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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("Ive 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"))
}(),
Expand All @@ -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("Im 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"))
}(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("Ive 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("Im 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void runTrueInput() {

assertEquals("Hello World!\n" +
"\u001B[32mMy name is Hello.\u001B[39m\n" +
"\u001B[36mIve 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());
}
Expand All @@ -41,7 +41,7 @@ public void runFalseInput() {

assertEquals("Hello World!\n" +
"\u001B[32mMy name is Hello.\u001B[39m\n" +
"\u001B[31mIm 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());
}
Expand All @@ -52,7 +52,7 @@ public void runNoSecresInput() {

assertEquals("Hello World!\n" +
"\u001B[32mMy name is Hello.\u001B[39m\n" +
"\u001B[31mIm 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());
}
Expand Down
47 changes: 27 additions & 20 deletions templates/create_formula/languages/node/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
10 changes: 5 additions & 5 deletions templates/create_formula/languages/node/src/formula/formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
?>
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
4 changes: 2 additions & 2 deletions templates/create_formula/languages/python3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!("{}", "Ive already created formulas using Ritchie.".red())
println!("{}", "I've already created formulas using Ritchie.".red())
} else {
println!(
"{}",
"Im excited in creating new formulas using Ritchie.".red()
"I'm excited in creating new formulas using Ritchie.".red()
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.`))
Expand Down

0 comments on commit 46272c7

Please sign in to comment.