Skip to content

Commit d032078

Browse files
authored
Merge pull request #50 from rameel/fix-readme
Refine README files
2 parents 016ecd4 + ec1577e commit d032078

6 files changed

Lines changed: 33 additions & 33 deletions

File tree

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ building upon `Microsoft.Extensions.FileProviders`.
3131

3232
## Projects
3333

34-
This repository contains projects:
34+
This repository contains the following projects:
3535

3636
### Ramstack.FileProviders.Extensions
37-
Offers useful and convenient extensions for `IFileProviders`, bringing its capabilities and experience
38-
closer to what's provided by the `DirectoryInfo` and `FileInfo` standard classes.
37+
Offers useful and convenient extensions for `IFileProvider`, bringing its capabilities and experience
38+
closer to what's provided by the `DirectoryInfo` and `FileInfo` classes.
3939

4040
To install the `Ramstack.FileProviders.Extensions` [NuGet package](https://www.nuget.org/packages/Ramstack.FileProviders.Extensions) in your project,
4141
run the following command:
@@ -87,12 +87,12 @@ This is useful when you need to organize files in a virtual hierarchy.
8787

8888
Example:
8989
```csharp
90-
IFileProvider provider = new PrefixedFileProvider(innerProvider, "/project/app");
90+
IFileProvider provider = new PrefixedFileProvider("/project/app", innerProvider);
9191
IFileInfo file = provider.GetFileInfo("/project/app/docs/README");
9292
Console.WriteLine(file.Exists);
9393
```
9494

95-
This is how you can add virtual directories to your project that are external to the project root:
95+
This is how you can add virtual directories to your project that are outside the project root:
9696
```csharp
9797
string packagesPath = Path.Combine(environment.ContentRootPath, "../Packages");
9898
string themesPath = Path.Combine(environment.ContentRootPath, "../Themes");
@@ -129,11 +129,11 @@ as if they were originally defined within your project.
129129
├── Models
130130
├── Views
131131
├── Packages <-- (virtual)
132-
│ ├── package1
133-
│ └── package2
132+
│ ├── package-1
133+
│ └── package-2
134134
├── Themes <-- (virtual)
135-
│ ├── theme1
136-
│ └── theme2
135+
│ ├── theme-1
136+
│ └── theme-2
137137
└── wwwroot
138138
```
139139

@@ -143,29 +143,29 @@ as if they were originally defined within your project.
143143

144144
Example:
145145
```csharp
146-
IFileProvider provider = new SubFileProvider(innerProvider, "/docs");
146+
IFileProvider provider = new SubFileProvider("/docs", innerProvider);
147147
IFileInfo file = provider.GetFileInfo("/README");
148148
Console.WriteLine(file.Exists);
149149
```
150150

151151
### Ramstack.FileProviders.Globbing
152152

153-
`GlobbingFileProvider` class filters files using include and/or exclude glob patterns. Include patterns make only matching files visible,
153+
The `GlobbingFileProvider` class filters files using include and/or exclude glob patterns. Include patterns make only matching files visible,
154154
while exclude patterns hide specific files. Both include and exclude patterns can be combined for flexible file visibility control.
155155

156156
It relies on the [Ramstack.Globbing](https://www.nuget.org/packages/Ramstack.Globbing) package for its globbing capabilities.
157157

158158
Example:
159159
```csharp
160-
IFileProvider provider = new GlobbingFileProvider(innerProvider, patterns: ["**/*.txt", "docs/*.md" ], excludes: ["**/README.md"]);
160+
IFileProvider provider = new GlobbingFileProvider(innerProvider, patterns: ["**/*.txt", "docs/*.md"], excludes: ["**/README.md"]);
161161
foreach (IFileInfo file in provider.GetDirectoryContents("/"))
162162
Console.WriteLine(file.Name);
163163
```
164164

165165
### Ramstack.FileProviders.Extensions
166166

167-
Provides useful extensions for `IFileProvider`, bringing its capabilities and experience closer to what's being
168-
provided by `DirectoryInfo` and `FileInfo` classes.
167+
Provides useful extensions for `IFileProvider`, bringing its capabilities and experience closer to what's
168+
provided by the `DirectoryInfo` and `FileInfo` classes.
169169

170170
Simply stated, a `FileNode` knows which directory it is located in, and a directory represented by the `DirectoryNode` class can access
171171
its parent directory and list all files within it, recursively.
@@ -242,15 +242,15 @@ builder.Environment.ContentRootFileProvider = FileProviderComposer.FlattenProvid
242242
#### Composing Providers
243243

244244
The `ComposeProviders` method combines a list of `IFileProvider` instances into a single `IFileProvider`.
245-
During this process, all encountered `CompositeFileProvider` instances recursively flattened and merged into a single level.
246-
This eliminates unnecessary indirectness and streamline the file provider hierarchy.
245+
During this process, all encountered `CompositeFileProvider` instances are recursively flattened and merged into a single level.
246+
This eliminates unnecessary indirectness and streamlines the file provider hierarchy.
247247

248248
```csharp
249249
string packagesPath = Path.Combine(environment.ContentRootPath, "../Packages");
250250
string themesPath = Path.Combine(environment.ContentRootPath, "../Themes");
251251

252252
environment.ContentRootFileProvider = FileProviderComposer.ComposeProviders(
253-
// Inject external Modules directory
253+
// Inject external Packages directory
254254
new PrefixedFileProvider("/Packages", new PhysicalFileProvider(packagesPath)),
255255

256256
// Inject external Themes directory
@@ -261,7 +261,7 @@ environment.ContentRootFileProvider = FileProviderComposer.ComposeProviders(
261261
```
262262

263263
In this example, the `ComposeProviders` method handles any unnecessary nesting that might occur, including when the current
264-
`environment.ContentRootFileProvider` is a `CompositeFileProvider`. This ensures that all file providers merged into a single
264+
`environment.ContentRootFileProvider` is a `CompositeFileProvider`. This ensures that all file providers are merged into a single
265265
flat structure, avoiding unnecessary indirectness.
266266

267267
#### Flattening Change Tokens

src/Ramstack.FileProviders.Composition/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ builder.Environment.ContentRootFileProvider = FileProviderComposer.FlattenProvid
3131

3232
## Composing Providers
3333
The `ComposeProviders` method combines a list of `IFileProvider` instances into a single `IFileProvider`.
34-
During this process, all encountered `CompositeFileProvider` instances recursively flattened and merged into a single level.
35-
This eliminates unnecessary indirectness and streamline the file provider hierarchy.
34+
During this process, all encountered `CompositeFileProvider` instances are recursively flattened and merged into a single level.
35+
This eliminates unnecessary indirectness and streamlines the file provider hierarchy.
3636

3737
```csharp
3838
string packagesPath = Path.Combine(environment.ContentRootPath, "../Packages");
3939
string themesPath = Path.Combine(environment.ContentRootPath, "../Themes");
4040

4141
environment.ContentRootFileProvider = FileProviderComposer.ComposeProviders(
42-
// Inject external Modules directory
42+
// Inject external Packages directory
4343
new PrefixedFileProvider("/Packages", new PhysicalFileProvider(packagesPath)),
4444

4545
// Inject external Themes directory

src/Ramstack.FileProviders.Extensions/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dotnet add package Ramstack.FileProviders.Extensions
1616
## Overview
1717

1818
The library provides useful extensions for `IFileProvider`, bringing its capabilities and experience
19-
closer to what's being provided by `DirectoryInfo` and `FileInfo` classes.
19+
closer to what's provided by the `DirectoryInfo` and `FileInfo` classes.
2020

2121
Simply stated, a `FileNode` knows which directory it is located in, and a directory represented
2222
by the `DirectoryNode` class can access its parent directory and list all files within it, recursively.

src/Ramstack.FileProviders.Globbing/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ dotnet add package Ramstack.FileProviders.Globbing
1414
```
1515

1616
## GlobbingFileProvider
17-
`GlobbingFileProvider` class filters files using include and/or exclude glob patterns. Include patterns make only matching files visible,
17+
The `GlobbingFileProvider` class filters files using include and/or exclude glob patterns. Include patterns make only matching files visible,
1818
while exclude patterns hide specific files. Both include and exclude patterns can be combined for flexible file visibility control.
1919

2020
It relies on the [Ramstack.Globbing](https://www.nuget.org/packages/Ramstack.Globbing) package for its globbing capabilities.
2121

2222
Example:
2323
```csharp
24-
IFileProvider provider = new GlobbingFileProvider(innerProvider, patterns: ["**/*.txt", "docs/*.md" ], excludes: ["**/README.md"]);
24+
IFileProvider provider = new GlobbingFileProvider(innerProvider, patterns: ["**/*.txt", "docs/*.md"], excludes: ["**/README.md"]);
2525
foreach (IFileInfo file in provider.GetDirectoryContents("/"))
2626
Console.WriteLine(file.Name);
2727
```

src/Ramstack.FileProviders/PrefixedFileProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public void Dispose() =>
194194
// Strategy:
195195
// - Preserve '**' to allow arbitrary depth
196196
// - Drop ambiguous intermediate segments
197-
// - Keep only the final segment if it is a file pattern (e.g. '*.js')
197+
// - Keep only the final segment after '**', if any (e.g. '*.js')
198198
//
199199
// This guarantees:
200200
// - No false negatives caused by prefix misalignment

src/Ramstack.FileProviders/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![NuGet](https://img.shields.io/nuget/v/Ramstack.FileProviders.svg)](https://nuget.org/packages/Ramstack.FileProviders)
33
[![MIT](https://img.shields.io/github/license/rameel/ramstack.fileproviders)](https://github.com/rameel/ramstack.fileproviders/blob/main/LICENSE)
44

5-
Represents a .NET library that provides additional implementations for `Microsoft.Extensions.FileProviders` including:
5+
Represents a .NET library that provides additional implementations of `IFileProvider` including:
66
- `PrefixedFileProvider`
77
- `SubFileProvider`
88

@@ -22,12 +22,12 @@ This is useful when you need to organize files in a virtual hierarchy.
2222

2323
Example:
2424
```csharp
25-
IFileProvider provider = new PrefixedFileProvider(innerProvider, "/project/app");
25+
IFileProvider provider = new PrefixedFileProvider("/project/app", innerProvider);
2626
IFileInfo file = provider.GetFileInfo("/project/app/docs/README");
2727
Console.WriteLine(file.Exists);
2828
```
2929

30-
This is how you can add virtual directories to your project that are external to the project root:
30+
This is how you can add virtual directories to your project that are outside the project root:
3131
```csharp
3232
string packagesPath = Path.Combine(environment.ContentRootPath, "../Packages");
3333
string themesPath = Path.Combine(environment.ContentRootPath, "../Themes");
@@ -64,11 +64,11 @@ as if they were originally defined within your project.
6464
├── Models
6565
├── Views
6666
├── Packages <-- (virtual)
67-
│ ├── package1
68-
│ └── package2
67+
│ ├── package-1
68+
│ └── package-2
6969
├── Themes <-- (virtual)
70-
│ ├── theme1
71-
│ └── theme2
70+
│ ├── theme-1
71+
│ └── theme-2
7272
└── wwwroot
7373
```
7474

@@ -77,7 +77,7 @@ as if they were originally defined within your project.
7777

7878
Example:
7979
```csharp
80-
IFileProvider provider = new SubFileProvider(innerProvider, "/docs");
80+
IFileProvider provider = new SubFileProvider("/docs", innerProvider);
8181
IFileInfo file = provider.GetFileInfo("/README");
8282
Console.WriteLine(file.Exists);
8383
```

0 commit comments

Comments
 (0)