From 9851af5e8f01b6e389f9f26843e95d9124f075f4 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Mon, 1 May 2017 11:23:06 +1000 Subject: [PATCH 01/15] Added a fastlane config file that specifies a "test" lane. The test lane does a regular build for the watchOS target (because there aren't any tests), then does a build+test (aka scan) step for the other 3 targets. Unwanted targets can be removed and extra iOS devices can be added easily. Useful for CI because all you have to do is run `fastlane test`. --- Template/fastlane/Fastfile | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Template/fastlane/Fastfile diff --git a/Template/fastlane/Fastfile b/Template/fastlane/Fastfile new file mode 100644 index 0000000..64d1c4a --- /dev/null +++ b/Template/fastlane/Fastfile @@ -0,0 +1,69 @@ +# Customise this file, documentation can be found here: +# https://github.com/fastlane/fastlane/tree/master/fastlane/docs +# All available actions: https://docs.fastlane.tools/actions +# can also be listed using the `fastlane actions` command + +# Change the syntax highlighting to Ruby +# All lines starting with a # are ignored when running `fastlane` + +# If you want to automatically update fastlane if a new version is available: +# update_fastlane + +# This is the minimum version number required. +# Update this, if you use features of a newer version +fastlane_version "2.16.0" + +default_platform :ios + +platform :ios do + + desc "Builds the framework and runs all the tests" + lane :test do + + # Prevent timeout issues + ENV["FASTLANE_XCODE_LIST_TIMEOUT"] = "120" + + # Just build the watchOS target (no tests) + xcodebuild( + project: "{PROJECT}.xcodeproj", + scheme: "{PROJECT}-watchOS", + clean: true, + build: true + ) + + # Build and test the macOS target + scan( + project: "{PROJECT}.xcodeproj", + scheme: "{PROJECT}-macOS", + devices: [ + # (deliberately empty, will use the mac this is running on) + ], + clean: true, + skip_slack: true + ) + + # Build and test the iOS target + scan( + project: "{PROJECT}.xcodeproj", + scheme: "{PROJECT}-iOS", + devices: [ + "iPhone SE", + # "iPhone 6", + # "iPhone 7 Plus", + ], + clean: true, + skip_slack: true + ) + + # Build and test the tvOS target + scan( + project: "{PROJECT}.xcodeproj", + scheme: "{PROJECT}-tvOS", + devices: [ + "Apple TV 1080p", + ], + clean: true, + skip_slack: true + ) + end +end From d4502c7447216ae9509547e5163fe9861bbc826f Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Mon, 1 May 2017 11:26:33 +1000 Subject: [PATCH 02/15] Added fastlane's generated readme file to the template's gitignore --- Template/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/Template/.gitignore b/Template/.gitignore index d534044..0a04d73 100644 --- a/Template/.gitignore +++ b/Template/.gitignore @@ -65,3 +65,4 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output +fastlane/README.md \ No newline at end of file From 47fcc4056f45186435f741270ebfffc7033e2f12 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Mon, 1 May 2017 11:31:21 +1000 Subject: [PATCH 03/15] Template now has a travis CI config file that leverages fastlane --- Template/.travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Template/.travis.yml diff --git a/Template/.travis.yml b/Template/.travis.yml new file mode 100644 index 0000000..cdcfde5 --- /dev/null +++ b/Template/.travis.yml @@ -0,0 +1,6 @@ +language: objective-c +osx_image: xcode8.3 +before_install: +- gem update fastlane +script: +- fastlane test \ No newline at end of file From 51530193f85e9ca283d4d6451aa3d2eac8130e2a Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Mon, 1 May 2017 12:13:16 +1000 Subject: [PATCH 04/15] Added note in readme about Travis CI support via Fastlane --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 28cfb68..9509ce7 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ SwiftPlate will generate Xcode projects for you in seconds, that support: - [x] watchOS - [x] tvOS - [x] Linux +- [x] Travis CI (via Fastlane - Mac environment only) Just run `swiftplate`, and you’ll be presented with a simple step-by-step guide: From 3ff9b6b4b3543fa491ec12445ef79a2b93b80bc4 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sun, 7 May 2017 12:33:40 +1000 Subject: [PATCH 05/15] Added a podfile to the template with foundations but no actual pods defined. --- Template/Podfile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Template/Podfile diff --git a/Template/Podfile b/Template/Podfile new file mode 100644 index 0000000..c1c52c4 --- /dev/null +++ b/Template/Podfile @@ -0,0 +1,52 @@ +workspace '{PROJECT}' +inhibit_all_warnings! +use_frameworks! + + +# Shared declarations + +def dependency_pods + # Fill in as needed +end + +def testing_pods + # Fill in as needed +end + + +# Framework targets + +target '{PROJECT}-iOS' do + platform :ios, '8.0' + dependency_pods +end + +target '{PROJECT}-macOS' do + platform :osx, '10.9' + dependency_pods +end + +target '{PROJECT}-tvOS' do + platform :tvos, '9.0' + dependency_pods +end + +target '{PROJECT}-watchOS' do + platform :watchos, '2.0' + dependency_pods +end + + +# Test targets + +target '{PROJECT}-iOS Tests' do + testing_pods +end + +target '{PROJECT}-macOS Tests' do + testing_pods +end + +target '{PROJECT}-tvOS Tests' do + testing_pods +end From 10f9aa6238258ae1dc4dccebde427872870649a8 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sun, 7 May 2017 13:36:29 +1000 Subject: [PATCH 06/15] Made the podfile copying be optional via a question during the script. --- main.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.swift b/main.swift index db6f16f..6e18205 100755 --- a/main.swift +++ b/main.swift @@ -329,6 +329,7 @@ let authorName = arguments.authorName ?? askForAuthorName() let authorEmail = arguments.authorEmail ?? askForAuthorEmail() let gitHubURL = arguments.githubURL ?? askForGitHubURL(destination: destination) let organizationName = arguments.organizationName ?? askForOptionalInfo(question: "🏢 What's your organization name?") +let installCocoapods = askForBooleanInfo(question: "🛠 Use Cocoapods to develop and test your project?") print("---------------------------------------------------------------------") print("SwiftPlate will now generate a project with the following parameters:") @@ -348,6 +349,10 @@ if let organizationName = organizationName { print("🏢 Organization Name: \(organizationName)") } +if installCocoapods { + print("🛠 Using Cocoapods") +} + print("---------------------------------------------------------------------") if !arguments.forceEnabled { @@ -379,11 +384,15 @@ do { try performCommand(description: "Copying template folder") { let ignorableItems: Set = ["readme.md", "license"] - let ignoredItems = try fileManager.contentsOfDirectory(atPath: destination).map { + var ignoredItems = try fileManager.contentsOfDirectory(atPath: destination).map { $0.lowercased() }.filter { ignorableItems.contains($0) } + + if !installCocoapods { + ignoredItems.append("podfile") + } for itemName in try fileManager.contentsOfDirectory(atPath: templatePath) { let originPath = templatePath + "/" + itemName From 8e8cc34edc91ec89ca908ad028851be3a7a42cb0 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sun, 7 May 2017 13:40:35 +1000 Subject: [PATCH 07/15] Running pod install just before finishing as a convenience to set up the workspace if project wants to use cocoa pods. --- main.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.swift b/main.swift index 6e18205..e7bece4 100755 --- a/main.swift +++ b/main.swift @@ -422,6 +422,12 @@ do { try replacer.process(filesInFolderWithPath: destination) } + + if installCocoapods { + performCommand(description: "Setting up Cocoapods (running pod install)") { + Process().launchBash(withCommand: "pod install") + } + } print("All done! 🎉 Good luck with your project! 🚀") } catch { From deab13c0de14d445747ff19c413c7d1bc97fe80a Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sun, 7 May 2017 14:38:42 +1000 Subject: [PATCH 08/15] Moved the podfile into a folder called "optional" which is ignored when copying. The idea is that items in the optional folder can be selectively copied depending on the answers to questions / what the project needs. --- Template/{Podfile => optional/Podfile-blank} | 0 main.swift | 12 ++++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) rename Template/{Podfile => optional/Podfile-blank} (100%) diff --git a/Template/Podfile b/Template/optional/Podfile-blank similarity index 100% rename from Template/Podfile rename to Template/optional/Podfile-blank diff --git a/main.swift b/main.swift index e7bece4..14dd921 100755 --- a/main.swift +++ b/main.swift @@ -368,6 +368,7 @@ do { let temporaryDirectoryPath = destination + "/swiftplate_temp" let gitClonePath = "\(temporaryDirectoryPath)/SwiftPlate" let templatePath = "\(gitClonePath)/Template" + let optionalItemsPath = templatePath + "/Optional" performCommand(description: "Removing any previous temporary folder") { try? fileManager.removeItem(atPath: temporaryDirectoryPath) @@ -389,10 +390,7 @@ do { }.filter { ignorableItems.contains($0) } - - if !installCocoapods { - ignoredItems.append("podfile") - } + ignoredItems.append("optional") for itemName in try fileManager.contentsOfDirectory(atPath: templatePath) { let originPath = templatePath + "/" + itemName @@ -405,6 +403,12 @@ do { try fileManager.copyItem(atPath: originPath, toPath: destinationPath) } + + if installCocoapods { + let originPath = optionalItemsPath + "/" + "Podfile-blank" + let destinationPath = destination + "/" + "Podfile" + try fileManager.copyItem(atPath: originPath, toPath: destinationPath) + } } try performCommand(description: "Removing temporary folder") { From 840025720edd0cb914431fe4b90c40fe521f980e Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sun, 7 May 2017 14:48:32 +1000 Subject: [PATCH 09/15] Added podfile template that uses Quick and Nimble for the test targets. Only gets copied from the "optional" folder if the user says yes to it. --- Template/optional/Podfile-quick+nimble | 53 ++++++++++++++++++++++++++ main.swift | 18 +++++++-- 2 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 Template/optional/Podfile-quick+nimble diff --git a/Template/optional/Podfile-quick+nimble b/Template/optional/Podfile-quick+nimble new file mode 100644 index 0000000..c6a949d --- /dev/null +++ b/Template/optional/Podfile-quick+nimble @@ -0,0 +1,53 @@ +workspace '{PROJECT}' +inhibit_all_warnings! +use_frameworks! + + +# Shared declarations + +def dependency_pods + # Fill in as needed +end + +def testing_pods + pod 'Quick' + pod 'Nimble' +end + + +# Framework targets + +target '{PROJECT}-iOS' do + platform :ios, '8.0' + dependency_pods +end + +target '{PROJECT}-macOS' do + platform :osx, '10.9' + dependency_pods +end + +target '{PROJECT}-tvOS' do + platform :tvos, '9.0' + dependency_pods +end + +target '{PROJECT}-watchOS' do + platform :watchos, '2.0' + dependency_pods +end + + +# Test targets + +target '{PROJECT}-iOS Tests' do + testing_pods +end + +target '{PROJECT}-macOS Tests' do + testing_pods +end + +target '{PROJECT}-tvOS Tests' do + testing_pods +end diff --git a/main.swift b/main.swift index 14dd921..814eff1 100755 --- a/main.swift +++ b/main.swift @@ -329,7 +329,9 @@ let authorName = arguments.authorName ?? askForAuthorName() let authorEmail = arguments.authorEmail ?? askForAuthorEmail() let gitHubURL = arguments.githubURL ?? askForGitHubURL(destination: destination) let organizationName = arguments.organizationName ?? askForOptionalInfo(question: "🏢 What's your organization name?") -let installCocoapods = askForBooleanInfo(question: "🛠 Use Cocoapods to develop and test your project?") +let useCocoapods = askForBooleanInfo(question: "🛠 Use Cocoapods to develop and test your project?") +let useQuickAndNimble = askForBooleanInfo(question: "🔍 Use Quick and Nimble testing frameworks? (via Cocoapods)") +let installCocoapods = useCocoapods || useQuickAndNimble print("---------------------------------------------------------------------") print("SwiftPlate will now generate a project with the following parameters:") @@ -350,7 +352,11 @@ if let organizationName = organizationName { } if installCocoapods { - print("🛠 Using Cocoapods") + if useQuickAndNimble { + print("🔍 Using Quick and Nimble (via Cocoapods)") + } else { + print("🛠 Using Cocoapods") + } } print("---------------------------------------------------------------------") @@ -404,11 +410,17 @@ do { try fileManager.copyItem(atPath: originPath, toPath: destinationPath) } - if installCocoapods { + if useCocoapods && !useQuickAndNimble { let originPath = optionalItemsPath + "/" + "Podfile-blank" let destinationPath = destination + "/" + "Podfile" try fileManager.copyItem(atPath: originPath, toPath: destinationPath) } + + if useQuickAndNimble { + let originPath = optionalItemsPath + "/" + "Podfile-quick+nimble" + let destinationPath = destination + "/" + "Podfile" + try fileManager.copyItem(atPath: originPath, toPath: destinationPath) + } } try performCommand(description: "Removing temporary folder") { From c22f35926f460229e951cfec54ed07bf6458f325 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Thu, 11 May 2017 22:05:51 +1000 Subject: [PATCH 10/15] Fixed issue preventing pod installation from playing nice. Architectures need to match between project targets and pod targets, and the one that makes sense as a default is for debug to build the active one only. Without this the iOS target is the odd one out that wants to build all architectures, and pods doesn't agree with that. --- Template/{PROJECT}.xcodeproj/project.pbxproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Template/{PROJECT}.xcodeproj/project.pbxproj b/Template/{PROJECT}.xcodeproj/project.pbxproj index c606341..f2b4a11 100644 --- a/Template/{PROJECT}.xcodeproj/project.pbxproj +++ b/Template/{PROJECT}.xcodeproj/project.pbxproj @@ -641,7 +641,6 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - ONLY_ACTIVE_ARCH = NO; PRODUCT_BUNDLE_IDENTIFIER = "com.{PROJECT}.{PROJECT}-iOS"; PRODUCT_NAME = {PROJECT}; SKIP_INSTALL = YES; From b77316a12e0c7a6f5f15463944b354cf2dbe4a98 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sun, 7 May 2017 14:38:42 +1000 Subject: [PATCH 11/15] Moved the podfile into a folder called "optional" which is ignored when copying. The idea is that items in the optional folder can be selectively copied depending on the answers to questions / what the project needs. --- Template/{Podfile => optional/Podfile-blank} | 0 main.swift | 12 ++++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) rename Template/{Podfile => optional/Podfile-blank} (100%) diff --git a/Template/Podfile b/Template/optional/Podfile-blank similarity index 100% rename from Template/Podfile rename to Template/optional/Podfile-blank diff --git a/main.swift b/main.swift index e7bece4..14dd921 100755 --- a/main.swift +++ b/main.swift @@ -368,6 +368,7 @@ do { let temporaryDirectoryPath = destination + "/swiftplate_temp" let gitClonePath = "\(temporaryDirectoryPath)/SwiftPlate" let templatePath = "\(gitClonePath)/Template" + let optionalItemsPath = templatePath + "/Optional" performCommand(description: "Removing any previous temporary folder") { try? fileManager.removeItem(atPath: temporaryDirectoryPath) @@ -389,10 +390,7 @@ do { }.filter { ignorableItems.contains($0) } - - if !installCocoapods { - ignoredItems.append("podfile") - } + ignoredItems.append("optional") for itemName in try fileManager.contentsOfDirectory(atPath: templatePath) { let originPath = templatePath + "/" + itemName @@ -405,6 +403,12 @@ do { try fileManager.copyItem(atPath: originPath, toPath: destinationPath) } + + if installCocoapods { + let originPath = optionalItemsPath + "/" + "Podfile-blank" + let destinationPath = destination + "/" + "Podfile" + try fileManager.copyItem(atPath: originPath, toPath: destinationPath) + } } try performCommand(description: "Removing temporary folder") { From d7e8a91a5b23a8675644b50c6881e9d91a3974df Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sun, 7 May 2017 14:48:32 +1000 Subject: [PATCH 12/15] Added podfile template that uses Quick and Nimble for the test targets. Only gets copied from the "optional" folder if the user says yes to it. --- Template/optional/Podfile-quick+nimble | 53 ++++++++++++++++++++++++++ main.swift | 18 +++++++-- 2 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 Template/optional/Podfile-quick+nimble diff --git a/Template/optional/Podfile-quick+nimble b/Template/optional/Podfile-quick+nimble new file mode 100644 index 0000000..c6a949d --- /dev/null +++ b/Template/optional/Podfile-quick+nimble @@ -0,0 +1,53 @@ +workspace '{PROJECT}' +inhibit_all_warnings! +use_frameworks! + + +# Shared declarations + +def dependency_pods + # Fill in as needed +end + +def testing_pods + pod 'Quick' + pod 'Nimble' +end + + +# Framework targets + +target '{PROJECT}-iOS' do + platform :ios, '8.0' + dependency_pods +end + +target '{PROJECT}-macOS' do + platform :osx, '10.9' + dependency_pods +end + +target '{PROJECT}-tvOS' do + platform :tvos, '9.0' + dependency_pods +end + +target '{PROJECT}-watchOS' do + platform :watchos, '2.0' + dependency_pods +end + + +# Test targets + +target '{PROJECT}-iOS Tests' do + testing_pods +end + +target '{PROJECT}-macOS Tests' do + testing_pods +end + +target '{PROJECT}-tvOS Tests' do + testing_pods +end diff --git a/main.swift b/main.swift index 14dd921..814eff1 100755 --- a/main.swift +++ b/main.swift @@ -329,7 +329,9 @@ let authorName = arguments.authorName ?? askForAuthorName() let authorEmail = arguments.authorEmail ?? askForAuthorEmail() let gitHubURL = arguments.githubURL ?? askForGitHubURL(destination: destination) let organizationName = arguments.organizationName ?? askForOptionalInfo(question: "🏢 What's your organization name?") -let installCocoapods = askForBooleanInfo(question: "🛠 Use Cocoapods to develop and test your project?") +let useCocoapods = askForBooleanInfo(question: "🛠 Use Cocoapods to develop and test your project?") +let useQuickAndNimble = askForBooleanInfo(question: "🔍 Use Quick and Nimble testing frameworks? (via Cocoapods)") +let installCocoapods = useCocoapods || useQuickAndNimble print("---------------------------------------------------------------------") print("SwiftPlate will now generate a project with the following parameters:") @@ -350,7 +352,11 @@ if let organizationName = organizationName { } if installCocoapods { - print("🛠 Using Cocoapods") + if useQuickAndNimble { + print("🔍 Using Quick and Nimble (via Cocoapods)") + } else { + print("🛠 Using Cocoapods") + } } print("---------------------------------------------------------------------") @@ -404,11 +410,17 @@ do { try fileManager.copyItem(atPath: originPath, toPath: destinationPath) } - if installCocoapods { + if useCocoapods && !useQuickAndNimble { let originPath = optionalItemsPath + "/" + "Podfile-blank" let destinationPath = destination + "/" + "Podfile" try fileManager.copyItem(atPath: originPath, toPath: destinationPath) } + + if useQuickAndNimble { + let originPath = optionalItemsPath + "/" + "Podfile-quick+nimble" + let destinationPath = destination + "/" + "Podfile" + try fileManager.copyItem(atPath: originPath, toPath: destinationPath) + } } try performCommand(description: "Removing temporary folder") { From 1059ecfd151a3bf5f6089e33690264897080e12b Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sat, 13 May 2017 15:43:07 +1000 Subject: [PATCH 13/15] Quick+Nimble option now provides example test file instead of the default one --- .../optional/ExampleTests-quick+nimble.swift | 40 +++++++++++++++++++ main.swift | 12 ++++-- 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 Template/optional/ExampleTests-quick+nimble.swift diff --git a/Template/optional/ExampleTests-quick+nimble.swift b/Template/optional/ExampleTests-quick+nimble.swift new file mode 100644 index 0000000..c922bbd --- /dev/null +++ b/Template/optional/ExampleTests-quick+nimble.swift @@ -0,0 +1,40 @@ +// +// {PROJECT}Tests.swift +// {ORGANIZATION} +// +// Created by {AUTHOR} on {TODAY}. +// Copyright © {YEAR} {ORGANIZATION}. All rights reserved. +// + +import Quick +import Nimble +import {PROJECT} + +class {PROJECT}Spec: QuickSpec { + + override func spec() { + + // For more information about Quick and Nimble: + // https://github.com/Quick/Quick + // https://github.com/Quick/Nimble + + // EXAMPLES: + + describe("A bunch of numbers") { + it("should add up") { + expect(1 + 1).to(equal(2)) + } + it("should behave logically") { + expect(1.2).to(beCloseTo(1.1, within: 0.1)) + expect(3) > 2 + } + } + + describe("Some other stuff") { + it("should make sense") { + expect("seahorse").to(contain("sea")) + expect(["Atlantic", "Pacific"]).toNot(contain("Mississippi")) + } + } + } +} diff --git a/main.swift b/main.swift index 814eff1..7780ff0 100755 --- a/main.swift +++ b/main.swift @@ -417,9 +417,15 @@ do { } if useQuickAndNimble { - let originPath = optionalItemsPath + "/" + "Podfile-quick+nimble" - let destinationPath = destination + "/" + "Podfile" - try fileManager.copyItem(atPath: originPath, toPath: destinationPath) + + let podfileOriginPath = optionalItemsPath + "/" + "Podfile-quick+nimble" + let podfileDestinationPath = destination + "/" + "Podfile" + try fileManager.copyItem(atPath: podfileOriginPath, toPath: podfileDestinationPath) + + let testsOriginPath = optionalItemsPath + "/" + "ExampleTests-quick+nimble.swift" + let testsDestinationPath = destination + "/Tests/{PROJECT}Tests/" + "{PROJECT}Tests.swift" + try fileManager.removeItem(atPath: testsDestinationPath) + try fileManager.copyItem(atPath: testsOriginPath, toPath: testsDestinationPath) } } From ddf67cb2dfa45e0820bcf747057cf269e245ceb2 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sat, 13 May 2017 16:13:35 +1000 Subject: [PATCH 14/15] Added Quick and Nimble to the SPM package file and made linux testing aware of it as well. The downside of this is you can't currently have testing without including Q+N as dependencies for building as well. Not sure that SPM supports that at the moment, the conversation suggests not yet. --- Template/optional/LinuxMain-quick+nimble.swift | 7 +++++++ Template/optional/Package-quick+nimble.swift | 9 +++++++++ main.swift | 10 ++++++++++ 3 files changed, 26 insertions(+) create mode 100644 Template/optional/LinuxMain-quick+nimble.swift create mode 100644 Template/optional/Package-quick+nimble.swift diff --git a/Template/optional/LinuxMain-quick+nimble.swift b/Template/optional/LinuxMain-quick+nimble.swift new file mode 100644 index 0000000..14e4388 --- /dev/null +++ b/Template/optional/LinuxMain-quick+nimble.swift @@ -0,0 +1,7 @@ +import XCTest +import Quick +@testable import {PROJECT}Tests + +Quick.QCKMain([ + {PROJECT}Tests.self, +]) diff --git a/Template/optional/Package-quick+nimble.swift b/Template/optional/Package-quick+nimble.swift new file mode 100644 index 0000000..b8c370a --- /dev/null +++ b/Template/optional/Package-quick+nimble.swift @@ -0,0 +1,9 @@ +import PackageDescription + +let package = Package( + name: "{PROJECT}", + dependencies: [ + .Package(url: "https://github.com/Quick/Quick.git", majorVersion: 1), + .Package(url: "https://github.com/Quick/Nimble.git", majorVersion: 6) + ] +) \ No newline at end of file diff --git a/main.swift b/main.swift index 7780ff0..d18dc5a 100755 --- a/main.swift +++ b/main.swift @@ -422,10 +422,20 @@ do { let podfileDestinationPath = destination + "/" + "Podfile" try fileManager.copyItem(atPath: podfileOriginPath, toPath: podfileDestinationPath) + let linuxOriginPath = optionalItemsPath + "/" + "LinuxMain-quick+nimble.swift" + let linuxDestinationPath = destination + "/Tests/" + "LinuxMain.swift" + try fileManager.removeItem(atPath: linuxDestinationPath) + try fileManager.copyItem(atPath: linuxOriginPath, toPath: linuxDestinationPath) + let testsOriginPath = optionalItemsPath + "/" + "ExampleTests-quick+nimble.swift" let testsDestinationPath = destination + "/Tests/{PROJECT}Tests/" + "{PROJECT}Tests.swift" try fileManager.removeItem(atPath: testsDestinationPath) try fileManager.copyItem(atPath: testsOriginPath, toPath: testsDestinationPath) + + let packageOriginPath = optionalItemsPath + "/" + "Package-quick+nimble.swift" + let packageDestinationPath = destination + "/" + "Package.swift" + try fileManager.removeItem(atPath: packageDestinationPath) + try fileManager.copyItem(atPath: packageOriginPath, toPath: packageDestinationPath) } } From 7de1bc04c5f0f552a812d634b09b52eecf459f26 Mon Sep 17 00:00:00 2001 From: Kieran Harper Date: Sat, 13 May 2017 16:13:52 +1000 Subject: [PATCH 15/15] Added note to readme about Q+N --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 28cfb68..d4cc72f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ SwiftPlate will generate Xcode projects for you in seconds, that support: - [x] watchOS - [x] tvOS - [x] Linux +- [x] Quick + Nimble testing Just run `swiftplate`, and you’ll be presented with a simple step-by-step guide: