Skip to content

Commit 078da35

Browse files
authored
Merge pull request #13 from norlab-ulaval/feat-extend-dna-version-command-to-provide-more-details-NMO-731
Enhance version command, fix installer and init issues, standardize project naming
2 parents ee30c58 + e177b93 commit 078da35

39 files changed

+468
-222
lines changed

.aiignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/.junie/scratch.md
77
/.junie/recipes.md
88

9-
# ....Dockerized-NorLab Project related............................................................
9+
# ....dockerized-norlab-project related............................................................
1010
/external_data/
1111
/artifact/
1212
/tests/artifact/

.env.dockerized-norlab-project

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,62 +13,54 @@
1313
#
1414
# =================================================================================================
1515

16-
#PROJECT_PROMPT_NAME="DNA"
17-
#PROJECT_PROMPT_NAME="DN"
18-
PROJECT_PROMPT_NAME="dna"
16+
# ====UI===========================================================================================
17+
# ....Console prompt...............................................................................
18+
PROJECT_PROMPT_NAME="dna" # <- N2ST override
19+
DNA_PROMPT_NAME="${PROJECT_PROMPT_NAME}"
1920

21+
# ....Console splash...............................................................................
2022
#DNA_SPLASH_NAME_FULL="Dockerized-NorLab"
2123
#DNA_SPLASH_NAME_FULL="Dockerized-NorLab (DN/DNA)"
22-
#DNA_SPLASH_NAME_FULL=" Dockerized-NorLab (DN) "
2324
#DNA_SPLASH_NAME_FULL=" Dockerized-NorLab project application "
2425
#DNA_SPLASH_NAME_FULL="Dockerized-NorLab project app"
26+
#DNA_SPLASH_NAME_FULL=" Dockerized-NorLab (DN) "
2527
DNA_SPLASH_NAME_FULL=" Dockerized-NorLab project app "
2628
#DNA_SPLASH_NAME_FULL="Dockerized-NorLab project app (DNA)"
2729
#DNA_SPLASH_NAME_FULL="Dockerized-NorLab app (DNA)"
2830
DNA_SPLASH_NAME_SMALL="Dockerized-NorLab"
2931
#DNA_SPLASH_NAME_SMALL="DNA"
3032
#DNA_SPLASH_NAME_SMALL="·• DNA"
3133
#DNA_SPLASH_NAME_SMALL="···•· DNA ··••"
32-
#DNA_SPLASH_NAME_SMALL=" Dockerized-NorLab "
3334
#DNA_SPLASH_NAME_SMALL="❄︎ Dockerized-NorLab"
3435
NBS_SPLASH_NAME="${PROJECT_PROMPT_NAME}-build-system"
3536

36-
# ....Programaticaly fetch source code information.................................................
37-
# (NICE TO HAVE) ToDo: assessment >> next bloc ↓↓
38-
PROJECT_PATH="$( git rev-parse --show-toplevel )"
39-
#PROJECT_GIT_REMOTE_URL="$( git remote get-url origin )"
40-
#PROJECT_GIT_NAME="$( basename "${PROJECT_GIT_REMOTE_URL}" .git )"
41-
#PROJECT_SRC_NAME="$( basename ${PROJECT_PATH} )"
42-
43-
# ....Set project related environment variable with their own prefix...............................
44-
# Note: Those with "PROJECT_" prefix will get eventualy overiden in the case where N2ST is used
45-
# as a library. Using generic testing logic require that environment variables with
46-
# "PROJECT_" prefix be available.
47-
DNA_PROMPT_NAME="${PROJECT_PROMPT_NAME}"
37+
# ....Repository...................................................................................
4838
DNA_GIT_REMOTE_URL="https://github.com/norlab-ulaval/dockerized-norlab-project"
49-
DNA_GIT_NAME="dockerized-norlab-project"
50-
#DNA_SRC_NAME="dockerized-norlab-project"
39+
DNA_HUMAN_NAME="Dockerized-NorLab project application"
40+
DNA_TECH_NAME="dockerized-norlab-project"
41+
42+
# ====Internal=====================================================================================
43+
# ....DNA path.....................................................................................
44+
PROJECT_PATH="$( git rev-parse --show-toplevel )" # <- N2ST override
45+
DNA_ROOT="${PROJECT_PATH}"
46+
DNA_PATH="${DNA_ROOT}/src/bin"
47+
DNA_LIB_PATH="${DNA_ROOT}/src/lib"
48+
DNA_LIB_EXEC_PATH="${DNA_LIB_PATH}/core/execute"
49+
DNA_MOCK_SUPER_PROJECT_ROOT="${DNA_ROOT}/utilities/tmp/dockerized-norlab-project-mock"
5150

52-
# ....Set dependencies path........................................................................
51+
# ....Dependencies path............................................................................
5352
N2ST_PATH="${PROJECT_PATH}/utilities/norlab-shell-script-tools"
5453
NBS_PATH="${PROJECT_PATH}/utilities/norlab-build-system"
5554

56-
NBS_VERSION="$(cat ${NBS_PATH}/version.txt)"
57-
N2ST_VERSION="$(cat ${N2ST_PATH}/version.txt)"
58-
59-
# ====DNA==========================================================================================
55+
# ====Version======================================================================================
56+
# ....DNA..........................................................................................
6057
DNA_VERSION="$(cat ${PROJECT_PATH}/version.txt)"
6158
DNA_CONFIG_SCHEME_VERSION=1
6259

63-
# ....internal.....................................................................................
64-
DNA_ROOT="${PROJECT_PATH}"
65-
66-
DNA_PATH="${DNA_ROOT}/src/bin"
67-
DNA_LIB_PATH="${DNA_ROOT}/src/lib"
68-
DNA_LIB_EXEC_PATH="${DNA_LIB_PATH}/core/execute"
69-
DNA_MOCK_SUPER_PROJECT_ROOT="${DNA_ROOT}/utilities/tmp/dockerized-norlab-project-mock"
60+
# ....Dependencies.................................................................................
61+
NBS_VERSION="$(cat ${NBS_PATH}/version.txt)"
62+
N2ST_VERSION="$(cat ${N2ST_PATH}/version.txt)"
7063

71-
# ....dev..........................................................................................
64+
# ====Dev==========================================================================================
7265
DNA_DEBUG=false
7366
DNA_CLEAR_CONSOLE_ACTIVATED=false
74-

.junie/plans/dna_stand_alone_refactoring_guideline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Dockerized-NorLab Project stand-alone refactoring guidelines
1+
# Dockerized-NorLab-Project stand-alone refactoring guidelines
22

33
Stand-alone version with a PATH-accessible bash script approach
44
This approach maintains the current bash script structure but makes it accessible from anywhere via the system `PATH`.

.junie/plans/offline_mode_analysis_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Executive Summary
44

5-
This report analyzes the Dockerized-NorLab Project (DNA) repository to identify implementation details that would prevent users from running `dna` in offline mode. After careful review and correction of initial misconceptions, the analysis shows that DNA can operate in offline mode with minimal or no modifications required.
5+
This report analyzes the Dockerized-NorLab project application (DNA) repository to identify implementation details that would prevent users from running `dna` in offline mode. After careful review and correction of initial misconceptions, the analysis shows that DNA can operate in offline mode with minimal or no modifications required.
66

77
## Key Findings
88

.junie/plans/readme_improvement_plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The expected sections order should be the following:
2727
- _Description_
2828
- _What it does_
2929
- _Getting started_
30-
- _Install Dockerized-NorLab Project app `dna`_
30+
- _Install Dockerized-NorLab-Project app `dna`_
3131
- _Make a repository ready to use with DNA_
3232
- _Create, run and stop DN container_
3333
- _Why_

.junie/recipes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Execute all unit-tests and all integration tests before submiting.
88
Add/refactor/improve TODO
99
Check if it introduce any breaking change in the code base by runnning both unit-tests and integration tests.
1010
Propose source code change if relevant.
11+
Update Markdown documention accordingly.
1112

1213
Inspire yourself with `TODO`.
1314

@@ -20,6 +21,7 @@ Create at least one test case per command argument and/or options.
2021
Test relevant option and arguments combinaison.
2122
You can mock their corresponding functions as the intended purposes of this test file is for unit-testing the CLI functionalities.
2223
Propose source code change if relevant.
24+
Update Markdown documention accordingly.
2325
Execute all unit-tests and all integration tests before submiting.
2426

2527
## Improve/refactor source code
@@ -32,6 +34,7 @@ Create at least one test case per new command argument and/or options, update cu
3234
Test relevant option and arguments combinaison.
3335
Check if it introduce any breaking change in the code base by runnning both unit-tests and integration tests.
3436
Propose source code change if relevant.
37+
Update Markdown documention accordingly.
3538
Execute all unit-tests and all integration tests before submiting.
3639

3740
## Modify proposed tests solutions

.junie/scratch.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11

22
# Scratch
33

4+
Update bats test at `tests/tests_bats/test_version.bats` considering change made to `src/lib/commands/version.bash`.
5+
Follow guidelines at `.junie/guidelines.md`.
6+
Create at least one test case per new command argument and/or options, update current tests cases otherwise.
7+
Propose source code change if relevant.
8+
Update Markdown documention accordingly.
9+
Check if it introduce any breaking change in the code base by runnning both unit-tests and integration tests.
10+
11+
---
12+
413
Read and implement the updated plan at `.junie/plans/documentation_updates_proposal.md`.
514
Follow guidelines at `.junie/guidelines.md`.
615

Vagrantfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,20 +148,20 @@ Vagrant.configure("2") do |config|
148148
149149
# Ressetting
150150
rm -f /usr/local/bin/dna
151-
sed -i '/# >>>> Dockerized-NorLab Project (start)/,/# <<<< Dockerized-NorLab Project (end)/d' "${HOME}/.bashrc"
152-
sed -i '/# >>>> Dockerized-NorLab Project CUDA (start)/,/# <<<< Dockerized-NorLab Project CUDA (end)/d' "${HOME}/.bashrc"
153-
sed -i '/# >>>> Dockerized-NorLab Project DEV alias (start)/,/# <<<< Dockerized-NorLab Project DEV alias (end)/d' "${HOME}/.bashrc"
151+
sed -i '/# >>>> dockerized-norlab-project (start)/,/# <<<< dockerized-norlab-project (end)/d' "${HOME}/.bashrc"
152+
sed -i '/# >>>> dockerized-norlab-project CUDA (start)/,/# <<<< dockerized-norlab-project CUDA (end)/d' "${HOME}/.bashrc"
153+
sed -i '/# >>>> dockerized-norlab-project DEV alias (start)/,/# <<<< dockerized-norlab-project DEV alias (end)/d' "${HOME}/.bashrc"
154154
155155
echo -e "\nSet DEV aliases\n"
156156
{
157157
echo "" ;
158-
echo "# >>>> Dockerized-NorLab Project DEV alias (start)" ;
158+
echo "# >>>> dockerized-norlab-project DEV alias (start)" ;
159159
echo "alias dna-dna-cd='cd /opt/dockerized-norlab-project'" ;
160160
# echo "alias dna-mock-cd='cd /opt/dockerized-norlab-project/utilities/tmp/dockerized-norlab-project-mock'" ;
161161
echo "alias dna-mock-empty-cd='cd /opt/dockerized-norlab-project-mock-EMPTY'" ;
162162
echo "alias dna-test-symlink='tree -L 1 -a /usr/local/bin/'" ;
163163
echo "alias dna-test-bashrc='tail -n 20 ~/.bashrc'" ;
164-
echo "# <<<< Dockerized-NorLab Project DEV alias (end)" ;
164+
echo "# <<<< dockerized-norlab-project DEV alias (end)" ;
165165
echo "" ;
166166
} >> /home/vagrant/.bashrc
167167

documentation/command/version.md

Lines changed: 76 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# dna version
22

3-
Show Dockerized-NorLab Project version information.
3+
Show Dockerized-NorLab project application version information.
44

55
## Synopsis
66

@@ -10,58 +10,88 @@ dna version [OPTIONS]
1010

1111
## Description
1212

13-
The `dna version` command displays the current version of the Dockerized-NorLab Project (DNA) application. This is useful for troubleshooting, compatibility checking, and ensuring you're running the expected version.
13+
The `dna version` command displays the current version of Dockerized-NorLab project application. This is useful for troubleshooting, compatibility checking, and ensuring you're running the expected version.
1414

1515
## Options
1616

1717
| Option | Description |
1818
|--------|-------------|
19+
| `--short`, `-s` | Show version number only |
20+
| `--all`, `-a` | Show detailed version information |
1921
| `--help`, `-h` | Show help message and exit |
2022

21-
## Examples
23+
## Output Examples
2224

23-
### Basic Version Display
25+
### Default Version Display
2426

2527
```bash
26-
# Show DNA version
27-
dna version
28+
$ dna version
29+
Dockerized-NorLab project application version 1.2.3
2830
```
2931

30-
### Output Example
32+
### Short Version Display
33+
Show only version number
3134

3235
```bash
33-
$ dna version
34-
Dockerized-NorLab Project version: 1.2.3
36+
$ dna version --short
37+
1.2.3
38+
```
39+
40+
### Detailed Version Display
41+
Show comprehensive version information
42+
43+
```bash
44+
dna version --all
45+
$ dna version --all
46+
Dockerized-NorLab project application:
47+
Version: 1.2.3
48+
Config scheme version: 1
49+
Submodule version:
50+
norlab-shell-script-tools: 2.0.0
51+
norlab-build-system: 3.0.0
52+
Local repository:
53+
Current branch: main
54+
Current commit: abc123def456
55+
Host architecture and OS: linux/amd64
3556
```
3657

