Skip to content

Commit 39cdfe8

Browse files
committed
updated instructions for generating diagram to address some issues I ran into
1 parent 9a56d1a commit 39cdfe8

File tree

8 files changed

+126
-3
lines changed

8 files changed

+126
-3
lines changed
File renamed without changes.

measuring/questions/who-contributes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ There are many types of contributions - e.g. code, documentation, discussion, et
99
| **Metric** | **How it answers the question** | **Gotchas** |
1010
| --- | --- | --- |
1111
| [Code Contributions](../metrics/code-contributions.md) | Each code contribution represents a contributor to the InnerSource project. | There are other types of contributions beyond code. |
12+
| [Contribution Distance](../metrics/contribution-distance.md) | Measures how far apart in the organization each InnerSource contribution is. | Depends on accurate information on the organization's hierarchy mapped to contributor identity. |

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/gqm_gen/README.md

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,53 @@
22

33
Creates a Mermaid diagram from Goal, Question, Metrics (GQM) Markdown files.
44

5+
The instructions below describe how to locally run
6+
the script that builds the mermaid diagram.
7+
A GitHub Actions will re-run this script at built time
8+
and regenerate the diagram, but it is good to run
9+
locally to make sure it will build correctly.
10+
11+
Be sure to also read the instructions in the
12+
`measuring/use_gqm.md` file path.
13+
14+
## Installation
15+
16+
### Install mermaid CLI globally
17+
18+
From this folder, follow instructions on the
19+
[mermaid.js README](https://github.com/mermaid-js/mermaid-cli) to run in the terminal:
20+
```
21+
npm install -g @mermaid-js/mermaid-cli
22+
```
23+
24+
Install project specific node.js based on the package.json in this folder:
25+
```
26+
npm install
27+
```
28+
529
## Usage
630

731
Builds the mermaid diagram and outputs it to stdout.
832

933
```bash
10-
npm install
11-
npm run --silent start
34+
npm run --silent start > gqm.mmd && mmdc --input gqm.md --output gqm.png
1235
```
36+
37+
Note that the file ending `.mmd` is not a typo. It is mermaid markdown file.
38+
39+
This should generate a file called `gqm.png` or `gqm-1.png` in the same folder as this file.
40+
41+
You will also end up with BOTH a `gqm.md` and a `gqm.mmd` file as the later is created upon running the script.
42+
43+
## Files that impact the generation of the mermaid diagram
44+
45+
Most of the diagram is generated by the `gqm.md` file but be sure to also
46+
make changes in the files within the `measuring`, `questions`, and `goals` folders as appropriate.
47+
You'll have to create a file for a new block and edit any file that mentions that new block.
48+
For example, if you create a new metric, you'll want to create a new markdown file in the
49+
metrics folder. Additionally, as there is an arrow that goes from that metric to a question,
50+
you'll want to edit the table in the question file that talks to all the metrics that impact that question. A metric can be connected to one or more questions.
51+
52+
### Warning
53+
Files that are referenced by the mermaid diagram must not use underscores `_` in their filenames.
54+
Instead use hyphens `-`.

scripts/gqm_gen/gqm-1.png

36.3 KB
Loading

scripts/gqm_gen/gqm.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
```mermaid
2+
graph LR;
3+
4+
subgraph GQM[Goals, Questions, Metrics]
5+
6+
find-projects.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//goals/find-projects.md'>Find InnerSource Projects</a>]
7+
reduce-duplication.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//goals/reduce-duplication.md'>Reduce duplication</a>]
8+
who-contributes.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//questions/who-contributes.md'>Who contributes to the InnerSource project?</a>]
9+
who-uses.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//questions/who-uses.md'>Who uses the InnerSource project?</a>]
10+
code-contributions.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//metrics/code-contributions.md'>Code contributions</a>]
11+
contribution-distance.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//metrics/contribution-distance.md'>Contribution distance</a>]
12+
usage-count.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//metrics/usage-count.md'>Usage count</a>]
13+
find-projects.md-->who-uses.md
14+
find-projects.md-->who-contributes.md
15+
reduce-duplication.md-->who-uses.md
16+
who-contributes.md-->code-contributions.md
17+
who-contributes.md-->contribution-distance.md
18+
who-uses.md-->usage-count.md
19+
end
20+
subgraph Legend
21+
direction TB
22+
23+
goal[Goal]
24+
question[Question]
25+
metric[Metric]
26+
27+
classDef goals stroke:green,stroke-width:2px;
28+
class goal,find-projects.md,reduce-duplication.md goals
29+
30+
classDef questions stroke:orange,stroke-width:2px;
31+
class question,who-contributes.md,who-uses.md questions
32+
33+
classDef metrics stroke:purple,stroke-width:2px;
34+
class metric,code-contributions.md,contribution-distance.md,usage-count.md metrics
35+
end
36+
37+
```

scripts/gqm_gen/gqm.mmd

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
```mermaid
2+
graph LR;
3+
4+
subgraph GQM[Goals, Questions, Metrics]
5+
6+
find-projects.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//goals/find-projects.md'>Find InnerSource Projects</a>]
7+
reduce-duplication.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//goals/reduce-duplication.md'>Reduce duplication</a>]
8+
who-contributes.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//questions/who-contributes.md'>Who contributes to the InnerSource project?</a>]
9+
who-uses.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//questions/who-uses.md'>Who uses the InnerSource project?</a>]
10+
code-contributions.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//metrics/code-contributions.md'>Code contributions</a>]
11+
contribution-distance.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//metrics/contribution-distance.md'>Contribution Distance</a>]
12+
usage-count.md[<a href='https://github.com/InnerSourceCommons/managing-inner-source-projects/blob/main/measuring//metrics/usage-count.md'>Usage count</a>]
13+
find-projects.md-->who-uses.md
14+
find-projects.md-->who-contributes.md
15+
reduce-duplication.md-->who-uses.md
16+
who-contributes.md-->code-contributions.md
17+
who-contributes.md-->contribution-distance.md
18+
who-uses.md-->usage-count.md
19+
end
20+
subgraph Legend
21+
direction TB
22+
23+
goal[Goal]
24+
question[Question]
25+
metric[Metric]
26+
27+
classDef goals stroke:green,stroke-width:2px;
28+
class goal,find-projects.md,reduce-duplication.md goals
29+
30+
classDef questions stroke:orange,stroke-width:2px;
31+
class question,who-contributes.md,who-uses.md questions
32+
33+
classDef metrics stroke:purple,stroke-width:2px;
34+
class metric,code-contributions.md,contribution-distance.md,usage-count.md metrics
35+
end
36+
37+
```

scripts/package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)