Beispiel #1
0
class Finish:
    body = Steps(
        Box("Thank You"),
        Echo(
            Text(
                "From all of us at r2c, thank you for trying Bento! We can’t wait to hear what you think.",
                processor=Processors.wrap(),
            )),
        Newline(),
        Echo(
            Multi(
                [
                    "Help and feedback: ",
                    Text("Reach out to us at ", style={"dim": True}),
                    "*****@*****.**",
                    Text(" or file an issue on ", style={"dim": True}),
                    "GitHub",
                    Text(". We’d love to hear from you!", style={"dim": True}),
                ],
                processor=Processors.wrap_link(
                    [
                        Link("*****@*****.**", "mailto:[email protected]"),
                        Link("GitHub",
                             "https://github.com/returntocorp/bento/issues"),
                    ],
                    extra=16,
                ),
            )),
        Newline(),
        Echo(
            Multi(
                [
                    "Community: ",
                    Text("Join ", style={"dim": True}),
                    "#bento",
                    Text(
                        " on our community Slack. Get support, talk with other users, and share feedback.",
                        style={"dim": True},
                    ),
                ],
                processor=Processors.wrap_link(
                    [
                        Link(
                            "#bento",
                            "https://join.slack.com/t/r2c-community/shared_invite/enQtNjU0NDYzMjAwODY4LWE3NTg1MGNhYTAwMzk5ZGRhMjQ2MzVhNGJiZjI1ZWQ0NjQ2YWI4ZGY3OGViMGJjNzA4ODQ3MjEzOWExNjZlNTA",
                        )
                    ],
                    extra=16,
                ),
            )),
        Newline(),
        Echo("Go forth and write great code! To use Bento:"),
        Echo(
            Multi([
                _step_item("commit code", "git commit"),
                _step_item("get help for a command",
                           "bento [COMMAND] --help",
                           nl=False),
            ])),
    )
Beispiel #2
0
class SuggestAutocomplete:
    confirm = Confirm(
        Text(
            "Bento supports tab autocompletion. Do you want to add it to your shell profile now?",
            processor=Processors.wrap(),
        ),
        options={"default": True},
    )
    install = Progress(
        content=Multi([
            "Adding autocompletion to ",
            Sub(0, style={
                "bold": True,
                "dim": True
            })
        ]),
        extra=12,
    )
    confirm_yes = Newline()
    confirm_no = Echo(
        Multi([
            "\nTo enable autocompletion later, run $ ",
            Text("bento enable autocomplete", style={"bold": True}),
            ".\n",
        ]))
Beispiel #3
0
class Install:
    learn_more = Text(
        "To learn more, see the README.",
        processor=Processors.wrap_link([
            Link(
                "README",
                "https://github.com/returntocorp/bento/blob/master/README.md#running-in-cicd",
            )
        ]),
    )

    banner = Steps(
        Echo(
            Multi(
                [
                    "Configuring a GitHub Action to automatically check your team's pull requests. ",
                    learn_more,
                ],
                processor=Processors.wrap(),
            )),
        Newline(),
    )

    progress = Progress(
        content=Multi([
            "Creating GitHub Action configuration at ",
            Sub(0, style={
                "bold": True,
                "dim": True
            }),
            Text("/", style={
                "bold": True,
                "dim": True
            }),
        ]),
        extra=24,
    )
    after_progress = Newline()

    finalize_ci = Steps(
        Warn("To finalize configuration of Bento's GitHub Action, please:"),
        Echo(
            Multi([
                "  $ git add .github/\n",
                '  $ git commit -m "Add Bento GitHub Action"\n',
                "  $ git push\n",
            ])),
    )
Beispiel #4
0
class UpdateEmail:
    leader = Steps(
        Echo(
            Multi(
                [
                    "Registration: ",
                    Text(
                        "We’ll use your email to provide support and share product updates. You can unsubscribe at "
                        "any time.",
                        style={"dim": True},
                    ),
                ],
                processor=Processors.wrap(extra=8),
            )
        ),
        Newline(),
    )
    prompt = Prompt("What is your email address?")
    failure = Steps(
        Newline(),
        Warn(
            "We were unable to subscribe you to the Bento mailing list (which means you may miss out on "
            "announcements!). Bento will continue running. Please shoot us a note via [email protected] to debug. "
        ),
    )
