Skip to content
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

CLI: Implement init command #27423

Closed
3 tasks
Tracked by #27756
nollymar opened this issue Jan 24, 2024 · 6 comments · Fixed by #27557, #27696 or #27798
Closed
3 tasks
Tracked by #27756

CLI: Implement init command #27423

nollymar opened this issue Jan 24, 2024 · 6 comments · Fixed by #27557, #27696 or #27798

Comments

@nollymar
Copy link
Contributor

nollymar commented Jan 24, 2024

Parent Issue

No response

Task

The CLI should have an init command that makes the installation and configuration process smoother. So, the init should ask for:

  • An URL: the dotcms instance the user wants to connect to
  • User
  • Password

Using the information provided, the CLI should:

  • Create or update the .env file
  • Create the dot-service.yml (and the .dotcms folder if not exists)
    This code can be used as reference:
String homeDirectory = System.getProperty("user.home");
this.filePath = Paths.get(homeDirectory, ".dotcms", "folder", "myfile.txt");
Files.createDirectories(filePath.getParent());
try (BufferedWriter writer = Files.newBufferedWriter(filePath)) {
            writer.write(content);
}
  • Update the application.properties (if needed)
  • Configure any other setting required by the CLI to run properly
  • In case a user runs any command before running the init, the execution shouldn't fail with an error. The CLI should stop the execution with a warning saying that the init command should be run first.

Proposed Objective

Core Features

Proposed Priority

Priority 3 - Average

Acceptance Criteria

  • Implement an init command with the given details
  • Provide doc and update the CLI Quick Start
  • This issue should be solved with the implementation

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

@nollymar
Copy link
Contributor Author

Note to QA: when this task is implemented, please test this other card

@fabrizzio-dotCMS fabrizzio-dotCMS self-assigned this Jan 30, 2024
@fabrizzio-dotCMS fabrizzio-dotCMS moved this from Current Sprint Backlog to In Progress in dotCMS - Product Planning Jan 30, 2024
fabrizzio-dotCMS added a commit that referenced this issue Feb 2, 2024
fabrizzio-dotCMS added a commit that referenced this issue Feb 13, 2024
fabrizzio-dotCMS added a commit that referenced this issue Feb 15, 2024
fabrizzio-dotCMS added a commit that referenced this issue Feb 15, 2024
fabrizzio-dotCMS added a commit that referenced this issue Feb 15, 2024
fabrizzio-dotCMS added a commit that referenced this issue Feb 15, 2024
@nollymar nollymar moved this from In Progress to In Review in dotCMS - Product Planning Feb 16, 2024
@nollymar nollymar linked a pull request Feb 16, 2024 that will close this issue
github-merge-queue bot pushed a commit that referenced this issue Feb 16, 2024
* #27423 refactoring

* #27423 moving url into the yml file + checking confing always

* #27423 fix bug derived from the new url attribute moved to dot-service yml file

* #27423 init command

* #27423 Refactoring Prompt se we can muck inputs

* #27423 adding Test

* #27423 sonar feedback

* #27423 humor sonar

* #27423 cleaning import

* #27423 fix showing stack when -e is present and e is of type ExcecutionException

* #274223 remove unused import
@github-project-automation github-project-automation bot moved this from In Review to Done in dotCMS - Product Planning Feb 16, 2024
@fabrizzio-dotCMS fabrizzio-dotCMS moved this from Current Sprint Backlog to In Progress in dotCMS - Product Planning Feb 29, 2024
fabrizzio-dotCMS added a commit that referenced this issue Mar 1, 2024
fabrizzio-dotCMS added a commit that referenced this issue Mar 1, 2024
fabrizzio-dotCMS added a commit that referenced this issue Mar 1, 2024
fabrizzio-dotCMS added a commit that referenced this issue Mar 1, 2024
@fabrizzio-dotCMS fabrizzio-dotCMS linked a pull request Mar 1, 2024 that will close this issue
fabrizzio-dotCMS added a commit that referenced this issue Mar 2, 2024
@nollymar nollymar moved this from In Progress to In Review in dotCMS - Product Planning Mar 4, 2024
github-merge-queue bot pushed a commit that referenced this issue Mar 4, 2024
* #27423

* #27423 updating readme

* #27423 updating copy

* #27423 correctign copy

* #27423 fix test
@github-project-automation github-project-automation bot moved this from In Review to Done in dotCMS - Product Planning Mar 4, 2024
@nollymar nollymar reopened this Mar 4, 2024
@github-project-automation github-project-automation bot moved this from Done to Current Sprint Backlog in dotCMS - Product Planning Mar 4, 2024
@nollymar nollymar moved this from Current Sprint Backlog to Internal QA in dotCMS - Product Planning Mar 4, 2024
@dcolina dcolina self-assigned this Mar 7, 2024
@dcolina
Copy link
Contributor

dcolina commented Mar 8, 2024

Internal QA: Passed.

After the tests performed, it is observed that all the requirements of the task are met, among which we find

  • Creation of a configuration directory named .dotcms
  • The dot-service.yml file where the configuration is stored
  • The configuration can be updated through dotCLI
  • The corresponding documentation has been updated
  • If you try to run any command before configuring the CLI configuration, you will receive an error message indicating that you need to run the config command first.

Screenshot 2024-03-08 at 13 18 04

Screenshot 2024-03-08 at 13 15 25

@dcolina dcolina removed their assignment Mar 8, 2024
@dcolina dcolina closed this as completed Mar 8, 2024
@github-project-automation github-project-automation bot moved this from Internal QA to Done in dotCMS - Product Planning Mar 8, 2024
@dcolina dcolina moved this from Done to QA - Backlog in dotCMS - Product Planning Mar 8, 2024
@bryanboza
Copy link
Member

Fixed, tested using the latest CLI version on npm and it is working as expected

Image

@bryanboza bryanboza moved this from QA - Backlog to QA - In Progress in dotCMS - Product Planning Mar 8, 2024
@bryanboza bryanboza moved this from QA - In Progress to Done in dotCMS - Product Planning Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment