// // LaneFileProtocol.swift // FastlaneSwiftRunner // // Created by Joshua Liebowitz on 8/4/17. // Copyright © 2017 Joshua Liebowitz. All rights reserved. // import Foundation public protocol LaneFileProtocol: class { var fastlaneVersion: String { get } static func runLane(named: String) func recordLaneDescriptions() func beforeAll() func afterAll(currentLane: String) func onError(currentLane: String, errorInfo: String) } public extension LaneFileProtocol { var fastlaneVersion: String { return "" } // default "" because that means any is fine func beforeAll() { } // no op by default func afterAll(currentLane: String) { } // no op by default func onError(currentLane: String, errorInfo: String) {} // no op by default func recordLaneDescriptions() { } // no op by default } @objcMembers public class LaneFile: NSObject, LaneFileProtocol { private(set) static var fastfileInstance: Fastfile? // Called before any lane is executed. private func setupAllTheThings() { // Step 1, add lange descriptions (self as! Fastfile).recordLaneDescriptions() // Step 2, run beforeAll() function LaneFile.fastfileInstance!.beforeAll() } public static var lanes: [String : String] { var laneToMethodName: [String : String] = [:] var methodCount: UInt32 = 0 let methodList = class_copyMethodList(self, &methodCount) for i in 0..