58+
## Version Information
59+
60+
### Version Format
61+
62+
DNA follows semantic versioning (SemVer):
63+
- **Format**: `MAJOR.MINOR.PATCH`
64+
- **Example**: `1.2.3`
65+
- `1` - Major version (breaking changes)
66+
- `2` - Minor version (new features, backward compatible)
67+
- `3` - Patch version (bug fixes, backward compatible)
68+
69+
### Version Source
70+
71+
The version information is obtained from:
72+
- **Environment Variables**: DNA_VERSION, DNA_CONFIG_SCHEME_VERSION, N2ST_VERSION, NBS_VERSION
73+
- **Git Repository**: Current branch and commit information
74+
- **System**: Host architecture and OS information
75+
76+
3777
## Use Cases
3878

3979
### Version Verification
4080

4181
```bash
42-
# Check current DNA version
43-
dna version
44-
45-
# Verify version in scripts
46-
DNA_VERSION=$(dna version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
47-
echo "Running DNA version: $DNA_VERSION"
82+
# Get just the version number for scripts
83+
$ echo "Running DNA version: $(dna version --short)"
84+
Running DNA version: 1.2.3
4885
```
4986

5087
### Compatibility Checking
5188

5289
```bash
5390
# Check version before running commands
54-
dna version
55-
dna build develop # Ensure compatibility
56-
```
57-
58-
### Troubleshooting
59-
60-
```bash
61-
# Include version in bug reports
62-
echo "DNA Version: $(dna version)"
63-
echo "Docker Version: $(docker --version)"
64-
echo "System: $(uname -a)"
91+
$ dna version --all | grep -e "Config scheme version"
92+
Config scheme version: 1
93+
$ cat .dockerized_norlab/.env.dockerized-norlab-project-mock | grep DNA_CONFIG_SCHEME_VERSION
94+
DNA_CONFIG_SCHEME_VERSION=1
6595
```
6696

6797
### CI/CD Integration
@@ -74,23 +104,19 @@ docker --version
74104
docker-compose --version
75105
```
76106

77-
## Version Information
78-
79-
### Version Format
80-
81-
DNA follows semantic versioning (SemVer):
82-
- **Format**: `MAJOR.MINOR.PATCH`
83-
- **Example**: `1.2.3`
84-
- `1` - Major version (breaking changes)
85-
- `2` - Minor version (new features, backward compatible)
86-
- `3` - Patch version (bug fixes, backward compatible)
87-
88-
### Version Source
107+
### Troubleshooting
89108

90-
The version is read from:
91-
- **File**: `${DNA_ROOT}/version.txt`
92-
- **Location**: DNA installation directory
93-
- **Format**: Plain text file containing version string
109+
```bash
110+
# Include comprehensive version information in bug reports
111+
cat > "mock_bug_report.log" << EOF
112+
=== DNA Version Information ===
113+
$(dna version --all)
114+
115+
=== Docker Information ===
116+
Docker Version: $(docker --version)
117+
Docker Compose Version: $(docker-compose --version)
118+
EOF
119+
```
94120

95121
## Integration with Other Tools
96122

@@ -100,12 +126,16 @@ The version is read from:
100126
#!/bin/bash
101127
# Check DNA version compatibility
102128
REQUIRED_VERSION="1.2.0"
103-
CURRENT_VERSION=$(dna version | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
129+
CURRENT_VERSION=$(dna version --short)
104130

105-
if [[ ${CURRENT_VERSION} -lt ${REQUIRED_VERSION} ]]; then
131+
if [[ ${CURRENT_VERSION} < ${REQUIRED_VERSION} ]]; then
106132
echo "Error: DNA version ${CURRENT_VERSION} is too old. Required: ${REQUIRED_VERSION}"
107133
exit 1
108134
fi
135+
136+
# Get detailed information for logging
137+
echo "=== DNA Environment ==="
138+
dna version --all
109139
```
110140

111141
### Docker Image Tagging
@@ -151,19 +181,6 @@ echo "Generated with DNA version: $(dna version)" >> README.md
151181

152182
### Permission Issues
153183

154-
**Problem**: Cannot read version file.
155-
156-
**Solutions**:
157-
1. **Check permissions**: Verify file permissions
158-
```bash
159-
ls -la ${DNA_ROOT}/version.txt
160-
```
161-
162-
2. **Fix permissions**: Correct file permissions if needed
163-
```bash
164-
chmod 644 ${DNA_ROOT}/version.txt
165-
```
166-
167184
### Incorrect Version Display
168185

169186
**Problem**: Version shows unexpected value.
@@ -178,6 +195,8 @@ echo "Generated with DNA version: $(dna version)" >> README.md
178195
2. **Check version file**: Manually inspect version file
179196
```bash
180197
cat ${DNA_ROOT}/version.txt
198+
# compare with
199+
dna version --short
181200
```
182201

183202
## Version History and Compatibility

0 commit comments

Comments
 (0)