Skip to content

tt: added tt create module #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 8, 2022
Merged

Conversation

psergee
Copy link
Contributor

@psergee psergee commented Aug 16, 2022

tt create allows a user to create tarantool application from a template.
tt create accepts template name as a parameter and searches for it in

  templates:
    - path:
    - path:

of current environment. Found template will be used for application creation.
'basic' is the default template name.
Supported flags:

FLAGS
  -f, --force              Force rewrite application directory if already exists
  -h, --help               help for create
      --name string        Application name
  -s, --non-interactive    Non-interactive mode
      --var stringArray    Variable definition. Usage: --var var_name=value
      --vars-file string   Variables definition file path

Invocation example:
tt create --var name=name --name=app1 --non-interactive

Closes #12

@psergee psergee requested review from 0x501D, vr009 and LeonidVas August 16, 2022 07:14
Copy link
Contributor

@vr009 vr009 left a comment

Choose a reason for hiding this comment

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

The code looks good. It would be also nice to have some description how to use it for users, but I don'y know if we have some place to leave the instructions for this. I will leave more feedback for the code later.

@vr009
Copy link
Contributor

vr009 commented Aug 16, 2022

It is also accepted (here) to mark a commit with closes #N instead of resolves.

@psergee psergee force-pushed the psergee/gh-12-create-app-from-template branch from 4d2d31d to 6bce831 Compare August 16, 2022 11:33
@psergee
Copy link
Contributor Author

psergee commented Aug 17, 2022

The code looks good. It would be also nice to have some description how to use it for users, but I don'y know if we have some place to leave the instructions for this. I will leave more feedback for the code later.

Examples are added to the help:

EXAMPLES
  
# Create an application from basic template.

    $ tt create

# Create app1 application from cartridge template, set user_name value,
# force replacing of application directory (app1) if it exists. User interaction is disabled.

    $ tt create cartridge --name=app1 --var user_name=admin -f --non-interactive

@psergee psergee force-pushed the psergee/gh-12-create-app-from-template branch 5 times, most recently from 07cbb52 to 58babaa Compare August 22, 2022 09:23
@psergee psergee force-pushed the psergee/gh-12-create-app-from-template branch from 58babaa to 465b1a8 Compare August 23, 2022 15:20
Copy link
Member

@0x501D 0x501D left a comment

Choose a reason for hiding this comment

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

LGTM

@psergee psergee force-pushed the psergee/gh-12-create-app-from-template branch 2 times, most recently from 0804ea2 to b6e6214 Compare August 25, 2022 15:35
Copy link
Contributor

@vr009 vr009 left a comment

Choose a reason for hiding this comment

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

LGTM
upd. after rebase :)

@psergee psergee force-pushed the psergee/gh-12-create-app-from-template branch 2 times, most recently from 6547f5b to 8a0094d Compare August 26, 2022 09:46
Copy link
Contributor

@LeonidVas LeonidVas left a comment

Choose a reason for hiding this comment

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

Hi. I briefly reviewed the patch and plan to explore it further. The idea of using the "chain of responsibility" pattern looks interesting.
I have several comments:

  • "Update cartridge-cli submodule" -> "cartridge cli: bump new version".
  • It would be nice to add reasons to bump the new version to commit message. I think this was done not just for fun.

@psergee psergee force-pushed the psergee/gh-12-create-app-from-template branch 3 times, most recently from bb9c5b5 to b496f70 Compare September 1, 2022 13:16
Copy link
Contributor

@LeonidVas LeonidVas left a comment

Choose a reason for hiding this comment

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

Hi! Thank you for the patchset.
Patchset already has two LGTM so I did not see it in detail, rather an introductory one.
I expect the following PR with a description of the functionality in the README and with examples in https://github.com/tarantool/tt/blob/master/doc/examples.rst

Fix typos in code and comment -> Commit title should be of a form <subsystem>: <description> (https://github.com/tarantool/tarantool/wiki/Code-review-procedure#commit-message)

This is a big and good work, and I believe that in the future you will split the functionality into several commits. Right now it's very difficult to review.

See comments bellow (some of them may be irrelevant because your update happened in the middle of my review.).

@LeonidVas
Copy link
Contributor

Perhaps some of the questions are easier to discuss by voice. So ping if you need.

@psergee psergee force-pushed the psergee/gh-12-create-app-from-template branch from b496f70 to d5440fa Compare September 8, 2022 18:23
Added module allows a user to create tarantool application
from a template.
go text/template engine is used for template instantiation by default.

Closes #12
@psergee psergee force-pushed the psergee/gh-12-create-app-from-template branch from d5440fa to 46070a1 Compare September 8, 2022 18:35
@LeonidVas LeonidVas merged commit 91e2f42 into master Sep 8, 2022
@LeonidVas LeonidVas deleted the psergee/gh-12-create-app-from-template branch September 8, 2022 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tt create
4 participants