Skip to content

Commit

Permalink
refactor(commands): remove create commands
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

After this, the `create project` and `create module` commands will no
longer be available. We're removing them for now because currently
they're more confusing than they are useful. There's an open Github
issue (#312) for properly implementing the "create" functionality.
  • Loading branch information
eysi09 committed Feb 1, 2019
1 parent b61e917 commit 88d18d8
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 1,111 deletions.
62 changes: 0 additions & 62 deletions docs/reference/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,68 +75,6 @@ Note: Currently only supports simple GET requests for HTTP/HTTPS ingresses.
| -------- | -------- | ----------- |
| `serviceAndPath` | Yes | The name of the service to call followed by the ingress path (e.g. my-container/somepath).

### garden create project

Creates a new Garden project.

Walks the user through setting up a new Garden project and
generates scaffolding based on user input.

Examples:

garden create project # creates a new Garden project in the current directory (project name defaults to
directory name)
garden create project my-project # creates a new Garden project in my-project directory
garden create project --module-dirs=path/to/modules-a,path/to/modules-b
# creates a new Garden project and looks for pre-existing modules in the modules-a and modules-b directories
garden create project --name my-project
# creates a new Garden project in the current directory and names it my-project

##### Usage

garden create project [project-dir] [options]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `project-dir` | No | Directory of the project (defaults to current directory).

##### Options

| Argument | Alias | Type | Description |
| -------- | ----- | ---- | ----------- |
| `--module-dirs` | | array:path | Relative path to modules directory. Use comma as a separator to specify multiple directories.
| `--name` | | string | Assigns a custom name to the project (defaults to name of the current directory).

### garden create module

Creates a new Garden module.

Examples:

garden create module # creates a new module in the current directory (module name defaults to directory name)
garden create module my-module # creates a new module in my-module directory
garden create module --type=container # creates a new container module
garden create module --name=my-module # creates a new module in current directory and names it my-module

##### Usage

garden create module [module-dir] [options]

##### Arguments

| Argument | Required | Description |
| -------- | -------- | ----------- |
| `module-dir` | No | Directory of the module (defaults to current directory).

##### Options

| Argument | Alias | Type | Description |
| -------- | ----- | ---- | ----------- |
| `--name` | | string | Assigns a custom name to the module (defaults to name of the current directory)
| `--type` | | `container` `google-cloud-function` `npm-package` | Type of module.

### garden delete secret

Delete a secret from the environment.
Expand Down
58 changes: 28 additions & 30 deletions docs/using-garden/features-and-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,38 @@ Now that you've had a glimpse of the basic Garden commands in the [Quick Start](

## Starting a new project

There are two ways to start a new project with Garden:
To start a new project, you create a `garden.yml` file in the project's root directory. At it's simplest, the project level `garden.yml` file looks something like this:

- You can create all the configuration files by hand. For that that you should take a look at our [Configuration files](./configuration-files.md) document.
- Or you can use the `garden create` command—often a lot easier.

### `garden create`

The `garden create` command can be used to create either whole projects, or just modules. Essentially what it does is help you create configuration files so you don't have to do it by hand.

The command `garden create project` will create a new project in the current directory and prompt you to add modules to it, which should each have a name and a type. It will then create the appropriate folders and the configuration files within them.

If this is a pre-existing project and you want to "gardenify" code that's already there, you can try, for example, `garden create project --module-dirs=./services`. This will prompt you to create configuration files for every subfolder within the `./services` directory.
```yaml
# examples/simple-project/garden.yml
project:
name: simple-project
environments:
- name: local
providers:
- name: local-kubernetes
```

To add individual modules later on you can use `garden create module`.
You then add a `garden.yml` file at the root directory of every module in your project. Normally, a module is a single container or a single serverless function. A module level `garden.yml` file looks something like this:

```yaml
# examples/simple-project/services/go-service/garden.yml
module:
name: go-service
description: Go service container
type: container
services:
- name: go-service
ports:
- name: http
containerPort: 8080
servicePort: 80
ingresses:
- path: /hello-go
port: http
```
➜ test-project g create project
Initializing new Garden project test-project
---------
? Would you like to add a module to your project? Yes
? Enter module name my-module
? Module type container
? Add another module? (current modules: my-module) Yes
? Enter module name my-module-2
? Module type container
? Add another module? (current modules: my-module, my-module-2) No
---------
✔ Setting up project
✔ Writing config for my-module
✔ Writing config for my-module-2
✔ Writing config for test-project
Project created! Be sure to check out our docs for how to get sarted!
```

To learn more about how to configure a Garden project, please take a look at our [Configuration files](./configuration-files.md) document.

For a practical example of "gardenifying" an existing project, check out the [Simple project](../examples/simple-project.md) example.

Expand Down
2 changes: 0 additions & 2 deletions garden-service/src/commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import { Command } from "./base"
import { BuildCommand } from "./build"
import { CreateCommand } from "./create/create"
import { CallCommand } from "./call"
import { InitCommand } from "./init"
import { DeleteCommand } from "./delete"
Expand All @@ -32,7 +31,6 @@ import { VersionCommand } from "./version"
export const coreCommands: Command[] = [
new BuildCommand(),
new CallCommand(),
new CreateCommand(),
new DeleteCommand(),
new DeployCommand(),
new DevCommand(),
Expand Down
106 changes: 0 additions & 106 deletions garden-service/src/commands/create/config-templates.ts

This file was deleted.

25 changes: 0 additions & 25 deletions garden-service/src/commands/create/create.ts

This file was deleted.

52 changes: 0 additions & 52 deletions garden-service/src/commands/create/helpers.ts

This file was deleted.

0 comments on commit 88d18d8

Please sign in to comment.