Support CocoaPods

This commit is contained in:
Max Howell
2019-01-20 03:08:06 +00:00
parent 6c24de4875
commit 1c2cffada5
2 changed files with 40 additions and 5 deletions

19
Path.swift.podspec Normal file
View File

@@ -0,0 +1,19 @@
Pod::Spec.new do |s|
s.name = 'Path.swift'
s.version = '0.3.0'
s.summary = 'Delightful, robust file-pathing functions'
s.homepage = 'https://github.com/mxcl/Path.swift'
s.license = { :type => 'Unlicense', :file => 'LICENSE.md' }
s.author = { 'mxcl' => 'mxcl@me.com' }
s.source = { :git => 'https://github.com/mxcl/Path.swift.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/mxcl'
s.osx.deployment_target = '10.10'
s.ios.deployment_target = '8.0'
s.tvos.deployment_target = '10.0'
s.watchos.deployment_target = '3.0'
s.source_files = 'Sources/*'
s.swift_version = "4.2"
end

View File

@@ -16,14 +16,14 @@ let docs = Path.home/"Documents"
let path = Path(userInput) ?? Path.cwd/userInput let path = Path(userInput) ?? Path.cwd/userInput
// chainable syntax so you have less boilerplate // chainable syntax so you have less boilerplate
try Path.home.join("foo").mkpath().join("bar").touch().chmod(0o555) try Path.home.join("foo").mkdir().join("bar").touch().chmod(0o555)
// easy file-management // easy file-management
try Path.root.join("foo").copy(to: Path.root/"bar") try Path.root.join("foo").copy(to: Path.root/"bar")
// careful API to avoid common bugs // careful API to avoid common bugs
try Path.root.join("foo").copy(into: Path.root.mkdir("bar")) try Path.root.join("foo").copy(into: Path.root.mkdir("bar"))
// ^^ other libraries would make the `to:` form handle both these cases // ^^ other libraries would make the above `to:` form handle both these cases
// but that can easily lead to bugs where you accidentally write files that // but that can easily lead to bugs where you accidentally write files that
// were meant to be directory destinations // were meant to be directory destinations
``` ```
@@ -41,6 +41,8 @@ can continue to make tools and software you need and love. I appreciate it x.
<img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160"> <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
</a> </a>
[Other donation/tipping options](http://mxcl.github.io/donate/)
# Handbook # Handbook
Our [online API documentation] is automatically updated for new releases. Our [online API documentation] is automatically updated for new releases.
@@ -97,6 +99,11 @@ This is explicit, not hiding anything that code-review may miss and preventing
common bugs like accidentally creating `Path` objects from strings you did not common bugs like accidentally creating `Path` objects from strings you did not
expect to be relative. expect to be relative.
Our initializer is nameless because we conform to `LosslessStringConvertible`,
the same conformance as that `Int`, `Float` etc. conform. The protocol enforces
a nameless initialization and since it is appropriate for us to conform to it,
we do.
## Extensions ## Extensions
We have some extensions to Apple APIs: We have some extensions to Apple APIs:
@@ -165,7 +172,7 @@ Path.root/"~b" // => /~b
Path.root/"~/b" // => /~/b Path.root/"~/b" // => /~/b
// but is here // but is here
Path("~/foo")! // => /Users/foo Path("~/foo")! // => /Users/mxcl/foo
// this does not work though // this does not work though
Path("~foo") // => nil Path("~foo") // => nil
@@ -173,12 +180,21 @@ Path("~foo") // => nil
# Installation # Installation
SwiftPM only: SwiftPM:
```swift ```swift
package.append(.package(url: "https://github.com/mxcl/Path.swift", from: "0.0.0")) package.append(.package(url: "https://github.com/mxcl/Path.swift", from: "0.3.0"))
``` ```
CocoaPods:
```ruby
pod 'Path.swift' ~> 0.3.0
```
Please note! We are pre 1.0, thus we can change the API as we like! We will tag
1.0 as soon as possible.
### Get push notifications for new releases ### Get push notifications for new releases
https://codebasesaga.com/canopy/ https://codebasesaga.com/canopy/