Skip to content

Commit 3553d04

Browse files
author
Duncan Rance
committed
'rakosh extract gatsby' becomes 'rakosh gatsby', plus some more documentation
1 parent daaa607 commit 3553d04

File tree

11 files changed

+141
-19
lines changed

11 files changed

+141
-19
lines changed

.github/workflows/my-mine.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: extract and build gatsby site
5454
run: |
5555
mkdir ./staticsite
56-
./cli/main.js extract gatsby my-mine examples/my-mine/cust-prod.json ./staticsite -v --no-build
56+
./cli/main.js gatsby my-mine examples/my-mine/cust-prod.json ./staticsite -v --no-build
5757
cd ./staticsite
5858
yarn
5959
yarn list

cli/extract.js renamed to cli/gatsby.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,12 @@ const log = require('loglevel')
1414

1515
log.setLevel('WARN')
1616

17-
exports.command = 'extract <format> <mine> <sitecustom> <directory>'
17+
exports.command = 'gatsby <mine> <sitecustom> <directory>'
1818

19-
exports.describe = 'Extract the data from a mine into some output format'
19+
exports.describe = 'Extract the data from a mine into a Gatsby.js site layout'
2020

2121
exports.builder = (yargs) => {
2222
return yargs
23-
.positional('format', {
24-
describe: 'The output format of the extraction',
25-
string: true,
26-
choices: ['gatsby']
27-
})
2823
.positional('mine', {
2924
describe: 'The name of the mine to extract',
3025
string: true
@@ -76,12 +71,10 @@ exports.handler = async function (argv) {
7671

7772
log.info(`extracting to ${argv.directory}`)
7873

79-
if (argv.format === 'gatsby') {
80-
await copyTemplates(argv.directory, argv.sitecustom)
81-
await extractNuggets(db, argv.directory)
82-
await generateMineMap(db, argv.directory)
83-
if (argv.build) buildSite(argv.directory)
84-
}
74+
await copyTemplates(argv.directory, argv.sitecustom)
75+
await extractNuggets(db, argv.directory)
76+
await generateMineMap(db, argv.directory)
77+
if (argv.build) buildSite(argv.directory)
8578
} catch (err) {
8679
log.error(`ERROR: ${err}`)
8780
process.exit(1)

cli/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { hideBin } = require('yargs/helpers')
55

66
yargs(hideBin(process.argv))
77
.command(require('./deposit'))
8-
.command(require('./extract'))
8+
.command(require('./gatsby'))
99
.command(require('./uuid'))
1010
.demandCommand(1)
1111
.option('verbose', {

docs/cli.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ order: 3
55
---
66

77
## Command Line Interface
8+
9+
The Command Line Interface program is called `rakosh`.

docs/cli/cli.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
---
22
_key: 234d483d-1e22-4c6c-8b7a-5b44d5325c90
3+
order: 1
4+
nuggets:
5+
- 228d144f-b0b7-4375-85a5-f5c96eb6fa99
6+
- da4fc47f-d5a1-421f-8ed8-299343f4a0e2
7+
- 8e03a31c-4624-4c1c-bf7c-fb6d9ddbcbae
8+
- 0179441b-3aea-4753-9671-76bcd2f107a7
39
---
410

511
## CLI
612

7-
The Command Line Interface program is called `rakosh`.
13+
All the Command Line Interface nuggets:

docs/cli/deposit.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
_key: da4fc47f-d5a1-421f-8ed8-299343f4a0e2
3+
order: 3
4+
---
5+
6+
### Deposit
7+
8+
The `deposit` command iterates over files and directories to build the structure of a rakosh mine in ArangoDB.
9+
10+
The files and directories are required to be in a particular layout. The layout is versioned to allow for later changes. See [FS Layout](./8e03a31c-4624-4c1c-bf7c-fb6d9ddbcbae).
11+
12+
#### Help Text
13+
14+
```text
15+
rakosh deposit <directory> [options]
16+
17+
Deposit content from the filesystem into a mine
18+
19+
Positionals:
20+
directory Directory containing a rakosh mine layout [string] [required]
21+
22+
Options:
23+
--help Show help [boolean]
24+
--version Show version number [boolean]
25+
-v, --verbose Run with verbose output [boolean]
26+
-r, --replace Replace the existing mine if it exists [boolean] [default: false]
27+
```
28+
29+
#### Example
30+
31+
Deposit from a directory called `examples/my-mine` with verbose output and replacing any existing version of `my-mine`:
32+
33+
```sh
34+
rakosh deposit examples/my-mine -r -v
35+
```

docs/cli/extract.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
_key: 0179441b-3aea-4753-9671-76bcd2f107a7
3+
order: 5
4+
---
5+
6+
### Extract
7+
8+
The extraction command use the data in ArangoDB to generate content various formats.
9+
10+
#### Gatsby
11+
12+
Currently the only supported extraction format is a Gatsby.js site:
13+
14+
```text
15+
rakosh gatsby <mine> <sitecustom> <directory>
16+
17+
Extract the data from a mine into a Gatsby.js site layout
18+
19+
Positionals:
20+
mine The name of the mine to extract [required]
21+
sitecustom A JSON file for site customizations [string] [required]
22+
directory Target directory into which to extract the data[string] [required]
23+
24+
Options:
25+
--help Show help [boolean]
26+
--version Show version number [boolean]
27+
-v, --verbose Run with verbose output [boolean]
28+
--build Run the build (use --no-build to not) [boolean] [default: true]
29+
```
30+
31+
##### Example
32+
33+
Extract from the `docs` mine, using customizations from `docs/cust-dev.json`, into a directory called `heap`. Run with verbose output and do not run `npm build` for gatsby:
34+
35+
```sh
36+
rakosh gatsby docs docs/cust-dev.json heap --no-build -v
37+
```

docs/cli/fs_layout.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
_key: 8e03a31c-4624-4c1c-bf7c-fb6d9ddbcbae
3+
order: 4
4+
---
5+
6+
#### FS Layout
7+
8+
##### Adit
9+
10+
The root node of the graph is called the "adit" -- an entrance to a mine.
11+
12+
The directory pointed to by the `rakosh deposit` command must contain a markdown file with the following front matter:
13+
14+
```yaml
15+
---
16+
_key: adit
17+
fs_layout: '1.1'
18+
---
19+
```
20+
21+
`fs_layout` is a version identifier that indicates the layout of these files and directories. The `rakosh` tool checks that it can interpret the given layout.
22+
23+
##### Passages And Nuggets
24+
25+
Directories become Passages and markdown files become Nuggets. If there is a markdown file with front matter `passage: <directory-name>` then its content will be added to the Passage rather than become a Nugget. This file must be in the same directory as the passage directory.

docs/cli/help_text.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
_key: 228d144f-b0b7-4375-85a5-f5c96eb6fa99
3+
order: 2
4+
---
5+
6+
### Help Text
7+
8+
```text
9+
rakosh <command>
10+
11+
Commands:
12+
rakosh deposit <directory> [options] Deposit content from the filesystem into a mine
13+
rakosh gatsby <mine> <sitecustom> <directory> Extract the data from a mine into some output format
14+
<sitecustom> <directory>
15+
rakosh uuid Generate a UUID
16+
17+
Options:
18+
--help Show help [boolean]
19+
--version Show version number [boolean]
20+
-v, --verbose Run with verbose output [boolean]
21+
22+
Go to https://github.com/orval/rakosh for more information
23+
```

docs/concepts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ nuggets:
77
- 1f36fe64-eef9-4226-b837-0f9c35814405
88
- 055dc260-16c0-4d6b-9b84-4b4e6be23ef0
99
- 3b3b4658-80e2-4087-b219-6c9f9def0bef
10+
- 5f459053-1f3b-46ad-9fdd-2843c898e476
1011
---
1112

1213
## Concepts

0 commit comments

Comments
 (0)