Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Swift Package Manager #79

Closed
wants to merge 9 commits into from
Closed
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Pods
# Carthage
Carthage/Build

# Swift Package Manager
.build/

# AppCode specific files
.idea/
*.iml
Expand Down
16 changes: 10 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
language: objective-c # lol
osx_image: xcode9.2
language: objective-c
osx_image: xcode9.4
xcode_project: DVR.xcodeproj

script: xcodebuild -scheme "$TRAVIS_XCODE_SCHEME" -sdk "$TRAVIS_XCODE_SDK" -destination "$DESTINATION" test

matrix:
include:
- xcode_scheme: DVR-iOS
xcode_sdk: iphonesimulator
env:
- DESTINATION="OS=10.1,name=iPhone 7 Plus"
- PLATFORM="iOS Simulator,OS=10.1,name=iPhone 7 Plus"
- xcode_scheme: DVR-macOS
xcode_sdk: macosx
env:
- DESTINATION="arch=x86_64"
- PLATFORM="OS X"
- env:
- SWIFT_BUILD=true

script:
- ./Scripts/travis-build-test.sh

2 changes: 1 addition & 1 deletion DVR.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ DVR.Session is a subclass of NSURLSession so you can use it as a drop in replace
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'

s.source_files = 'DVR/*.{swift}'
s.source_files = 'Sources/DVR/*.{swift}'
end
210 changes: 111 additions & 99 deletions DVR.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// swift-tools-version:4.0

import PackageDescription

let package = Package(
name: "DVR",
products: [
.library(
name: "DVR",
targets: ["DVR"])
],
targets: [
.target(name: "DVR"),
.testTarget(
name: "DVRTests",
dependencies: ["DVR"])
]
)

1 change: 1 addition & 0 deletions Readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Version](https://img.shields.io/github/release/venmo/DVR.svg)](https://github.com/venmo/DVR/releases)
![Swift Version](https://img.shields.io/badge/swift-4-orange.svg)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Swift Package Manager](https://img.shields.io/badge/SPM-compatible-brightgreen.svg)](https://swift.org/package-manager/)

DVR is a simple Swift framework for making fake `NSURLSession` requests for iOS,
watchOS, and OS X based on [VCR](https://github.com/vcr/vcr).
Expand Down
14 changes: 14 additions & 0 deletions Scripts/travis-build-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -x -o pipefail

if [[ "$SWIFT_BUILD" == "true" ]]; then
swift build
exit 0
fi

# -jobs -- specify the number of concurrent jobs
# `sysctl -n hw.ncpu` -- fetch number of 'logical' cores in macOS machine
xcodebuild -jobs `sysctl -n hw.ncpu` test -project DVR.xcodeproj -scheme ${TRAVIS_XCODE_SCHEME} -sdk ${TRAVIS_XCODE_SDK} \
-destination "platform=${PLATFORM}" ONLY_ACTIVE_ARCH=YES CODE_SIGNING_IDENTITY="" CODE_SIGNING_REQUIRED=NO

2 changes: 1 addition & 1 deletion DVR/Cassette.swift → Sources/DVR/Cassette.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension Cassette {
self.name = name

if let array = dictionary["interactions"] as? [[String: Any]] {
interactions = array.flatMap { Interaction(dictionary: $0) }
interactions = array.compactMap { Interaction(dictionary: $0) }
} else {
interactions = []
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

final class SessionDownloadTask: URLSessionDownloadTask {

// MARK: - Types
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

final class SessionUploadTask: URLSessionUploadTask {

// MARK: - Types
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.