Skip to content

Commit

Permalink
Merge pull request #15 from rameel/cleanup
Browse files Browse the repository at this point in the history
Clean up and formatting
  • Loading branch information
rameel authored Sep 4, 2024
2 parents f45048c + 7e6548e commit 9ad279b
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 35 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,33 @@ on:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+"

permissions:
contents: write

jobs:
publish:
name: "Publish packages"
runs-on: ubuntu-latest
steps:
- name: Setup .NET
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Checkout
uses: actions/checkout@v4

- name: Build
- name: Build Solution
run: dotnet build -c Release

- name: Pack
- name: Create NuGet Packages
run: dotnet pack -c Release -o ./nuget --no-build

- name: Publish
- name: Publish NuGet Packages
run: dotnet nuget push ./nuget/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate -s https://api.nuget.org/v3/index.json

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: nuget/*
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ public class Program
{
var file = fs.GetFile("/sample/hello.txt");

if (await file.ExistsAsync())
{
Console.WriteLine($"Deleting file '{file.FullName}'");
await file.DeleteAsync();
}

Console.WriteLine($"Writing 'Hello, World!' to '{file.FullName}'");

await using (Stream stream = await file.OpenWriteAsync())
Expand All @@ -48,6 +42,9 @@ public class Program
await file.WriteAsync(input, overwrite: true);

Console.WriteLine($"The file '{file.Name}' has a length of {await file.GetLengthAsync()} bytes");

Console.WriteLine($"Deleting file '{file.FullName}'");
await file.DeleteAsync();
}
}
```
Expand Down Expand Up @@ -140,13 +137,15 @@ if (!fs.IsReadOnly)
## Related Projects
- [Ramstack.FileSystem.Abstractions](https://www.nuget.org/packages/Ramstack.FileSystem.Abstractions) - Provides a virtual file system abstraction.
- [Ramstack.FileSystem.Physical](https://www.nuget.org/packages/Ramstack.FileSystem.Physical) - Provides an implementation based on the local file system.
- [Ramstack.FileSystem.Azure](https://www.nuget.org/packages/Ramstack.FileSystem.Azure) - Provides an implementation based on Azure Blob Storage.
- [Ramstack.FileSystem.Azure](https://www.nuget.org/packages/Ramstack.FileSystem.Azure) - Provides an implementation using Azure Blob storage.
- [Ramstack.FileSystem.Amazon](https://www.nuget.org/packages/Ramstack.FileSystem.Amazon) - Provides an implementation using Amazon S3 storage.
- [Ramstack.FileSystem.Zip](https://www.nuget.org/packages/Ramstack.FileSystem.Zip) - Provides an implementation based on ZIP archives.
- [Ramstack.FileSystem.Readonly](https://www.nuget.org/packages/Ramstack.FileSystem.Readonly) - Provides a read-only wrapper for the underlying file system.
- [Ramstack.FileSystem.Globbing](https://www.nuget.org/packages/Ramstack.FileSystem.Globbing) - Wraps the file system, filtering files and directories using glob patterns.
- [Ramstack.FileSystem.Prefixed](https://www.nuget.org/packages/Ramstack.FileSystem.Prefixed) - Adds a prefix to file paths within the underlying file system.
- [Ramstack.FileSystem.Sub](https://www.nuget.org/packages/Ramstack.FileSystem.Sub) - Wraps the underlying file system, restricting access to a specific subpath.
- [Ramstack.FileSystem.Adapters](https://www.nuget.org/packages/Ramstack.FileSystem.Adapters) - Provides integration with `Microsoft.Extensions.FileProviders`.
- [Ramstack.FileSystem.Composite](https://www.nuget.org/packages/Ramstack.FileSystem.Composite) - Provides an implementation that combines multiple file systems into a single composite file system.

## Supported Versions

Expand Down
13 changes: 6 additions & 7 deletions src/Ramstack.FileSystem.Abstractions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ public class Program
{
var file = fs.GetFile("/sample/hello.txt");

if (await file.ExistsAsync())
{
Console.WriteLine($"Deleting file '{file.FullName}'");
await file.DeleteAsync();
}

Console.WriteLine($"Writing 'Hello, World!' to '{file.FullName}'");

await using (Stream stream = await file.OpenWriteAsync())
Expand All @@ -57,6 +51,9 @@ public class Program
await file.WriteAsync(input, overwrite: true);

Console.WriteLine($"The file '{file.Name}' has a length of {await file.GetLengthAsync()} bytes");

Console.WriteLine($"Deleting file '{file.FullName}'");
await file.DeleteAsync();
}
}
```
Expand Down Expand Up @@ -148,13 +145,15 @@ if (!fs.IsReadOnly)

## Related Projects
- [Ramstack.FileSystem.Physical](https://www.nuget.org/packages/Ramstack.FileSystem.Physical) - Provides an implementation based on the local file system.
- [Ramstack.FileSystem.Azure](https://www.nuget.org/packages/Ramstack.FileSystem.Azure) - Provides an implementation based on Azure Blob Storage.
- [Ramstack.FileSystem.Azure](https://www.nuget.org/packages/Ramstack.FileSystem.Azure) - Provides an implementation using Azure Blob storage.
- [Ramstack.FileSystem.Amazon](https://www.nuget.org/packages/Ramstack.FileSystem.Amazon) - Provides an implementation using Amazon S3 storage.
- [Ramstack.FileSystem.Zip](https://www.nuget.org/packages/Ramstack.FileSystem.Zip) - Provides an implementation based on ZIP archives.
- [Ramstack.FileSystem.Readonly](https://www.nuget.org/packages/Ramstack.FileSystem.Readonly) - Provides a read-only wrapper for the underlying file system.
- [Ramstack.FileSystem.Globbing](https://www.nuget.org/packages/Ramstack.FileSystem.Globbing) - Wraps the file system, filtering files and directories using glob patterns.
- [Ramstack.FileSystem.Prefixed](https://www.nuget.org/packages/Ramstack.FileSystem.Prefixed) - Adds a prefix to file paths within the underlying file system.
- [Ramstack.FileSystem.Sub](https://www.nuget.org/packages/Ramstack.FileSystem.Sub) - Wraps the underlying file system, restricting access to a specific subpath.
- [Ramstack.FileSystem.Adapters](https://www.nuget.org/packages/Ramstack.FileSystem.Adapters) - Provides integration with `Microsoft.Extensions.FileProviders`.
- [Ramstack.FileSystem.Composite](https://www.nuget.org/packages/Ramstack.FileSystem.Composite) - Provides an implementation that combines multiple file systems into a single composite file system.

## Supported Versions

Expand Down
12 changes: 12 additions & 0 deletions src/Ramstack.FileSystem.Adapters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ await foreach (VirtualFile file in fs.GetFilesAsync("/"))
}
```

## Related Projects
- [Ramstack.FileSystem.Abstractions](https://www.nuget.org/packages/Ramstack.FileSystem.Abstractions) - Provides a virtual file system abstraction.
- [Ramstack.FileSystem.Physical](https://www.nuget.org/packages/Ramstack.FileSystem.Physical) - Provides an implementation based on the local file system.
- [Ramstack.FileSystem.Azure](https://www.nuget.org/packages/Ramstack.FileSystem.Azure) - Provides an implementation using Azure Blob storage.
- [Ramstack.FileSystem.Amazon](https://www.nuget.org/packages/Ramstack.FileSystem.Amazon) - Provides an implementation using Amazon S3 storage.
- [Ramstack.FileSystem.Zip](https://www.nuget.org/packages/Ramstack.FileSystem.Zip) - Provides an implementation based on ZIP archives.
- [Ramstack.FileSystem.Readonly](https://www.nuget.org/packages/Ramstack.FileSystem.Readonly) - Provides a read-only wrapper for the underlying file system.
- [Ramstack.FileSystem.Globbing](https://www.nuget.org/packages/Ramstack.FileSystem.Globbing) - Wraps the file system, filtering files and directories using glob patterns.
- [Ramstack.FileSystem.Prefixed](https://www.nuget.org/packages/Ramstack.FileSystem.Prefixed) - Adds a prefix to file paths within the underlying file system.
- [Ramstack.FileSystem.Sub](https://www.nuget.org/packages/Ramstack.FileSystem.Sub) - Wraps the underlying file system, restricting access to a specific subpath.
- [Ramstack.FileSystem.Composite](https://www.nuget.org/packages/Ramstack.FileSystem.Composite) - Provides an implementation that combines multiple file systems into a single composite file system.

## Supported versions

| | Version |
Expand Down
28 changes: 20 additions & 8 deletions src/Ramstack.FileSystem.Amazon/AmazonS3FileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,36 @@ public AmazonS3FileSystem(AWSCredentials credentials, AmazonS3Config config, str
/// <summary>
/// Initializes a new instance of the <see cref="AmazonS3FileSystem"/> class using AWS access keys and region name.
/// </summary>
/// <param name="awsAccessKeyId">The AWS access key ID.</param>
/// <param name="awsSecretAccessKey">The AWS secret access key.</param>
/// <param name="accessKeyId">The AWS access key ID.</param>
/// <param name="secretAccessKey">The AWS secret access key.</param>
/// <param name="regionName">The name of the AWS region.</param>
/// <param name="bucketName">The name of the S3 bucket.</param>
public AmazonS3FileSystem(string awsAccessKeyId, string awsSecretAccessKey, string regionName, string bucketName)
: this(awsAccessKeyId, awsSecretAccessKey, RegionEndpoint.GetBySystemName(regionName), bucketName)
public AmazonS3FileSystem(string accessKeyId, string secretAccessKey, string regionName, string bucketName)
: this(accessKeyId, secretAccessKey, RegionEndpoint.GetBySystemName(regionName), bucketName)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AmazonS3FileSystem"/> class using AWS access keys and region endpoint.
/// </summary>
/// <param name="awsAccessKeyId">The AWS access key ID.</param>
/// <param name="awsSecretAccessKey">The AWS secret access key.</param>
/// <param name="accessKeyId">The AWS access key ID.</param>
/// <param name="secretAccessKey">The AWS secret access key.</param>
/// <param name="region">The AWS region endpoint.</param>
/// <param name="bucketName">The name of the S3 bucket.</param>
public AmazonS3FileSystem(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region, string bucketName)
: this(new BasicAWSCredentials(awsAccessKeyId, awsSecretAccessKey), new AmazonS3Config { RegionEndpoint = region }, bucketName)
public AmazonS3FileSystem(string accessKeyId, string secretAccessKey, RegionEndpoint region, string bucketName)
: this(new BasicAWSCredentials(accessKeyId, secretAccessKey), new AmazonS3Config { RegionEndpoint = region }, bucketName)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AmazonS3FileSystem"/> class using AWS access keys and region endpoint.
/// </summary>
/// <param name="accessKeyId">The AWS access key ID.</param>
/// <param name="secretAccessKey">The AWS secret access key.</param>
/// <param name="config">The Amazon S3 configuration settings.</param>
/// <param name="bucketName">The name of the S3 bucket.</param>
public AmazonS3FileSystem(string accessKeyId, string secretAccessKey, AmazonS3Config config, string bucketName)
: this(new BasicAWSCredentials(accessKeyId, secretAccessKey), config, bucketName)
{
}

Expand Down
45 changes: 45 additions & 0 deletions src/Ramstack.FileSystem.Amazon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,51 @@ in your project, run the following command:
```console
dotnet add package Ramstack.FileSystem.Amazon
```

## Usage

```csharp
using Ramstack.FileSystem.Amazon;

AmazonS3FileSystem fs = new AmazonS3FileSystem(
accessKeyId: "...",
secretAccessKey: "...",
region: RegionEndpoint.USEast1,
bucketName: "my-storage");

// Create S3 bucket if it doesn't exist
await fs.CreateBucketAsync(AccessControl.Private);

await foreach (VirtualFile file in fs.GetFilesAsync("/"))
{
Console.WriteLine(node.Name);
}
```

You can also configure the file system to be read-only:
```csharp
AmazonS3FileSystem fs = new AmazonS3FileSystem(
accessKeyId: "...",
secretAccessKey: "...",
region: RegionEndpoint.USEast1,
bucketName: "my-storage")
{
IsReadOnly = true
};
```

## Related Projects
- [Ramstack.FileSystem.Abstractions](https://www.nuget.org/packages/Ramstack.FileSystem.Abstractions) - Provides a virtual file system abstraction.
- [Ramstack.FileSystem.Physical](https://www.nuget.org/packages/Ramstack.FileSystem.Physical) - Provides an implementation based on the local file system.
- [Ramstack.FileSystem.Azure](https://www.nuget.org/packages/Ramstack.FileSystem.Azure) - Provides an implementation using Azure Blob storage.
- [Ramstack.FileSystem.Zip](https://www.nuget.org/packages/Ramstack.FileSystem.Zip) - Provides an implementation based on ZIP archives.
- [Ramstack.FileSystem.Readonly](https://www.nuget.org/packages/Ramstack.FileSystem.Readonly) - Provides a read-only wrapper for the underlying file system.
- [Ramstack.FileSystem.Globbing](https://www.nuget.org/packages/Ramstack.FileSystem.Globbing) - Wraps the file system, filtering files and directories using glob patterns.
- [Ramstack.FileSystem.Prefixed](https://www.nuget.org/packages/Ramstack.FileSystem.Prefixed) - Adds a prefix to file paths within the underlying file system.
- [Ramstack.FileSystem.Sub](https://www.nuget.org/packages/Ramstack.FileSystem.Sub) - Wraps the underlying file system, restricting access to a specific subpath.
- [Ramstack.FileSystem.Adapters](https://www.nuget.org/packages/Ramstack.FileSystem.Adapters) - Provides integration with `Microsoft.Extensions.FileProviders`.
- [Ramstack.FileSystem.Composite](https://www.nuget.org/packages/Ramstack.FileSystem.Composite) - Provides an implementation that combines multiple file systems into a single composite file system.

## Supported versions

| | Version |
Expand Down
26 changes: 17 additions & 9 deletions src/Ramstack.FileSystem.Azure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ dotnet add package Ramstack.FileSystem.Azure
```csharp
using Ramstack.FileSystem.Azure;

AzureFileSystemOptions options = new AzureFileSystemOptions()
{
ConnectionString = "...",
Public = true
};
string connectionString = "...";
AzureFileSystem fs = new AzureFileSystem(connectionString, containerName: "storage");

AzureFileSystem fs = new AzureFileSystem(containerName: "data", options);
// Create Azure container if it doesn't exist
await fs.CreateContainerAsync(PublicAccessType.None);

await foreach (VirtualFile file in fs.GetFilesAsync("/"))
{
Expand All @@ -30,14 +28,24 @@ await foreach (VirtualFile file in fs.GetFilesAsync("/"))

You can also configure the file system to be read-only:
```csharp
using Ramstack.FileSystem.Physical;

AzureFileSystem fs = new AzureFileSystem(containerName: "data", options)
AzureFileSystem fs = new AzureFileSystem(connectionString, containerName: "storage")
{
IsReadOnly = true
};
```

## Related Projects
- [Ramstack.FileSystem.Abstractions](https://www.nuget.org/packages/Ramstack.FileSystem.Abstractions) - Provides a virtual file system abstraction.
- [Ramstack.FileSystem.Physical](https://www.nuget.org/packages/Ramstack.FileSystem.Physical) - Provides an implementation based on the local file system.
- [Ramstack.FileSystem.Amazon](https://www.nuget.org/packages/Ramstack.FileSystem.Amazon) - Provides an implementation using Amazon S3 storage.
- [Ramstack.FileSystem.Zip](https://www.nuget.org/packages/Ramstack.FileSystem.Zip) - Provides an implementation based on ZIP archives.
- [Ramstack.FileSystem.Readonly](https://www.nuget.org/packages/Ramstack.FileSystem.Readonly) - Provides a read-only wrapper for the underlying file system.
- [Ramstack.FileSystem.Globbing](https://www.nuget.org/packages/Ramstack.FileSystem.Globbing) - Wraps the file system, filtering files and directories using glob patterns.
- [Ramstack.FileSystem.Prefixed](https://www.nuget.org/packages/Ramstack.FileSystem.Prefixed) - Adds a prefix to file paths within the underlying file system.
- [Ramstack.FileSystem.Sub](https://www.nuget.org/packages/Ramstack.FileSystem.Sub) - Wraps the underlying file system, restricting access to a specific subpath.
- [Ramstack.FileSystem.Adapters](https://www.nuget.org/packages/Ramstack.FileSystem.Adapters) - Provides integration with `Microsoft.Extensions.FileProviders`.
- [Ramstack.FileSystem.Composite](https://www.nuget.org/packages/Ramstack.FileSystem.Composite) - Provides an implementation that combines multiple file systems into a single composite file system.

## Supported versions

| | Version |
Expand Down
12 changes: 12 additions & 0 deletions src/Ramstack.FileSystem.Composite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ await foreach (VirtualFile file in fs.GetFilesAsync("/"))
}
```

## Related Projects
- [Ramstack.FileSystem.Abstractions](https://www.nuget.org/packages/Ramstack.FileSystem.Abstractions) - Provides a virtual file system abstraction.
- [Ramstack.FileSystem.Physical](https://www.nuget.org/packages/Ramstack.FileSystem.Physical) - Provides an implementation based on the local file system.
- [Ramstack.FileSystem.Azure](https://www.nuget.org/packages/Ramstack.FileSystem.Azure) - Provides an implementation using Azure Blob storage.
- [Ramstack.FileSystem.Amazon](https://www.nuget.org/packages/Ramstack.FileSystem.Amazon) - Provides an implementation using Amazon S3 storage.
- [Ramstack.FileSystem.Zip](https://www.nuget.org/packages/Ramstack.FileSystem.Zip) - Provides an implementation based on ZIP archives.
- [Ramstack.FileSystem.Readonly](https://www.nuget.org/packages/Ramstack.FileSystem.Readonly) - Provides a read-only wrapper for the underlying file system.
- [Ramstack.FileSystem.Globbing](https://www.nuget.org/packages/Ramstack.FileSystem.Globbing) - Wraps the file system, filtering files and directories using glob patterns.
- [Ramstack.FileSystem.Prefixed](https://www.nuget.org/packages/Ramstack.FileSystem.Prefixed) - Adds a prefix to file paths within the underlying file system.
- [Ramstack.FileSystem.Sub](https://www.nuget.org/packages/Ramstack.FileSystem.Sub) - Wraps the underlying file system, restricting access to a specific subpath.
- [Ramstack.FileSystem.Adapters](https://www.nuget.org/packages/Ramstack.FileSystem.Adapters) - Provides integration with `Microsoft.Extensions.FileProviders`.

## Supported versions

| | Version |
Expand Down
12 changes: 12 additions & 0 deletions src/Ramstack.FileSystem.Globbing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ await foreach (VirtualFile file in fs.GetFilesAsync("/"))
}
```

## Related Projects
- [Ramstack.FileSystem.Abstractions](https://www.nuget.org/packages/Ramstack.FileSystem.Abstractions) - Provides a virtual file system abstraction.
- [Ramstack.FileSystem.Physical](https://www.nuget.org/packages/Ramstack.FileSystem.Physical) - Provides an implementation based on the local file system.
- [Ramstack.FileSystem.Azure](https://www.nuget.org/packages/Ramstack.FileSystem.Azure) - Provides an implementation using Azure Blob storage.
- [Ramstack.FileSystem.Amazon](https://www.nuget.org/packages/Ramstack.FileSystem.Amazon) - Provides an implementation using Amazon S3 storage.
- [Ramstack.FileSystem.Zip](https://www.nuget.org/packages/Ramstack.FileSystem.Zip) - Provides an implementation based on ZIP archives.
- [Ramstack.FileSystem.Readonly](https://www.nuget.org/packages/Ramstack.FileSystem.Readonly) - Provides a read-only wrapper for the underlying file system.
- [Ramstack.FileSystem.Prefixed](https://www.nuget.org/packages/Ramstack.FileSystem.Prefixed) - Adds a prefix to file paths within the underlying file system.
- [Ramstack.FileSystem.Sub](https://www.nuget.org/packages/Ramstack.FileSystem.Sub) - Wraps the underlying file system, restricting access to a specific subpath.
- [Ramstack.FileSystem.Adapters](https://www.nuget.org/packages/Ramstack.FileSystem.Adapters) - Provides integration with `Microsoft.Extensions.FileProviders`.
- [Ramstack.FileSystem.Composite](https://www.nuget.org/packages/Ramstack.FileSystem.Composite) - Provides an implementation that combines multiple file systems into a single composite file system.

## Supported versions

| | Version |
Expand Down
Loading

0 comments on commit 9ad279b

Please sign in to comment.