Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
swiftyfinch committed Aug 14, 2023
0 parents commit 78b0685
Show file tree
Hide file tree
Showing 33 changed files with 1,995 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/scripts/checkSpell.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# It's a temporary solution to check the spelling of *.md and Sources/*.swift files
# Need to install https://github.com/fromkk/SpellChecker

docs_output=`find . -type f -name '*.md' -exec ~/.mint/bin/SpellChecker --yml .github/scripts/spell_checker_whitelist.yml -- {} \; | grep -v 'no typo'`
if [[ $docs_output ]]; then echo $docs_output; fi

source_output=`find Sources -type f -name '*.swift' -exec ~/.mint/bin/SpellChecker --yml .github/scripts/spell_checker_whitelist.yml -- {} \; | grep -v 'no typo'`
if [[ $source_output ]]; then echo $source_output; fi

tests_output=`find Tests -type f -name '*.swift' -exec ~/.mint/bin/SpellChecker --yml .github/scripts/spell_checker_whitelist.yml -- {} \; | grep -v 'no typo'`
if [[ $tests_output ]]; then echo $tests_output; fi

if [[ $docs_output || $source_output || $tests_output ]]; then exit 1; fi
98 changes: 98 additions & 0 deletions .github/scripts/spell_checker_whitelist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
whiteList:
- pbxproj
- vyacheslav
- subspecs
- xcscheme
- usleep
- xcbeautify
- github
- thii
- associatedtype
- rethrows
- recursively
- appex
- xcschemes
- xcuserdatad
- xcuserdata
- xcshareddata
- lhs
- stderror
- anyarray
- localized
- kareman
- autoreleasepool
- tput
- boolable
- nsrange
- xcodebuild
- sdk
- podfile
- xcodeproj
- yml
- swiftlint
- ykkd
- iphoneos
- ios
- iphonesimulator
- codable
- xcworkspace
- sysctl
- machdep
- dirs
- xcconfig
- xcargs
- wholemodule
- couldn
- xcframeworks
- alamofire
- doesn
- xcodegen
- swiftyfinch
- serialization
- isystem
- githubusercontent
- img
- khorkov
- proj
- deintegrate
- rhs
- colton
- schlosser
- parallelization
- iframework
- fd
- ecf
- bcfeef
- mlch
- utsname
- uname
- cocoapods
- leavez
- amazonaws
- realized
- fbadge
- ftype
- dswift
- swifty
- swiftish
- fpackages
- fapi
- fswiftpackageindex
- swiftpackageindex
- didn
- optimizations
- clt
- nexport
- zshrc
- zshenv
- th
- finalized
- fswiftyfinch
- dplatforms
- svg
- yandex
- fff
- faq
- standardized
- shwifty
- utf
23 changes: 23 additions & 0 deletions .github/workflows/regress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Regress

