Skip to content

Commit

Permalink
Finish automating docs for odo init command reference
Browse files Browse the repository at this point in the history
Signed-off-by: Parthvi Vala <pvala@redhat.com>
  • Loading branch information
valaparthvi committed Dec 27, 2022
1 parent 67ef3b9 commit 3913bde
Show file tree
Hide file tree
Showing 14 changed files with 393 additions and 124 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```console
$ odo init --devfile nodejs-react --name my-nr-app
__
/ \__ Initializing a new component
\__/ \
/ \__/ odo version: v3.4.0
\__/

✓ Downloading devfile "nodejs-react" [3s]

Your new component 'my-nr-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```console
$ odo init --name my-spring-app --devfile java-springboot --devfile-registry DefaultDevfileRegistry --starter springbootproject

__
/ \__ Initializing a new component
\__/ \
/ \__/ odo version: v3.4.0
\__/

✓ Downloading devfile "java-springboot" from registry "DefaultDevfileRegistry" [4s]
✓ Downloading starter project "springbootproject" [874ms]

Your new component 'my-spring-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.

```
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ $ odo init --devfile-path https://registry.devfile.io/devfiles/nodejs-angular --
/ \__/ odo version: v3.4.0
\__/

✓ Downloading devfile from "https://registry.devfile.io/devfiles/nodejs-angular" [966ms]
✓ Downloading starter project "nodejs-angular-starter" [891ms]
✓ Downloading devfile from "https://registry.devfile.io/devfiles/nodejs-angular" [1s]
✓ Downloading starter project "nodejs-angular-starter" [958ms]

Your new component 'my-nodejs-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
```console
$ odo init
__
/ \__ Initializing a new component
\__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
/ \__/ odo version: v3.4.0
\__/

Interactive mode enabled, please answer the following questions:
Based on the files in the current directory odo detected
Language: JavaScript
Project type: Node.js
Application ports: 8080
The devfile "nodejs:2.1.1" from the registry "DefaultDevfileRegistry" will be downloaded.
? Is this correct? Yes
✓ Downloading devfile "nodejs:2.1.1" from registry "DefaultDevfileRegistry" [3s]

↪ Container Configuration "runtime":
OPEN PORTS:
- 8080
- 5858
ENVIRONMENT VARIABLES:
- DEBUG_PORT = 5858

? Select container for which you want to change configuration? NONE - configuration is correct
? Enter component name: node-echo

You can automate this command by executing:
odo init --name node-echo --devfile nodejs --devfile-registry DefaultDevfileRegistry --devfile-version 2.1.1

Your new component 'node-echo' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
```console
$ odo init
__
/ \__ Initializing a new component
\__/ \ Files: No source code detected, a starter project will be created in the current directory
/ \__/ odo version: v3.4.0
\__/

Interactive mode enabled, please answer the following questions:
? Select language: Java
? Select project type: Maven Java (java-maven, registry: DefaultDevfileRegistry)
✓ Downloading devfile "java-maven" from registry "DefaultDevfileRegistry" [4s]

↪ Container Configuration "tools":
OPEN PORTS:
- 8080
- 5858
ENVIRONMENT VARIABLES:
- DEBUG_PORT = 5858

? Select container for which you want to change configuration? NONE - configuration is correct
? Which starter project do you want to use? springbootproject
? Enter component name: my-java-maven-app
✓ Downloading starter project "springbootproject" [1s]

You can automate this command by executing:
odo init --name my-java-maven-app --devfile java-maven --devfile-registry DefaultDevfileRegistry --starter springbootproject

Your new component 'my-java-maven-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.

```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```console
$ odo init --devfile go --name my-go-app --devfile-version latest
$ odo init --devfile go --name my-go-app --devfile-version latest
__
/ \__ Initializing a new component
\__/ \
Expand All @@ -12,4 +12,5 @@ Your new component 'my-go-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
To deploy your component to a cluster use "odo deploy".

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```console
$ odo registry --devfile nodejs-react
NAME REGISTRY DESCRIPTION VERSIONS
nodejs-react StagingRegistry React is a free and open-source front-en... 2.0.2
nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2

```
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```console
$ odo preference view
[...]

Devfile registries:
NAME URL SECURE
StagingRegistry https://registry.stage.devfile.io No
DefaultDevfileRegistry https://registry.devfile.io No

```
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Your new component 'my-go-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
To deploy your component to a cluster use "odo deploy".

```
95 changes: 18 additions & 77 deletions docs/website/docs/command-reference/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ odo init
<details>
<summary>Example</summary>

