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
37 changes: 0 additions & 37 deletions .github/workflows/actions.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Deployment

on:
push:
tags:
- 'v*'
- '[0-9]*'

jobs:
create-docc-and-deploy:
uses: BinaryBirds/github-workflows/.github/workflows/docc_deploy.yml@main
permissions:
contents: read
pages: write
id-token: write
38 changes: 38 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Testing

on:
pull_request:
branches:
- main

jobs:
swiftlang_checks:
name: Swiftlang Checks
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_project_name: 'project'
format_check_enabled: true
broken_symlink_check_enabled: true
unacceptable_language_check_enabled: true
shell_check_enabled: true
docs_check_enabled: false
api_breakage_check_enabled: false
license_header_check_enabled: false
yamllint_check_enabled: false
python_lint_check_enabled: false

bb_checks:
name: BB Checks
uses: BinaryBirds/github-workflows/.github/workflows/extra_soundness.yml@main
with:
local_swift_dependencies_check_enabled: true
headers_check_enabled: true
docc_warnings_check_enabled: true

swiftlang_tests:
name: Swiftlang Tests
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
with:
enable_windows_checks: false
linux_build_command: 'swift test --parallel --enable-code-coverage'
linux_exclude_swift_versions: '[{"swift_version": "5.8"}, {"swift_version": "5.9"}, {"swift_version": "5.10"}, {"swift_version": "nightly"}, {"swift_version": "nightly-main"}, {"swift_version": "6.0"}, {"swift_version": "nightly-6.0"}, {"swift_version": "nightly-6.1"}, {"swift_version": "nightly-6.3"}]'
1 change: 1 addition & 0 deletions .swiftheaderignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ Makefile
LICENSE
Package.swift
Docker/**
docker/**
scripts/**
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MIT License

Copyright (c) 2018-2022 Tibor Bödecs
Copyright (c) 2022-2025 Binary Birds Ltd.
Copyright (c) 2022-2026 Binary Birds Ltd.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
28 changes: 11 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SHELL=/bin/bash

baseUrl = https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts

check: symlinks language deps lint
check: symlinks language deps lint headers

symlinks:
curl -s $(baseUrl)/check-broken-symlinks.sh | bash
Expand All @@ -18,9 +18,6 @@ deps:
lint:
curl -s $(baseUrl)/run-swift-format.sh | bash

fmt:
swiftformat .

format:
curl -s $(baseUrl)/run-swift-format.sh | bash -s -- --fix

Expand All @@ -29,24 +26,21 @@ headers:

fix-headers:
curl -s $(baseUrl)/check-swift-headers.sh | bash -s -- --fix

docc-local:
curl -s $(baseUrl)/generate-docc.sh | bash -s -- --local

build:
swift build
run-docc:
curl -s $(baseUrl)/run-docc-docker.sh | bash

release:
swift build -c release
docc-warnings:
curl -s $(baseUrl)/check-docc-warnings.sh | bash

test:
swift test --parallel

test-with-coverage:
swift test --parallel --enable-code-coverage

clean:
rm -rf .build

docker-tests:
docker build -t file-manager-kit-tests . -f ./Docker/Dockerfile.testing && docker run --rm file-manager-kit-tests
docker-test:
docker build -t file-manager-kit-tests . -f ./docker/tests/dockerfile && docker run --rm file-manager-kit-tests

docker-run:
docker run --rm -v $(pwd):/app -it swift:6.0
docker run --rm -v $(pwd):/app -it swift:6.1
51 changes: 37 additions & 14 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
// swift-tools-version: 6.0
// swift-tools-version:6.1
import PackageDescription

// NOTE: https://github.com/swift-server/swift-http-server/blob/main/Package.swift
var defaultSwiftSettings: [SwiftSetting] =
[
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0441-formalize-language-mode-terminology.md
.swiftLanguageMode(.v6),
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
.enableUpcomingFeature("MemberImportVisibility"),
// https://forums.swift.org/t/experimental-support-for-lifetime-dependencies-in-swift-6-2-and-beyond/78638
.enableExperimentalFeature("Lifetimes"),
// https://github.com/swiftlang/swift/pull/65218
.enableExperimentalFeature("AvailabilityMacro=featherDatabase 1.0:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"),
]

#if compiler(>=6.2)
defaultSwiftSettings.append(
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0461-async-function-isolation.md
.enableUpcomingFeature("NonisolatedNonsendingByDefault")
)
#endif

let package = Package(
name: "file-manager-kit",
platforms: [
.macOS(.v14),
.iOS(.v17),
.tvOS(.v17),
.watchOS(.v10),
.visionOS(.v1),
.macOS(.v15),
.iOS(.v18),
.tvOS(.v18),
.watchOS(.v11),
.visionOS(.v2),
],
products: [
.library(
Expand All @@ -20,35 +40,38 @@ let package = Package(
targets: ["FileManagerKitBuilder"]
),
],
dependencies: [
// [docc-plugin-placeholder]
],
targets: [
.target(
name: "FileManagerKit",
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
]
swiftSettings: defaultSwiftSettings

),
.target(
name: "FileManagerKitBuilder",
dependencies: [
.target(name: "FileManagerKit"),
],
swiftSettings: [
.enableExperimentalFeature("StrictConcurrency=complete"),
]
swiftSettings: defaultSwiftSettings

),
.testTarget(
name: "FileManagerKitTests",
dependencies: [
.target(name: "FileManagerKit"),
.target(name: "FileManagerKitBuilder")
]
],
swiftSettings: defaultSwiftSettings
),
.testTarget(
name: "FileManagerKitBuilderTests",
dependencies: [
.target(name: "FileManagerKit"),
.target(name: "FileManagerKitBuilder")
]
],
swiftSettings: defaultSwiftSettings
),
]
)
44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,39 @@

Swift extensions and DSLs for filesystem testing, scripting, and inspection.

![Release: 0.5.0](https://img.shields.io/badge/Release-0%2E5%2E0-F05138)

## Features

This package contains two products:

- FileManagerKit – high-level extensions for FileManager
- FileManagerKitBuilder – a DSL for creating filesystem layouts (ideal for tests)

Note: This repository is a work in progress. Expect breaking changes before v1.0.0.
## Requirements

![Swift 6.1+](https://img.shields.io/badge/Swift-6%2E1%2B-F05138)
![Platforms: Linux, macOS, iOS, tvOS, watchOS, visionOS](https://img.shields.io/badge/Platforms-Linux_%7C_macOS_%7C_iOS_%7C_tvOS_%7C_watchOS_%7C_visionOS-F05138)

- Swift 6.1+

- Platforms:
- Linux
- macOS 15+
- iOS 18+
- tvOS 18+
- watchOS 11+
- visionOS 2+

## Installation

Add the package to your `Package.swift` to the package dependencies section:
Use Swift Package Manager; add the dependency to your `Package.swift` file:

```swift
.package(url: "https://github.com/binarybirds/file-manager-kit", .upToNextMinor(from: "0.4.0")),
.package(url: "https://github.com/binarybirds/file-manager-kit", .exact: "1.0.0-beta.1"),
```

Then add the library to the target dependencies:
Then add `FileManagerKit` to your target dependencies:

```swift
.product(name: "FileManagerKit", package: "file-manager-kit"),
Expand All @@ -30,12 +46,13 @@ Also add the other library too, if you need the builder:
.product(name: "FileManagerKitBuilder", package: "file-manager-kit"),
```


## Usage

![DocC documentation](https://img.shields.io/badge/DocC-documentation-F05138)
Documentation is available at the following [link](https://binarybirds.github.io/file-manager-kit).
Here are a few common use-cases.

### FileManagerKit
### FileManagerKit

A set of ergonomic, safe extensions for working with FileManager.

Expand Down Expand Up @@ -92,12 +109,10 @@ let size = try fileManager.size(at: URL(filePath: "/path/to/file"))
print("\(size) bytes")
```


### FileManagerKitBuilder

A Swift DSL to declaratively build, inspect, and tear down file system structures — great for testing.


Simple Example to create and clean up a file structure:

```swift
Expand Down Expand Up @@ -151,3 +166,16 @@ try FileManagerPlayground {
#expect(fileManager.fileExists(at: fileURL))
}
```

## Development

- Build: `swift build`
- Test:
- local: `swift test`
- using Docker: `make docker-test`
- Format: `make format`
- Check: `make check`

## Contributing

[Pull requests](https://github.com/BinaryBirds/file-manager-kit/pulls) are welcome. Please keep changes focused and include tests for new logic. 🙏
Loading