on: [push, workflow_dispatch, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: norio-nomura/action-swiftlint@3.2.1
with: { args: --strict }

test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with: { xcode-version: '14.2' }
- name: Testing
# https://github.com/actions/runner-images/issues/1665
run: |
brew install xcbeautify
swift test | xcbeautify
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
.build

# Keep xcshareddata
.swiftpm/*
!.swiftpm/xcode
.swiftpm/xcode/*
!.swiftpm/xcode/package.xcworkspace
.swiftpm/xcode/package.xcworkspace/*
!.swiftpm/xcode/package.xcworkspace/xcshareddata
4 changes: 4 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 1
builder:
configs:
- documentation_targets: [Fish]
112 changes: 112 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
disabled_rules:
- let_var_whitespace
- conditional_returns_on_newline
- todo
- reduce_boolean
- attributes

opt_in_rules:
- identifier_name
- attributes
- force_unwrapping
- sorted_imports
- block_based_kvo
- class_delegate_protocol
- closing_brace
- closure_parameter_position
- colon
- comma
- compiler_protocol_init
- control_statement
- custom_rules
- cyclomatic_complexity
- deployment_target
- discarded_notification_center_observer
- discouraged_direct_init
- duplicate_enum_cases
- duplicate_imports
- dynamic_inline
- empty_enum_arguments
- empty_parameters
- empty_parentheses_with_trailing_closure
- file_length
- for_where
- force_cast
- force_try
- function_body_length
- function_parameter_count
- generic_type_name
- implicit_getter
- is_disjoint
- large_tuple
- leading_whitespace
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- legacy_hashing
- legacy_nsgeometry_functions
- line_length
- mark
- multiple_closures_with_trailing_closure
- nesting
- no_fallthrough_only
- no_space_in_method_call
- notification_center_detachment
- nsobject_prefer_isequal
- opening_brace
- operator_whitespace
- orphaned_doc_comment
- private_over_fileprivate
- private_unit_test
- protocol_property_accessors_order
- redundant_discardable_let
- redundant_objc_attribute
- redundant_optional_initialization
- redundant_set_access_control
- redundant_string_enum_value
- redundant_void_return
- return_arrow_whitespace
- shorthand_operator
- statement_position
- superfluous_disable_command
- switch_case_alignment
- syntactic_sugar
- trailing_comma
- trailing_newline
- trailing_semicolon
- trailing_whitespace
- type_body_length
- type_name
- unneeded_break_in_switch
- unused_closure_parameter
- unused_control_flow_label
- unused_enumerated
- unused_optional_binding
- unused_setter_value
- valid_ibinspectable
- vertical_parameter_alignment
- vertical_whitespace
- void_return
- weak_delegate
- xctfail_message
- explicit_init
- file_header
- missing_docs

included:
- Sources

# Custom
large_tuple: 4
nesting:
type_level: 2
function_parameter_count: 6
file_header:
required_pattern: |
\/\/
\/\/ .*?\.swift
\/\/ Fish
\/\/
\/\/ Created by .*? on \d{1,2}\.\d{1,2}\.\d{4}\.
\/\/ Copyright © .*?\. All rights reserved\.
\/\/
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FILEHEADER</key>
<string>
// ___FILENAME___
// Fish
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright © ___YEAR___ Vyacheslav Khorkov. All rights reserved.
//</string>
</dict>
</plist>
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Vyacheslav Khorkov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.PHONY: debug
debug: lint
swift build --arch arm64

.PHONY: lint
lint:
swiftlint --strict --quiet

.PHONY: test
test:
swift test | xcbeautify

.PHONY: spelling
spelling:
.github/scripts/checkSpell.sh
25 changes: 25 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// swift-tools-version:5.7

import PackageDescription

let package = Package(
name: "fish",
platforms: [.macOS(.v12)],
products: [
.library(
name: "Fish",
targets: ["Fish"]
)
],
targets: [
.target(
name: "Fish",
path: "Sources"
),
.testTarget(
name: "FishTests",
dependencies: ["Fish"],
path: "Tests"
)
]
)
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<br>
<h3 align="center">
<img src="https://github.com/swiftyfinch/Fish/assets/64660122/bf12977c-b864-4f71-9e21-153136062ebc" />
<br>
Fish
<br>
</h3>

# Motivation

I used the [Files](https://github.com/JohnSundell/Files) in [the first Rugby version](https://github.com/swiftyfinch/Rugby/blob/1.23.0/Package.swift#L15).
But this library has some drawbacks:\
`-` There are some issues with files enumeration;\
`-` It has limited testability;\
`-` Now it looks like a public archive. The last request was merged in 2022.

## Description

`Fish` is a small library that was developed to solve the above problems.\
It providing convenient wrappers for interacting with the file system.\
Under the hood it uses [`FileManager`](https://developer.apple.com/documentation/foundation/filemanager) and other parts of [`Foundation`](https://developer.apple.com/documentation/foundation).

This library was a part of 🏈 [Rugby 2.x](https://github.com/swiftyfinch/Rugby).

<br>

# How to install 📦

Add it to the dependencies for your package. More info [here](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app).
```swift
.package(url: "https://github.com/swiftyfinch/Fish", from: "0.1.0")
```

## How to use 🚀

```swift
let file = try Folder.current.createFile(
named: "example.txt",
contents: "Hello world!"
)
try file.append("You can find more info in docs.")
try file.delete()
```
Loading

0 comments on commit 78b0685

Please sign in to comment.