This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65a4795
commit 3c6ca90
Showing
18 changed files
with
197 additions
and
63 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,28 @@ | ||
name: update | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
schedule: | ||
- cron: '0 11 * * *' | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 🍽️ Get working copy | ||
uses: actions/checkout@main | ||
with: | ||
fetch-depth: 1 | ||
- name: 🍳 Shake & bake README | ||
run: | ||
go run docs/docsgenerator.go | ||
- name: 🚀 Deploy | ||
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git add . | ||
git commit -am "Update dynamic content" | ||
git push --all -f https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git |
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 |
---|---|---|
@@ -1 +1,16 @@ | ||
# ArgoHub | ||
# Frigg documentation | ||
|
||
## Content | ||
|
||
- ./frigg | ||
- ./providers | ||
- ./capd | ||
- ./capv | ||
- ./capz | ||
- ./harvester | ||
|
||
## How we do documentation | ||
|
||
The documentation is mostly done by writing comments in the code. | ||
The 'docsgenerator.go' program tries to read them, and writes it to the desired places | ||
inside the Markdown-files. |
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
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
File renamed without changes.
Empty file.
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 @@ | ||
CAPD (ClusterAPI Provider for Docker) Documentation | ||
|
||
|
||
Placeholder | ||
|
||
25 Feb 2024 |
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,88 @@ | ||
package capd | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"os" | ||
"strings" | ||
"time" | ||
) | ||
|
||
func MakeReadme(filename string) { | ||
date := time.Now().Format("2 Jan 2006") | ||
|
||
header := "# CAPD (ClusterAPI Provider for Docker) Documentation" | ||
body := "## Placeholder" | ||
footer := date | ||
data := fmt.Sprintf("%s\n\n\n%s\n\n%s", header, body, footer) | ||
|
||
file, err := os.Create(filename) | ||
if err != nil { | ||
fmt.Printf("Error on creating file: %v\n", err) | ||
} | ||
defer func(file *os.File) { | ||
err := file.Close() | ||
if err != nil { | ||
fmt.Printf("Error on closing file: %v\n", err) | ||
} | ||
}(file) | ||
|
||
_, err = io.WriteString(file, data) | ||
if err != nil { | ||
fmt.Printf("Error writing README file: %v\n", err) | ||
} | ||
} | ||
|
||
// Docsgenerator for the capd provider usage | ||
func Docsgenerator(filepath string) ([]string, error) { | ||
//filepath = "cmd/frigg/bootstrap/capd/cluster/cluster.go" | ||
fileBytes, err := os.ReadFile(filepath) | ||
if err != nil { | ||
fmt.Printf("Error reading file from given path: %v", err) | ||
} | ||
|
||
fileContent := string(fileBytes) | ||
|
||
var comments []string | ||
|
||
//regex := regexp.MustCompile(`// docs:`) | ||
// | ||
//for _, line := range strings.Split(fileContent, "\n") { | ||
// if match := regex.FindStringSubmatch(line); match != nil { | ||
// // Extract and trim the comment text after "// docs:" | ||
// comment := strings.TrimSpace(match[1]) | ||
// comments = append(comments, comment) | ||
// } | ||
//} | ||
|
||
for _, line := range strings.Split(fileContent, "\n") { | ||
line = strings.TrimLeft(line, " \t") | ||
if strings.HasPrefix(line, "//") || (strings.HasPrefix(line, "/*") && strings.HasSuffix(line, "*/")) { | ||
comments = append(comments, strings.TrimSpace(line[2:])) | ||
} | ||
} | ||
|
||
//for _, line := range strings.Split(fileContent, "\n") { | ||
// if strings.HasPrefix(line, "//") { | ||
// comments = append(comments, strings.TrimSpace(line[2:])) | ||
// } | ||
// | ||
// if strings.HasPrefix(line, "/*") && strings.HasSuffix(line, "*/") { | ||
// comments = append(comments, strings.TrimSpace(strings.TrimPrefix(strings.TrimPrefix(line, "*/"), "/*"))) | ||
// } | ||
//} | ||
|
||
var combinedComments string | ||
for _, comment := range comments { | ||
combinedComments += comment + "\n" | ||
} | ||
|
||
err = os.WriteFile("docs/providers/capd/README.md", []byte(combinedComments), 0755) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
fmt.Println(combinedComments) | ||
|
||
return comments, nil | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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