Skip to content

Commit

Permalink
Merge pull request #9 from alexmx/develop
Browse files Browse the repository at this point in the history
Add podspec.
  • Loading branch information
alexmx committed Feb 27, 2016
2 parents 35503b6 + 6296fd3 commit 0109f0d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
19 changes: 19 additions & 0 deletions Insider.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

Pod::Spec.new do |s|

s.name = "Insider"
s.version = "0.1"
s.summary = "Set a communication channel between your app and external testing environments."

s.description = <<-DESC
Insider is a testing utility framework which sets an HTTP communication channel between the app and testing environments like Appium, Calabash, Frank, etc.
DESC
s.homepage = "https://github.com/alexmx/Insider"
s.license = "MIT"
s.authors = { "Alex Maimescu" => "[email protected]" }

s.platform = :ios
s.source = { :path => "." }
s.source_files = "Insider/**/*.{h,m,swift}"

end
4 changes: 2 additions & 2 deletions Insider.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@
CD75FF831C776EB800F82FF1 /* SSMemoryInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD75FF481C776EB800F82FF1 /* SSMemoryInfo.h */; };
CD75FF841C776EB800F82FF1 /* SSMemoryInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CD75FF491C776EB800F82FF1 /* SSMemoryInfo.m */; };
CD75FF851C776EB800F82FF1 /* SSNetworkInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD75FF4A1C776EB800F82FF1 /* SSNetworkInfo.h */; };
CD75FF861C776EB800F82FF1 /* SSNetworkInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CD75FF4B1C776EB800F82FF1 /* SSNetworkInfo.m */; };
CD75FF861C776EB800F82FF1 /* SSNetworkInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CD75FF4B1C776EB800F82FF1 /* SSNetworkInfo.m */; settings = {COMPILER_FLAGS = "-Wno-format"; }; };
CD75FF871C776EB800F82FF1 /* SSProcessInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD75FF4C1C776EB800F82FF1 /* SSProcessInfo.h */; };
CD75FF881C776EB800F82FF1 /* SSProcessInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CD75FF4D1C776EB800F82FF1 /* SSProcessInfo.m */; };
CD75FF891C776EB800F82FF1 /* SSProcessorInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CD75FF4E1C776EB800F82FF1 /* SSProcessorInfo.h */; };
CD75FF8A1C776EB800F82FF1 /* SSProcessorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CD75FF4F1C776EB800F82FF1 /* SSProcessorInfo.m */; };
CD75FF8B1C776EB800F82FF1 /* SSUUID.h in Headers */ = {isa = PBXBuildFile; fileRef = CD75FF501C776EB800F82FF1 /* SSUUID.h */; };
CD75FF8C1C776EB800F82FF1 /* SSUUID.m in Sources */ = {isa = PBXBuildFile; fileRef = CD75FF511C776EB800F82FF1 /* SSUUID.m */; };
CD75FF8C1C776EB800F82FF1 /* SSUUID.m in Sources */ = {isa = PBXBuildFile; fileRef = CD75FF511C776EB800F82FF1 /* SSUUID.m */; settings = {COMPILER_FLAGS = "-Wno-format"; }; };
CD75FF8E1C776F9300F82FF1 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = CD75FF8D1C776F9300F82FF1 /* libz.tbd */; };
CDBD90BD1C7636D700879F0C /* DeviceInfoService.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDBD90BC1C7636D700879F0C /* DeviceInfoService.swift */; };
CDCF8EB91C7722B300BD0B1D /* LocalWebServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDCF8EB81C7722B300BD0B1D /* LocalWebServer.swift */; };
Expand Down
18 changes: 9 additions & 9 deletions Insider/Insider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ final public class Insider: NSObject {
static let systemInfo = "/systemInfo"
}

struct Constants {
static let invokeMethodSelector = Selector("insiderInvoke:")
static let invokeForResponseMethodSelector = Selector("insiderInvokeForResponse:")
}

/// Shared instance
public static let sharedInstance = Insider()

Expand All @@ -85,14 +80,14 @@ final public class Insider: NSObject {
// Invoke method on delegate
server.addHandlerForMethod(.POST, path: Endpoints.invokeEndpoint) { (requestParams) -> (LocalWebServerResponse) in

let didProcessParams = self.invokeMethodWithSelector(Constants.invokeMethodSelector, params: requestParams)
let didProcessParams = self.invokeMethodOnDelegateWithParams(requestParams)
return LocalWebServerResponse(statusCode: (didProcessParams) ? .Success : .NotFound)
}

// Invoke method on delegate and wait for return value
server.addHandlerForMethod(.POST, path: Endpoints.invokeWithResponse) { (requestParams) -> (LocalWebServerResponse) in

let response = self.invokeMethodForResponseWithSelector(Constants.invokeForResponseMethodSelector, params: requestParams)
let response = self.invokeMethodOnDelegateWithParamsForResponse(requestParams)
return (response == nil) ? LocalWebServerResponse(statusCode: .NotFound) : LocalWebServerResponse(response: response)
}

Expand All @@ -108,7 +103,7 @@ final public class Insider: NSObject {
}
}

func invokeMethodWithSelector(selector: Selector, params: AnyObject?) -> Bool {
func invokeMethodOnDelegateWithParams(params: AnyObject?) -> Bool {
guard let delegate = delegate else {
return false
}
Expand All @@ -120,7 +115,7 @@ final public class Insider: NSObject {
return true
}

func invokeMethodForResponseWithSelector(selector: Selector, params: AnyObject?) -> Dictionary<String, AnyObject>? {
func invokeMethodOnDelegateWithParamsForResponse(params: AnyObject?) -> Dictionary<String, AnyObject>? {
var response: AnyObject?
mainQueue {
response = self.delegate?.insider(self, invokeMethodForResponseWithParams: params)
Expand Down Expand Up @@ -156,6 +151,11 @@ final public class Insider: NSObject {
localWebServer.start()
}

public func startWithDelegate(delegate: InsiderDelegate?) {
self.delegate = delegate
start()
}

public func startWithPort(port: UInt) {
addHandlersForServer(localWebServer)
localWebServer.startWithPort(port)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Insider is a **testing utility framework** which sets an HTTP communication brid

| Built-in Features
------------ | -------------
💡 | Invoke a method on a registerd**delegate** with given parameters;
📎 | Invoke a method on a registerd **delegate** with given parameters and wait for response;
💡 | Invoke a method on a registered **delegate** with given parameters;
📎 | Invoke a method on a registered **delegate** with given parameters and wait for response;
📢 | Send local notifications through **NSNotificationCenter** with given parameters;
📱 | Get device system state information (CPU, memory, IP address, etc);

Expand Down

0 comments on commit 0109f0d

Please sign in to comment.