-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make refactors in favor of documentation (#95)
- Loading branch information
1 parent
d4c0d3f
commit 97f16bc
Showing
103 changed files
with
1,078 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const fs = require('fs'); | ||
const recursive = require('recursive-readdir'); | ||
const path = require('path'); | ||
const _ = require('lodash'); | ||
|
||
|
||
recursive(path.resolve(__dirname, '../lib/interface/cli/commands'), (err, files) => { | ||
|
||
_.forEach(files, (file) => { | ||
if (!file.endsWith('.cmd.js')) { | ||
return; | ||
} | ||
|
||
console.log(file); | ||
const command = require(file); | ||
|
||
// dont document beta commands currently | ||
if (command.isBetaCommand()) { | ||
return; | ||
} | ||
|
||
const docs = command.prepareDocs(); | ||
|
||
const { category } = docs; | ||
|
||
// create a directory according to the category | ||
const dir = path.resolve(__dirname, `../docs-template/content/${(category || 'undefined').toLowerCase()}`); | ||
if (!fs.existsSync(dir)){ | ||
fs.mkdirSync(dir); | ||
} | ||
|
||
// create _index.md file if does not exist for the category | ||
const indexFile = path.resolve(dir, '_index.md'); | ||
if (!fs.existsSync(indexFile)){ | ||
fs.writeFileSync(indexFile, `+++\ntitle = "${category}"\n+++`); | ||
} | ||
|
||
let finalFileString = ''; | ||
|
||
finalFileString += `${docs.header}\n\n`; | ||
finalFileString += `### Command\n\`${docs.command}\`\n\n`; | ||
finalFileString += `${docs.description}\n`; | ||
|
||
if (docs.positionals.length) { | ||
finalFileString += `### Positionals\n\nOption | Default | Description\n--------- | ----------- | -----------\n${docs.positionals}`; | ||
} | ||
|
||
if (docs.options.length) { | ||
finalFileString += `### Options\n\nOption | Default | Description\n--------- | ----------- | -----------\n${docs.options}`; | ||
} | ||
|
||
|
||
fs.writeFileSync(path.resolve(dir, `./${docs.title}.md`), finalFileString); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,44 @@ | ||
theme = "docuapi" | ||
theme = "docdock" | ||
baseurl = "http://cli.codefresh.io" | ||
title = "Codefresh CLI Documentation" | ||
publishDir = "../docs" | ||
languageCode = "en-us" | ||
DefaultContentLanguage = "en" | ||
|
||
|
||
# Code higlighting settings | ||
pygmentsCodefences = true | ||
pygmentsCodeFencesGuesSsyntax = false | ||
pygmentsOptions = "" | ||
pygmentsStyle = "monokai" | ||
# The monokai stylesheet is included in the base template. | ||
pygmentsUseClasses = true | ||
pygmentsCodeFences = true | ||
pygmentsStyle = "monokailight" | ||
|
||
[params] | ||
search = true | ||
editURL = "https://github.com/vjeantet/hugo-theme-docdock/edit/master/exampleSite/content/" | ||
showVisitedLinks = true # default is false | ||
themeStyle = "original" # "original" or "flex" # default "original" | ||
themeVariant = "" # choose theme variant "green", "gold" , "gray", "blue" (default) | ||
ordersectionsby = "weight" # ordersectionsby = "title" | ||
disableHomeIcon = false # default is false | ||
disableSearch = false # default is false | ||
disableNavChevron = false # set true to hide next/prev chevron, default is false | ||
highlightClientSide = false # set true to use highlight.pack.js instead of the default hugo chroma highlighter | ||
|
||
# Configure the language example tabs. | ||
[[params.language_tabs]] | ||
key = "cli" | ||
name = "Cli" | ||
|
||
#Languages | ||
[languages] | ||
[outputs] | ||
home = [ "HTML", "RSS", "JSON"] | ||
|
||
[languages.en] | ||
languageName = "English" | ||
weight = 2 | ||
|
||
[[menu.shortcuts]] | ||
pre = "<h3>More</h3>" | ||
name = "<i class='fa fa-github'></i> Github repo" | ||
identifier = "ds" | ||
url = "https://github.com/codefresh-io/cli" | ||
weight = 10 | ||
|
||
[[menu.shortcuts]] | ||
name = "<i class='fa fa-camera'></i> Examples" | ||
url = "/Examples" | ||
weight = 11 | ||
|
||
[[menu.shortcuts]] | ||
name = "<i class='fa fa-bookmark'></i> Codefresh Documentation" | ||
identifier = "hugodoc" | ||
url = "https://docs.codefresh.io" | ||
weight = 20 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
+++ | ||
title = "header" | ||
description = "" | ||
date = "2017-04-24T18:36:24+02:00" | ||
+++ | ||
Codefresh CLI Documentation |
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
docs-template/content/authentication/Create authentication context.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
+++ | ||
title = "Create authentication context" | ||
+++ | ||
|
||
### Command | ||
`codefresh auth create-context [name]` | ||
|
||
Create or update an authentication context | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
name | default | Context name | ||
### Options | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
--url | https://g.codefresh.io | Codefresh system custom url | ||
--api-key | | API key |
8 changes: 8 additions & 0 deletions
8
docs-template/content/authentication/Get activated context.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
+++ | ||
title = "Get activated context" | ||
+++ | ||
|
||
### Command | ||
`codefresh auth current-context` | ||
|
||
Get the current activated authentication context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
+++ | ||
title = "Get all contexts" | ||
+++ | ||
|
||
### Command | ||
`codefresh auth get-contexts` | ||
|
||
Get all possible authentication contexts |
13 changes: 13 additions & 0 deletions
13
docs-template/content/authentication/Set active context.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
+++ | ||
title = "Set active context" | ||
+++ | ||
|
||
### Command | ||
`codefresh auth use-context <name>` | ||
|
||
Set the current active authentication context | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
context-name | | a context-name that exists in cfconfig file |
11 changes: 5 additions & 6 deletions
11
docs-template/content/authentication.md → ...template/content/authentication/_index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
+++ | ||
title = "Get a single build" | ||
+++ | ||
|
||
### Command | ||
`codefresh get builds [id]` | ||
|
||
Get a specific builds or an array of builds | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
id | | Build id | ||
### Options | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
--limit | 25 | Limit amount of returned results | ||
--page | 1 | Paginated page | ||
--status | | Filter results by statuses | ||
--trigger | | Filter results by triggers | ||
--pipeline-id | | Filter results by pipeline id | ||
--pipeline-name | | Filter results by pipeline name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
+++ | ||
title = "Restart a build" | ||
+++ | ||
|
||
### Command | ||
`codefresh restart <id>` | ||
|
||
Restart a build by its id | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
id | | Build id | ||
### Options | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
--detach | | Run build and print workflow ID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
+++ | ||
title = "Show logs" | ||
+++ | ||
|
||
### Command | ||
`codefresh logs <id>` | ||
|
||
Show logs of a build | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
id | | Pipeline id | ||
### Options | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
--f | | Continue showing build logs until it will finish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
+++ | ||
title = "Terminate a build" | ||
+++ | ||
|
||
### Command | ||
`codefresh terminate <id>` | ||
|
||
Terminate a build by its id | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
id | | Build id |
20 changes: 20 additions & 0 deletions
20
docs-template/content/builds/Wait for a build condition.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
+++ | ||
title = "Wait for a build condition" | ||
+++ | ||
|
||
### Command | ||
`codefresh wait <id..>` | ||
|
||
Wait until a condition will be met on a build | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
id | | Build id | ||
### Options | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
--status | | Build status | ||
--debug | | Show debug output until the condition will be met | ||
--timeout | 30 | Define a timeout for the wait operation in minutes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
+++ | ||
title = "Builds" | ||
+++ |
20 changes: 20 additions & 0 deletions
20
docs-template/content/compositions/Create a composition.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
+++ | ||
title = "Create a composition" | ||
+++ | ||
|
||
### Command | ||
`codefresh create composition [name]` | ||
|
||
Create a composition | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
name | | Name of composition | ||
### Options | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
--variable | | Variables list | ||
--advanced | | Advanced composition | ||
--yaml | | Path to yaml file to use to create the resource |
13 changes: 13 additions & 0 deletions
13
docs-template/content/compositions/Delete a composition.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
+++ | ||
title = "Delete a composition" | ||
+++ | ||
|
||
### Command | ||
`codefresh delete composition [name]` | ||
|
||
Delete a composition | ||
### Positionals | ||
|
||
Option | Default | Description | ||
--------- | ----------- | ----------- | ||
name | | Composition name |
Oops, something went wrong.