Skip to content

Commit 2dd07a8

Browse files
authored
Merge pull request #495 from kool-dev/docs
Cloud Documentation
2 parents a65fdd9 + c18c3cf commit 2dd07a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+711
-259
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
**Kool** is a CLI tool that brings the complexities of modern software development environments down to earth - making these environments lightweight, fast and reproducible. It reduces the complexity and learning curve of _Docker_ containers for local environments, and offers a simplified interface for using _Kubernetes_ to deploy staging and production environments to the cloud.
1717

18-
**Kool** gets your local development environment up and running easily and quickly, so you have more time to build a great application. When the time is right, you can then use Kool Cloud to deploy and share your work with the world!
18+
**Kool** gets your local development environment up and running easily and quickly, so you have more time to build a great application. When the time is right, you can then use Kool.dev Cloud to deploy and share your work with the world!
1919

2020
**Kool** is suitable for solo developers and teams of all sizes. It provides a hassle-free way to handle the Docker basics and immediately start using containers for development, while simultaneously guaranteeing no loss of control over more specialized Docker environments.
2121

@@ -49,18 +49,18 @@ To help you start building real-world applications, we've created Kool Presets a
4949

5050
#### Popular stacks and frameworks
5151

52-
- **Node**: [NestJS](docs/2-Presets/NestJS.md), [AdonisJs](docs/2-Presets/AdonisJs.md), [Express.js](/docs/2-Presets/ExpressJS.md)
53-
- **PHP**: [Laravel](docs/2-Presets/Laravel.md), [Laravel Octane](docs/2-Presets/Laravel+Octane.md), [Symfony](docs/2-Presets/Symfony.md), [CodeIgniter](docs/2-Presets/CodeIgniter.md)
54-
- **Javascript**: [Next.js](docs/2-Presets/NextJS.md), [NuxtJS](docs/2-Presets/NuxtJS.md)
55-
- **Others**: [Hugo](docs/2-Presets/Hugo.md), [WordPress](docs/2-Presets/WordPress.md)
52+
- **Node**: [NestJS](docs/03-Presets/NestJS.md), [AdonisJs](docs/03-Presets/AdonisJs.md), [Express.js](/docs/03-Presets/ExpressJS.md)
53+
- **PHP**: [Laravel](docs/03-Presets/Laravel.md), [Laravel Octane](docs/03-Presets/Laravel+Octane.md), [Symfony](docs/03-Presets/Symfony.md), [CodeIgniter](docs/03-Presets/CodeIgniter.md)
54+
- **Javascript**: [Next.js](docs/03-Presets/NextJS.md), [NuxtJS](docs/03-Presets/NuxtJS.md)
55+
- **Others**: [Hugo](docs/03-Presets/Hugo.md), [WordPress](docs/03-Presets/WordPress.md)
5656

5757
#### Monorepo structures
5858

5959
It's a common challange mixing up different frameworks for the frontned and a backend API. Working with containers and having them both working an communicating properly can be a huge differential for good development experience and productivity.
6060

