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

Add entry via stdin to the init command #426

Conversation

brunats
Copy link
Contributor

@brunats brunats commented Aug 13, 2020

- What I did
Add entry via stdin to the init command. - Also includes stdin tests for init - Updates tests from the init_test.go file to include stdin tests.

- How to verify it

Clone this pr with the command and build Ritchie

git fetch upstream pull/426/head:feature/add-entry-via-stdin-to-the-init-command
git checkout feature/add-entry-via-stdin-to-the-init-command
make build && sudo cp dist/linux/rit /usr/local/bin/

Run tests

make functional-test # Search for "Running STDIN: Init STDIN"
make unit-test # Search for "=== RUN   TestNewInitStdin"

- Description for the changelog

Add entry via stdin to the init command.

Signed-off-by: Bruna Tavares <silvatavares.bruna@gmail.com>
Signed-off-by: Bruna Tavares <silvatavares.bruna@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2020

Codecov Report

Merging #426 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #426   +/-   ##
=======================================
  Coverage   66.31%   66.31%           
=======================================
  Files          80       80           
  Lines        2779     2779           
=======================================
  Hits         1843     1843           
  Misses        749      749           
  Partials      187      187           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 835d5d4...2792307. Read the comment docs.

@brunasilvazup brunasilvazup linked an issue Aug 13, 2020 that may be closed by this pull request
@brunasilvazup brunasilvazup added 2.0.0 ✨ feature Suggest a new feature or enhancement to the Ritchie project 🚧 WIP Work in Progress labels Aug 13, 2020
@lucasdittrichzup
Copy link
Contributor

- What I did

- How to verify it

- Description for the changelog

I think you forgot to put the explanatory texts in the PR

@brunasilvazup
Copy link
Contributor

- What I did
- How to verify it
- Description for the changelog

I think you forgot to put the explanatory texts in the PR

Yes, I am still developing it, but I will remember to update the description.

Thanks (:

Signed-off-by: Bruna Tavares <silvatavares.bruna@gmail.com>
Signed-off-by: Bruna Tavares <silvatavares.bruna@gmail.com>
return func(cmd *cobra.Command, args []string) error {
init := initStdin{}

err := stdin.ReadJson(cmd.InOrStdin(), &init)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cmd.InOrStdin() returns os.Stdin() by default, so it continues with the normal behavior for use in production and we were able to mock it for testing.

}
}

func Test_initCmd_runAnyEntry(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did stdin's tests with cmd's, so we can cover the situations.

@brunasilvazup brunasilvazup added ✔️ ready-for-review ready for review and removed 🚧 WIP Work in Progress labels Aug 14, 2020
Copy link
Contributor

@victor-schumacher victor-schumacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

pkg/cmd/init.go Outdated Show resolved Hide resolved
Signed-off-by: Bruna Tavares <silvatavares.bruna@gmail.com>
…add-entry-via-stdin-to-the-init-command

Signed-off-by: Bruna Tavares <silvatavares.bruna@gmail.com>
@brunasilvazup
Copy link
Contributor

/merge qa

@ritchie-bot
Copy link
Contributor

ritchie-bot bot commented Aug 18, 2020

👌 Merged branch feature/add-entry-via-stdin-to-the-init-command into qa

Copy link
Contributor

@kaduartur kaduartur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@brunasilvazup brunasilvazup merged commit a5391e3 into ZupIT:master Aug 18, 2020
@brunats brunats deleted the feature/add-entry-via-stdin-to-the-init-command branch August 26, 2020 20:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✔️ ready-for-review ready for review ✨ feature Suggest a new feature or enhancement to the Ritchie project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add entry by stdin in the init command
6 participants