Skip to content

Commit 0ab2bd5

Browse files
author
szjanikowski
committed
Improved quick start tutorial
1 parent 4662e41 commit 0ab2bd5

1 file changed

Lines changed: 76 additions & 21 deletions

File tree

docs/quick-start.md

Lines changed: 76 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,28 @@ Open your browser and navigate to `http://localhost:8088`. You should see the No
8484

8585
## Step 4: Basic Configuration - Domain Modules
8686

87-
Now we'll configure Noesis to analyze your repository. Let's start by creating a basic configuration that will detect domain modules according to namespace hierarchy.
88-
In order to acheive that you are going to configure two new volumes in the container:
87+
Now we'll configure Noesis to analyze your repository and make the full use of directory structure presented in [Step 1](#step-1-prepare-directory-structure).
88+
89+
Let's start by creating a basic configuration that will detect domain modules according to namespace hierarchy.
90+
In order to acheive that, you are going to configure two new volumes in the container:
8991
- `externalSources` - it is a root directory of all the code repositories you want to scan
90-
- `externalConfig` - is a path to .NET project where in Noesis DSL you will specify your scanning rules and architecture conventions
92+
- `externalConfig` - is a path to a new .NET project where you will specify your scanning rules and architecture conventions, using Noesis DSL
93+
94+
### 4.0: Prepare code for analysis in `git-repos`
9195

92-
### 4.0: Make sure the code for analysis is in `git-repos`
96+
Clone the .NET repo for analyis in the `git-repos` directory or make sure that it is already available there. In the tutorial we assume that your repo name is named `my-system-repo`
9397

94-
Clone the .NET repo to the `git-repos` directory or make sure that it is available there. In the tutorial we will assume that your repo name is `my-system-repo`no
98+
```bash
99+
cd git-repos/my-system-repo
100+
git status
101+
```
102+
103+
Make sure that the project in the repo can be succesfully compiled. It should be possible to make `dotnet restore` and `dotnet build` on this project. However you don't need to run these commands right now - just make sure they won't fail as Noesis scanning engine needs to run them independently on a repository copy to perform the succesful scan.
104+
105+
If you are not sure and want to be on the safe side run:
106+
``` bash
107+
dotnet build
108+
```
95109

96110
### 4.1: Create Configuration Project
97111

@@ -107,39 +121,60 @@ dotnet new classlib -n noesis-config
107121
cd noesis-config
108122
```
109123

124+
Now add .NET NuGet packages to the project and test that it compiles
125+
126+
``` bash
127+
dotnet add package NoesisVision.Configuration --prerelease
128+
dotnet build
129+
```
130+
110131
### 4.2: Add Basic Module Configuration
111132

112-
Create the `ArchitectureConventions.cs` file:
133+
Open the project in your IDE and create the `ArchitectureConventions.cs` file.
134+
135+
**Remember to change `../my-system-repo` to the actual path to your project.**
113136

114137
```csharp
115-
using Noesis.Parser;
138+
using Noesis.Parser.Configuration;
116139

117140
namespace NoesisConfig
118141
{
119-
[FullAnalysisConfig]
120-
public static FullAnalysisConfig Create() => FullAnalysisConfigBuilder
121-
.System("My System") // System name in documentation
122-
.Repositories(repositories => repositories
123-
.UseLocal("Main", "../my-system-repo")) // Path to your repository relative to the externalSources dir
124-
.Conventions(conventions => conventions
125-
.ForDomainModules(convention => convention
126-
.UseNamespaceHierarchy())) // Creates modules from namespaces
127-
.Build();
142+
public static class ArchitectureConventions
143+
{
144+
[FullAnalysisConfigAttribute]
145+
public static FullAnalysisConfig Create() => FullAnalysisConfigBuilder
146+
.System("My System") // System name in documentation
147+
.Repositories(repositories => repositories
148+
.UseLocal("Main", "my-system-repo")) // Path to your repository relative to externalSources dir
149+
.Conventions(conventions => conventions
150+
.ForDomainModules(convention => convention
151+
.UseNamespaceHierarchy())) // Creates modules from namespaces
152+
.Build();
153+
}
128154
}
129155
```
130156

157+
Play with the DSL if you want. You should be able additional versions of methods e.g. allowing to specify repository branch (which might be useful if your primary branch is not `main`). Check if the project correctly compiles
158+
159+
``` bash
160+
dotnet build
161+
```
162+
163+
131164
### 4.3: Run with Module Configuration
132165
Navigate back to noesis-workspace
133166
```bash
134167
cd noesis-workspace
135168
```
136169

137-
Run the docker command with the 2 new volumes added. **Please note that for `externalSources` you need to use root `git-repos` directory, not the full link to your repo!**
170+
Run the docker command with the 2 new volumes added.
171+
172+
**Please note that for `externalSources` we use root `git-repos` directory, not the full link to your repo!**
138173

139174
```bash
140175
docker run \
141-
-v ../git-repos/noesis-config:/externalConfig:ro \
142-
-v ../git-repos:/externalSources:ro \
176+
-v $(pwd)/../git-repos/noesis-config:/externalConfig:ro \
177+
-v $(pwd)/../git-repos:/externalSources:ro \
143178
-v ./data:/data \
144179
-v ./license.jwt:/license.jwt:ro \
145180
-p 8088:8080 \
@@ -150,8 +185,28 @@ docker run \
150185
### 4.4: Verify Modules
151186

152187
1. Open `http://localhost:8088`
153-
2. Run a scan of your repository - the scanning may take a while - check logs for details and potential errors.
154-
3. Go to the scan results and click **Modules** section - you should see modules created from your project's namespaces in the tree on the left.
188+
2. Click "Analyze" an run a scan of your repository - the scanning may take a while - check logs for details and potential errors.
189+
Correct logs should look similar to this ones:
190+
```
191+
[10:04:12 INF] Source code setup for system DDD Starter Dotnet started
192+
[10:04:12 INF] Source code setup for system DDD Starter Dotnet finished in 0.02s.
193+
[10:04:12 INF] Source code checkout for system DDD Starter Dotnet started
194+
[10:04:12 INF] Source code checkout for system DDD Starter Dotnet finished in 0.25s.
195+
[10:04:12 INF] Full analysis started for system DDD Starter Dotnet.
196+
[10:04:12 INF] Building intermediate model started
197+
[10:04:52 INF] Loading projects for repository Main started.
198+
[10:05:08 INF] Loading projects for repository Main finished in 16.64s.
199+
[10:05:15 INF] Building intermediate model finished in 62.35s.
200+
[10:05:15 INF] Building P3 model started
201+
[10:05:15 INF] Building P3 model finished in 0.34s.
202+
[10:05:15 INF] Inferencing started
203+
[10:05:15 INF] Inferencing finished in 0.06s.
204+
[10:05:15 INF] Full analysis for system DDD Starter Dotnet finished in 62.92s.
205+
```
206+
3. Go back to the main page and click "Basic mode" to view the scan results. Choose your result.
207+
4. Click **Modules** view - you should see modules created from your project's namespaces in the tree on the left, after you expand it
208+
209+
155210
156211
🎉 **Second Success!** Noesis recognized your system structure and created domain modules.
157212

0 commit comments

Comments
 (0)