Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: CI
on:
push:
branches: ["main"]
tags: ["v*"]
pull_request:

jobs:
Expand All @@ -25,3 +26,55 @@ jobs:

- name: Test
run: dotnet test --no-build --verbosity normal RipSharp.sln

pack-tool:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x

- name: Get version from tag
id: version
run: echo "value=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"

- name: Validate tag format
run: |
if [[ ! "${{ steps.version.outputs.value }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag must match vMAJOR.MINOR.PATCH (e.g., v1.2.3)."
exit 1
fi

- name: Restore
run: dotnet restore RipSharp.sln

- name: Build
run: dotnet build --no-restore -c Release RipSharp.sln

- name: Pack
run: dotnet pack --no-build -c Release src/RipSharp /p:Version=${{ steps.version.outputs.value }}

- name: Get OIDC token
id: oidc
uses: actions/github-script@v7
with:
script: |
const token = await core.getIDToken('https://int.nugettest.org');
core.setOutput('token', token);

- name: Publish to NuGet
run: dotnet nuget push src/RipSharp/bin/Release/*.nupkg --api-key "${{ steps.oidc.outputs.token }}" --source https://int.nugettest.org/v3/index.json

- name: Upload package
uses: actions/upload-artifact@v4
with:
name: ripsharp-nupkg
path: src/RipSharp/bin/Release/*.nupkg
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all build test format clean restore help
.PHONY: all build test format clean restore pack help

# Default target: build and test the solution
all: build test
Expand All @@ -11,6 +11,7 @@ help:
@echo " make build - Build the solution"
@echo " make format - Run dotnet format"
@echo " make test - Run tests"
@echo " make pack - Build NuGet package (Release)"
@echo " make clean - Clean build outputs"

# Restore NuGet packages
Expand All @@ -29,6 +30,10 @@ format:
test: build
dotnet test RipSharp.sln

# Build NuGet package (Release)
pack: build
dotnet pack -c Release src/RipSharp

# Clean build outputs
clean:
dotnet clean RipSharp.sln
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,35 @@
dotnet run --project src/RipSharp -- --output ~/Movies --disc "file:/path/to/movie.iso"
```

## Install as a Global Tool

Install from NuGet:

```bash
dotnet tool install -g BugZapperLabs.RipSharp
```

Run:

```bash
ripsharp --output ~/Movies
```

Check the version:

```bash
ripsharp --version
```

### Pack and install locally

```bash
dotnet pack -c Release src/RipSharp /p:Version=0.1.0
dotnet tool install -g BugZapperLabs.RipSharp --add-source src/RipSharp/bin/Release
```

If you version from git tags in CI, pass the tag version as `/p:Version=1.2.3` during `dotnet pack`.

## Options

### Required
Expand All @@ -139,6 +168,7 @@
| `--sequential` | Disable parallel processing (rip all, then encode all) |
| `--debug` | Enable debug logging |
| `-h, --help` | Show help message |
| `-v, --version` | Show application version |

### Environment Variables

Expand Down
37 changes: 35 additions & 2 deletions src/RipSharp.Tests/Core/RipOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

using AwesomeAssertions;

using RipSharp;
using BugZapperLabs.RipSharp;

using Xunit;

namespace RipSharp.Tests.Core;
namespace BugZapperLabs.RipSharp.Tests.Core;

public class RipOptionsTests
{
Expand Down Expand Up @@ -51,6 +51,39 @@ public void ParseArgs_WithHelpAmongOtherArgs_SetsShowHelpTrue()
result.ShowHelp.Should().BeTrue();
}

[Fact]
public void ParseArgs_WithVersionShortFlag_SetsShowVersionTrue()
{
var args = new[] { "-v" };

var result = RipOptions.ParseArgs(args);

result.ShowVersion.Should().BeTrue();
result.ShowHelp.Should().BeFalse();
}

[Fact]
public void ParseArgs_WithVersionLongFlag_SetsShowVersionTrue()
{
var args = new[] { "--version" };

var result = RipOptions.ParseArgs(args);

result.ShowVersion.Should().BeTrue();
result.ShowHelp.Should().BeFalse();
}

[Fact]
public void ParseArgs_WithVersionAmongOtherArgs_SetsShowVersionTrue()
{
var args = new[] { "--output", "/tmp", "--version" };

var result = RipOptions.ParseArgs(args);

result.ShowVersion.Should().BeTrue();
result.ShowHelp.Should().BeFalse();
}

[Fact]
public void ParseArgs_WithoutOutput_ThrowsArgumentException()
{
Expand Down
14 changes: 7 additions & 7 deletions src/RipSharp.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Global using directives for test files
global using AwesomeAssertions;

global using RipSharp.Abstractions;
global using RipSharp.Core;
global using RipSharp.MakeMkv;
global using RipSharp.Metadata;
global using RipSharp.Models;
global using RipSharp.Services;
global using RipSharp.Utilities;
global using BugZapperLabs.RipSharp.Abstractions;
global using BugZapperLabs.RipSharp.Core;
global using BugZapperLabs.RipSharp.MakeMkv;
global using BugZapperLabs.RipSharp.Metadata;
global using BugZapperLabs.RipSharp.Models;
global using BugZapperLabs.RipSharp.Services;
global using BugZapperLabs.RipSharp.Utilities;
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/MakeMkv/MakeMkvProtocolTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using AwesomeAssertions;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.MakeMkv;
namespace BugZapperLabs.RipSharp.Tests.MakeMkv;

public class MakeMkvProtocolTests
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Metadata/MetadataServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

using NSubstitute;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.Metadata;
namespace BugZapperLabs.RipSharp.Tests.Metadata;

public class MetadataServiceTests : IDisposable
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Metadata/OmdbMetadataProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

using NSubstitute;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.Metadata;
namespace BugZapperLabs.RipSharp.Tests.Metadata;

public class OmdbMetadataProviderTests
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Collections.Generic;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.Metadata;
namespace BugZapperLabs.RipSharp.Tests.Metadata;

public class TitleVariationGeneratorEdgeCasesTests
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Metadata/TitleVariationGeneratorTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Collections.Generic;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.Metadata;
namespace BugZapperLabs.RipSharp.Tests.Metadata;

public class TitleVariationGeneratorTests
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Metadata/TmdbMetadataProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

using NSubstitute;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.Metadata;
namespace BugZapperLabs.RipSharp.Tests.Metadata;

public class TmdbMetadataProviderTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

using AwesomeAssertions;

using RipSharp.Abstractions;
using RipSharp.Services;

using Xunit;

namespace RipSharp.Tests.Services;
namespace BugZapperLabs.RipSharp.Tests.Services;

public class DiscRipperOverallProgressTests
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Services/DiscRipperRipSummaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

using AwesomeAssertions;

using RipSharp.Services;

using Xunit;

namespace RipSharp.Tests.Services;
namespace BugZapperLabs.RipSharp.Tests.Services;

public class DiscRipperRipSummaryTests
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Services/DiscTypeDetectorTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using System.Collections.Generic;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.Services;
namespace BugZapperLabs.RipSharp.Tests.Services;

public class DiscTypeDetectorTests
{
Expand Down
2 changes: 1 addition & 1 deletion src/RipSharp.Tests/Utilities/CursorManagerTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace RipSharp.Utilities;
namespace BugZapperLabs.RipSharp.Tests.Utilities;

public class CursorManagerTests
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Utilities/DurationFormatterTests.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using AwesomeAssertions;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.Utilities;
namespace BugZapperLabs.RipSharp.Tests.Utilities;

public class DurationFormatterTests
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Utilities/FileNamingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

using AwesomeAssertions;

using RipSharp;

using Xunit;

namespace RipSharp.Tests.Utilities;
namespace BugZapperLabs.RipSharp.Tests.Utilities;

public class FileNamingTests
{
Expand Down
4 changes: 1 addition & 3 deletions src/RipSharp.Tests/Utilities/SpectreProgressDisplayTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

using AwesomeAssertions;

using RipSharp.Utilities;

using Xunit;

namespace RipSharp.Tests.Utilities;
namespace BugZapperLabs.RipSharp.Tests.Utilities;

public class SpectreProgressDisplayTests
{
Expand Down
2 changes: 1 addition & 1 deletion src/RipSharp/Abstractions/IConsoleWriter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace RipSharp.Abstractions;
namespace BugZapperLabs.RipSharp.Abstractions;

/// <summary>
/// Abstraction for writing styled output messages to the console.
Expand Down
2 changes: 1 addition & 1 deletion src/RipSharp/Abstractions/IDiscRipper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace RipSharp.Abstractions;
namespace BugZapperLabs.RipSharp.Abstractions;

public interface IDiscRipper
{
Expand Down
2 changes: 1 addition & 1 deletion src/RipSharp/Abstractions/IDiscScanner.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace RipSharp.Abstractions;
namespace BugZapperLabs.RipSharp.Abstractions;

public interface IDiscScanner
{
Expand Down
2 changes: 1 addition & 1 deletion src/RipSharp/Abstractions/IDiscTypeDetector.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace RipSharp.Abstractions;
namespace BugZapperLabs.RipSharp.Abstractions;

/// <summary>
/// Interface for detecting the type of content on a disc (movie vs TV series).
Expand Down
2 changes: 1 addition & 1 deletion src/RipSharp/Abstractions/IEncoderService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace RipSharp.Abstractions;
namespace BugZapperLabs.RipSharp.Abstractions;

public interface IEncoderService
{
Expand Down
Loading