6161
Check out our pre-shaped [mono-repo structures](https://monorepo.tools/#what-is-a-monorepo) in a single preset:
6262

63-
- [Monorepo NestJS + Next.js](docs/2-Presets/2-Monorepo-NestJS-with-NextJS.md) with Typescript on both the frontend and the backend.
63+
- [Monorepo NestJS + Next.js](docs/03-Presets/2-Monorepo-NestJS-with-NextJS.md) with Typescript on both the frontend and the backend.
6464

6565
> If you don't see your favorite framework in the list above, please let us know by creating a GitHub issue, or, better yet, feel free to submit a PR!
6666

commands/cloud.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ func AddKoolCloud(root *cobra.Command) {
4848
func NewCloudCommand(cloud *Cloud) (cloudCmd *cobra.Command) {
4949
cloudCmd = &cobra.Command{
5050
Use: "cloud COMMAND [flags]",
51-
Short: "Interact with Kool Cloud and manage your deployments.",
52-
Long: "The cloud subcommand encapsulates a set of APIs to interact with Kool Cloud and deploy, access and tail logs from your deployments.",
51+
Short: "Interact with Kool.dev Cloud and manage your deployments.",
52+
Long: "The cloud subcommand encapsulates a set of APIs to interact with Kool.dev Cloud and deploy, access and tail logs from your deployments.",
5353
Example: `kool cloud deploy`,
5454
// add cobra usage help content
5555
DisableFlagsInUseLine: true,
@@ -85,7 +85,7 @@ func NewCloudCommand(cloud *Cloud) (cloudCmd *cobra.Command) {
8585
// if no token is set, we try to get it from the environment
8686
if cloud.flags.Token == "" && cloud.env.Get("KOOL_API_TOKEN") == "" {
8787
if requiredFlags {
88-
err = fmt.Errorf("missing Kool Cloud API token - please set it via --token or KOOL_API_TOKEN environment variable")
88+
err = fmt.Errorf("missing Kool.dev Cloud API token - please set it via --token or KOOL_API_TOKEN environment variable")
8989
return
9090
}
9191
} else if cloud.flags.Token != "" {
@@ -96,7 +96,7 @@ func NewCloudCommand(cloud *Cloud) (cloudCmd *cobra.Command) {
9696
},
9797
}
9898

99-
cloudCmd.PersistentFlags().StringVarP(&cloud.flags.Token, "token", "", "", "Token to authenticate with Kool Cloud API")
99+
cloudCmd.PersistentFlags().StringVarP(&cloud.flags.Token, "token", "", "", "Token to authenticate with Kool.dev Cloud API")
100100
cloudCmd.PersistentFlags().StringVarP(&cloud.flags.DeployDomain, "domain", "", "", "Environment domain name to deploy to")
101101

102102
return

commands/cloud_deploy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type KoolDeploy struct {
4747
func NewDeployCommand(deploy *KoolDeploy) (cmd *cobra.Command) {
4848
cmd = &cobra.Command{
4949
Use: "deploy",
50-
Short: "Deploy a local application to a Kool Cloud environment",
50+
Short: "Deploy a local application to a Kool.dev Cloud environment",
5151
RunE: DefaultCommandRunFunction(deploy),
5252
Args: cobra.NoArgs,
5353

commands/cloud_deploy_destroy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type KoolDeployDestroy struct {
2020
func NewDeployDestroyCommand(destroy *KoolDeployDestroy) *cobra.Command {
2121
return &cobra.Command{
2222
Use: "destroy",
23-
Short: "Destroy an environment deployed to Kool Cloud",
23+
Short: "Destroy an environment deployed to Kool.dev Cloud",
2424
Args: cobra.NoArgs,
2525
RunE: DefaultCommandRunFunction(destroy),
2626

commands/cloud_deploy_exec.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ type KoolDeployExecFlags struct {
2727
func NewDeployExecCommand(deployExec *KoolDeployExec) (cmd *cobra.Command) {
2828
cmd = &cobra.Command{
2929
Use: "exec SERVICE [COMMAND] [--] [ARG...]",
30-
Short: "Execute a command inside a running service container deployed to Kool Cloud",
31-
Long: `After deploying an application to Kool Cloud using 'kool deploy',
30+
Short: "Execute a command inside a running service container deployed to Kool.dev Cloud",
31+
Long: `After deploying an application to Kool.dev Cloud using 'kool deploy',
3232
execute a COMMAND inside the specified SERVICE container (similar to an SSH session).
3333
Must use a KOOL_API_TOKEN environment variable for authentication.`,
3434
Args: cobra.MinimumNArgs(1),

commands/cloud_deploy_logs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ type KoolDeployLogsFlags struct {
2828
func NewDeployLogsCommand(deployLogs *KoolDeployLogs) (cmd *cobra.Command) {
2929
cmd = &cobra.Command{
3030
Use: "logs [OPTIONS] SERVICE",
31-
Short: "See the logs of running service container deployed to Kool Cloud",
32-
Long: `After deploying an application to Kool Cloud using 'kool deploy',
31+
Short: "See the logs of running service container deployed to Kool.dev Cloud",
32+
Long: `After deploying an application to Kool.dev Cloud using 'kool deploy',
3333
you can see the logs from the specified SERVICE container.
3434
Must use a KOOL_API_TOKEN environment variable for authentication.`,
3535
Args: cobra.ExactArgs(1),

docs.go

Lines changed: 57 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package main
55

66
import (
77
"bytes"
8+
"errors"
89
"fmt"
910
"kool-dev/kool/commands"
1011
"kool-dev/kool/core/shell"
@@ -14,22 +15,17 @@ import (
1415
"regexp"
1516
"strings"
1617

18+
"github.com/spf13/cobra"
1719
"github.com/spf13/cobra/doc"
1820
)
1921

2022
func main() {
2123
var (
2224
err error
2325
koolOutput *bytes.Buffer
24-
cmdFile *os.File
2526
koolFile *os.File
2627
)
2728

28-
linkHandler := func(filename string) string {
29-
base := strings.TrimSuffix(filename, filepath.Ext(filename))
30-
return strings.ToLower(base)
31-
}
32-
3329
fmt.Println("Going to generate cobra docs in markdown...")
3430

3531
koolOutput = new(bytes.Buffer)
@@ -43,42 +39,19 @@ func main() {
4339
koolMarkdown := koolOutput.String()
4440

4541
for _, childCmd := range commands.RootCmd().Commands() {
46-
var cmdName string
47-
48-
if cmdName = strings.Replace(childCmd.CommandPath(), " ", "_", -1); cmdName == "kool_deploy" || cmdName == "kool_help" {
49-
continue
50-
}
51-
52-
newName := strings.Replace(childCmd.CommandPath(), " ", "-", -1)
53-
koolMarkdown = strings.Replace(koolMarkdown, cmdName, newName, -1)
54-
55-
cmdOutput := new(bytes.Buffer)
56-
57-
err = doc.GenMarkdownCustom(childCmd, cmdOutput, linkHandler)
58-
59-
if err != nil {
60-
log.Fatal(err)
61-
}
62-
63-
cmdFile, err = CreateFile(newName, "docs/4-Commands")
64-
65-
if err != nil {
66-
log.Fatal(err)
67-
}
68-
69-
defer cmdFile.Close()
70-
71-
_, err = cmdOutput.WriteTo(cmdFile)
72-
73-
if err != nil {
74-
log.Fatal(err)
42+
if err = exportCmdDocs(childCmd, &koolMarkdown); err != nil {
43+
if strings.HasPrefix(err.Error(), "skip") {
44+
log.Println(err)
45+
} else {
46+
log.Fatal(err)
47+
}
7548
}
7649
}
7750

7851
re := regexp.MustCompile("(?m)[\r\n]+^.*kool_deploy.*$")
7952
koolMarkdown = re.ReplaceAllString(koolMarkdown, "")
8053

81-
koolFile, err = CreateFile("0-kool", "docs/4-Commands")
54+
koolFile, err = CreateFile("0-kool", "docs/05-Commands-Reference")
8255

8356
if err != nil {
8457
log.Fatal(err)
@@ -106,3 +79,51 @@ func CreateFile(filename string, dir string) (file *os.File, err error) {
10679

10780
return
10881
}
82+
83+
func exportCmdDocs(childCmd *cobra.Command, koolMarkdown *string) (err error) {
84+
var (
85+
cmdName string
86+
cmdFile *os.File
87+
)
88+
89+
if cmdName = strings.Replace(childCmd.CommandPath(), " ", "_", -1); cmdName == "kool_help" {
90+
err = errors.New("skip kool_help")
91+
return
92+
}
93+
94+
newName := strings.Replace(childCmd.CommandPath(), " ", "-", -1)
95+
*koolMarkdown = strings.Replace(*koolMarkdown, cmdName, newName, -1)
96+
97+
cmdOutput := new(bytes.Buffer)
98+
99+
if err = doc.GenMarkdownCustom(childCmd, cmdOutput, linkHandler); err != nil {
100+
return
101+
}
102+
103+
if cmdFile, err = CreateFile(newName, "docs/05-Commands-Reference"); err != nil {
104+
return
105+
}
106+
107+
defer cmdFile.Close()
108+
109+
if _, err = cmdOutput.WriteTo(cmdFile); err != nil {
110+
return
111+
}
112+
113+
for _, subCmd := range childCmd.Commands() {
114+
if err = exportCmdDocs(subCmd, koolMarkdown); err != nil {
115+
if strings.HasPrefix(err.Error(), "skip") {
116+
log.Println(err)
117+
} else {
118+
return
119+
}
120+
}
121+
}
122+
123+
return
124+
}
125+
126+
func linkHandler(filename string) string {
127+
base := strings.TrimSuffix(filename, filepath.Ext(filename))
128+
return strings.ToLower(base)
129+
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ Out of the box, Kool ships with a collection of Presets that will help you quick
1515

1616
> As an example of the Preset developer experience, check out the [Laravel preset](https://kool.dev/docs/presets/laravel).
1717
18-
- [AdonisJs](/docs/2-Presets/AdonisJs.md)
19-
- [CodeIgniter](/docs/2-Presets/CodeIgniter.md)
20-
- [Express.js](/docs/2-Presets/ExpressJS.md)
21-
- [Hugo](/docs/2-Presets/Hugo.md)
22-
- [Laravel](/docs/2-Presets/Laravel.md)
23-
- [NestJS](/docs/2-Presets/NestJS.md)
24-
- [Next.js](/docs/2-Presets/NextJS.md)
25-
- [Node.js](/docs/2-Presets/NodeJS.md)
26-
- [Nuxt.js](/docs/2-Presets/NuxtJS.md)
27-
- [PHP](/docs/2-Presets/PHP.md)
28-
- [Symfony](/docs/2-Presets/Symfony.md)
29-
- [WordPress](/docs/2-Presets/WordPress.md)
18+
- [AdonisJs](/docs/03-Presets/AdonisJs.md)
19+
- [CodeIgniter](/docs/03-Presets/CodeIgniter.md)
20+
- [Express.js](/docs/03-Presets/ExpressJS.md)
21+
- [Hugo](/docs/03-Presets/Hugo.md)
22+
- [Laravel](/docs/03-Presets/Laravel.md)
23+
- [NestJS](/docs/03-Presets/NestJS.md)
24+
- [Next.js](/docs/03-Presets/NextJS.md)
25+
- [Node.js](/docs/03-Presets/NodeJS.md)
26+
- [Nuxt.js](/docs/03-Presets/NuxtJS.md)
27+
- [PHP](/docs/03-Presets/PHP.md)
28+
- [Symfony](/docs/03-Presets/Symfony.md)
29+
- [WordPress](/docs/03-Presets/WordPress.md)
3030

3131
### Docker and Docker Compose
3232

0 commit comments

Comments
 (0)