import EmptyDirOutput from './docs-mdx/init/empty_directory_output.mdx';
import EmptyDirOutput from './docs-mdx/init/interactive_mode_empty_directory_output.mdx';

<EmptyDirOutput />

Expand Down Expand Up @@ -57,40 +57,9 @@ odo init
<details>
<summary>Example</summary>

```console
$ odo init
__
/ \__ Initializing a new component
\__/ \ Files: Source code detected, a Devfile will be determined based upon source code autodetection
/ \__/ odo version: v3.3.0
\__/
Interactive mode enabled, please answer the following questions:
Based on the files in the current directory odo detected
Language: JavaScript
Project type: Node.js
Application ports: 3000
The devfile "nodejs" from the registry "DefaultDevfileRegistry" will be downloaded.
? Is this correct? Yes
✓ Downloading devfile "nodejs" from registry "DefaultDevfileRegistry" [1s]
↪ Container Configuration "runtime":
OPEN PORTS:
- 5858
- 3000
ENVIRONMENT VARIABLES:
- DEBUG_PORT = 5858
? Select container for which you want to change configuration? NONE - configuration is correct
? Enter component name: nodejs
You can automate this command by executing:
odo init --name nodejs --devfile nodejs --devfile-registry DefaultDevfileRegistry

Your new component 'nodejs' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
```
import NonEmptyDirectoryOutput from './docs-mdx/init/interactive_mode_directory_with_sources_output.mdx'

<NonEmptyDirectoryOutput />
</details>

### Non-interactive mode
Expand All @@ -109,41 +78,23 @@ The required `--name` flag indicates how the component initialized by this comma

#### Fetch Devfile from any registry of the list

In this example, the devfile will be downloaded from the **Staging** registry, which is the first one in the list containing the `nodejs-react` devfile.
In this example, the devfile will be downloaded from the **StagingRegistry** registry, which is the first one in the list containing the `nodejs-react` devfile.
```shell
odo init --name <component-name> --devfile <devfile> [--starter STARTER]
```
<details>
<summary>Example</summary>

```console
$ odo preference view
[...]

Devfile registries:
NAME URL SECURE
Staging https://registry.stage.devfile.io No
DefaultDevfileRegistry https://registry.devfile.io No
<RegistryOutput />

$ odo registry --devfile nodejs-react
NAME REGISTRY DESCRIPTION VERSIONS
nodejs-react StagingRegistry React is a free and open-source front-en... 2.0.2
nodejs-react DefaultDevfileRegistry React is a free and open-source front-en... 2.0.2
import RegistryListOutput from './docs-mdx/init/registry_list_output.mdx'

$ odo init --devfile nodejs-react --name my-nr-app
__
/ \__ Initializing a new component
\__/ \
/ \__/ odo version: v3.4.0
\__/
<RegistryListOutput />

✓ Downloading devfile "nodejs-react" [3s]
import DevfileFromAnyRegistryOutput from './docs-mdx/init/devfile_from_any_registry_output.mdx'

Your new component 'my-nr-app' is ready in the current directory.
To start editing your component, use 'odo dev' and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
<DevfileFromAnyRegistryOutput />

```
</details>


Expand All @@ -153,24 +104,14 @@ In this example, the devfile will be downloaded from the **DefaultDevfileRegistr
<details>
<summary>Example</summary>

```console
$ odo preference view
[...]

Devfile registries:
NAME URL SECURE
Staging https://registry.stage.devfile.io No
DefaultDevfileRegistry https://registry.devfile.io No

$ odo init --name my-spring-app --devfile java-springboot --devfile-registry DefaultDevfileRegistry --starter springbootproject
✓ Downloading devfile "java-springboot" from registry "DefaultDevfileRegistry" [980ms]
✓ Downloading starter project "springbootproject" [399ms]

Your new component "my-spring-app" is ready in the current directory.
To start editing your component, use "odo dev" and open this folder in your favorite IDE.
Changes will be directly reflected on the cluster.
To deploy your component to a cluster use "odo deploy".
```
import RegistryOutput from './docs-mdx/init/registry_output.mdx'

<RegistryOutput />

import DevfileFromSpecificRegistryOutput from './docs-mdx/init/devfile_from_specific_registry_output.mdx';

<DevfileFromSpecificRegistryOutput />

</details>


Expand Down
Loading

0 comments on commit 3913bde

Please sign in to comment.