Beispiel #5
0
class UpdateGitignore:
    confirm = Confirm(
        content=Multi(
            [
                "Some Bento files should be excluded from version control. Should Bento append them to ",
                Sub(0, style={"bold": True}),
                "?",
            ],
            processor=Processors.wrap(),
        ),
        options={"default": True},
    )
    confirm_yes = Newline()
    confirm_no = Newline()
    update = Progress(
        content=Multi(["Updating ", Sub(0, style={"bold": True, "dim": True})]),
        extra=12,
    )
Beispiel #6
0
class InstallIgnore:
    install = Progress(
        content=Multi(
            [
                "Creating default ignore file at ",
                Sub(0, style={"bold": True, "dim": True}),
            ]
        ),
        extra=12,
    )
Beispiel #7
0
class InstallConfig:
    install = Progress(
        content=Multi(
            [
                "Creating default configuration at ",
                Sub(0, style={"bold": True, "dim": True}),
            ]
        ),
        extra=12,
    )
Beispiel #8
0
class Identify:
    success = Steps(
        Newline(),
        Echo(Multi(["Bento initialized for ",
                    Sub(0, style={"bold": True})])),
        Newline(),
    )
    failure = Steps(
        Newline(),
        Warn(
            "Bento can't automatically identify this project. Please manually configure this project:"
        ),
        Echo(
            Multi([
                _step_item("configure a tool manually",
                           "bento enable tool TOOL"),
                _step_item("list available tools", "bento enable tool --help"),
            ])),
    )
Beispiel #9
0
class ConfirmTos:
    fresh = Steps(
        Echo(
            Multi(
                [
                    "Privacy: ",
                    Text(
                        "We take privacy seriously. Bento runs exclusively on your computer. It will never send your "
                        "code anywhere.",
                        style={"dim": True},
                    ),
                ],
                processor=Processors.wrap(extra=8),
            )
        ),
        Newline(),
        Echo(
            Text(
                "We’re constantly looking to make Bento better. To that end, we collect limited usage and results "
                "data. To learn more, see bento.dev/privacy.",
                processor=Processors.wrap_link(
                    [Link("bento.dev/privacy", "https://bento.dev/privacy")]
                ),
                style={"dim": True},
            )
        ),
        Newline(),
    )

    invalid_version = Error(
        "~/.bento/config.yml is malformed. Please remove this file and re-run Bento. "
    )

    upgrade = Steps(
        Echo(
            Text(
                "We've made changes to our terms of service. Please review the new terms. If you have any questions "
                "or concerns please reach out via [email protected].",
                processor=Processors.wrap_link(
                    [Link("*****@*****.**", "mailto:[email protected]")]
                ),
                style={"dim": True},
            )
        ),
        Newline(),
    )

    prompt = Confirm(
        "Continue and agree to Bento's terms of service and privacy policy?",
        options={"default": True},
    )
    error = Error(
        "Bento did NOT install. Bento beta users must agree to the terms of service to continue. Please reach out to "
        "us at [email protected] with questions or concerns. "
    )
Beispiel #10
0
class InstallAutorun:
    install = Progress(
        Multi(
            [
                "Enabling autorun (see $ ",
                Text("bento enable autorun --help", style={"dim": True, "bold": True}),
                Text(")", style={"dim": True}),
            ]
        ),
        extra=20,
    )
Beispiel #11
0
def _step_item(desc: str, cmd: str, nl: bool = True) -> Content:
    """
    Echoes

      desc․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․ $ cmd

    with styling.

    If 'nl' is False, does not emit a newline at the end of the line
    """
    return Multi([
        "  ",
        Text(desc, processor=Processors.ljust(-40, "․"), style={"dim": True}),
        f" $ {cmd}\n",
    ])
Beispiel #12
0
class Overwrite:
    warn = Steps(
        Echo(
            Multi([
                "It seems Bento is already installed for GitHub Actions at ",
                Sub(0, style={"bold": True}),
            ])),
        Newline(),
        Warn("If you continue, Bento will revert any changes "
             "you might have made manually to this CI configuration file."),
        Newline(),
    )

    confirm = Confirm(
        "Do you want to revert Bento's GitHub Action to the default configuration?"
    )

    after_confirm = Newline()
Beispiel #13
0
class InstallCI:
    pitch = Steps(
        Echo(
            Multi(
                [
                    "Bento can configure a GitHub Action to automatically check your team's pull requests. ",
                    ci_content.Install.learn_more,
                ],
                processor=Processors.wrap(),
            )
        ),
        Newline(),
    )

    confirm = Confirm("Do you want to configure Bento's GitHub Action now?")
    after_confirm = Newline()

    progress = ci_content.Install.progress
    finalize_ci = ci_content.Install.finalize_ci