Implemented example application building RestKit into a CLI utility for parsing files and evaluating keyPaths against the results. refs #409

This commit is contained in:
Blake Watters
2011-10-16 02:05:39 -04:00
parent 585d4aafc8
commit c45d3b2d33
8 changed files with 639 additions and 52 deletions

View File

@@ -18,10 +18,10 @@
// limitations under the License.
//
#if TARGET_OS_MAC
#import <CoreServices/CoreServices.h>
#elif TARGET_OS_IPHONE
#if TARGET_OS_IPHONE
#import <MobileCoreServices/UTType.h>
#else
#import <CoreServices/CoreServices.h>
#endif
#import "NSString+RestKit.h"
#import "../Network/RKClient.h"

View File

@@ -0,0 +1,483 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
2516F0FC144A8577004631A1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F0FB144A8577004631A1 /* Foundation.framework */; };
2516F0FF144A8577004631A1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2516F0FE144A8577004631A1 /* main.m */; };
2516F103144A8577004631A1 /* RestKit_CLI.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2516F102144A8577004631A1 /* RestKit_CLI.1 */; };
2516F156144A88EC004631A1 /* libRestKitJSONParserJSONKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F129144A8841004631A1 /* libRestKitJSONParserJSONKit.a */; };
2516F157144A88EC004631A1 /* libRestKitNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F11D144A8841004631A1 /* libRestKitNetwork.a */; };
2516F158144A88EC004631A1 /* libRestKitObjectMapping.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F11F144A8841004631A1 /* libRestKitObjectMapping.a */; };
2516F159144A88EC004631A1 /* libRestKitSupport.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F121144A8841004631A1 /* libRestKitSupport.a */; };
2516F15A144A88EC004631A1 /* libRestKitXMLParserLibxml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F12B144A8841004631A1 /* libRestKitXMLParserLibxml.a */; };
2516F15E144A8923004631A1 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F15D144A8923004631A1 /* SystemConfiguration.framework */; };
2516F160144A895E004631A1 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F15F144A895E004631A1 /* libxml2.dylib */; };
2516F162144A8AED004631A1 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2516F161144A8AED004631A1 /* CoreServices.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
2516F11C144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 253A07FC1255161B00976E89;
remoteInfo = RestKitNetwork;
};
2516F11E144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 253A08031255162C00976E89;
remoteInfo = RestKitObjectMapping;
};
2516F120144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 253A080C12551D3000976E89;
remoteInfo = RestKitSupport;
};
2516F122144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 20808DBD13DE8CDC000A156A;
remoteInfo = "RestKitJSONParser+NXJSON";
};
2516F124144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2590E64F125231F600531FA8;
remoteInfo = "RestKitJSONParser+YAJL";
};
2516F126144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2590E66B1252353700531FA8;
remoteInfo = "RestKitJSONParser+SBJSON";
};
2516F128144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 73057FD11331AD2E001908EE;
remoteInfo = "RestKitJSONParser+JSONKit";
};
2516F12A144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 25BD43BD1340315800DBACDD;
remoteInfo = "RestKitXMLParser+Libxml";
};
2516F12C144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 253A081412551D5300976E89;
remoteInfo = RestKitCoreData;
};
2516F12E144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 2523360511E79F090048F9B4;
remoteInfo = RestKitThree20;
};
2516F130144A8841004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 3F6C39A510FE5C95008F47C5;
remoteInfo = "RestKit Specs";
};
2516F15B144A88F4004631A1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 255B7588133BABBF00ED76AD;
remoteInfo = RestKit;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
2516F0F5144A8577004631A1 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
2516F103144A8577004631A1 /* RestKit_CLI.1 in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
2516F0F7144A8577004631A1 /* rkkeypath */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = rkkeypath; sourceTree = BUILT_PRODUCTS_DIR; };
2516F0FB144A8577004631A1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
2516F0FE144A8577004631A1 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2516F101144A8577004631A1 /* RestKit CLI-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RestKit CLI-Prefix.pch"; sourceTree = "<group>"; };
2516F102144A8577004631A1 /* RestKit_CLI.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = RestKit_CLI.1; sourceTree = "<group>"; };
2516F10D144A8841004631A1 /* RestKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RestKit.xcodeproj; path = ../../RestKit.xcodeproj; sourceTree = "<group>"; };
2516F15D144A8923004631A1 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
2516F15F144A895E004631A1 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
2516F161144A8AED004631A1 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
2516F0F4144A8577004631A1 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2516F162144A8AED004631A1 /* CoreServices.framework in Frameworks */,
2516F160144A895E004631A1 /* libxml2.dylib in Frameworks */,
2516F15E144A8923004631A1 /* SystemConfiguration.framework in Frameworks */,
2516F156144A88EC004631A1 /* libRestKitJSONParserJSONKit.a in Frameworks */,
2516F157144A88EC004631A1 /* libRestKitNetwork.a in Frameworks */,
2516F158144A88EC004631A1 /* libRestKitObjectMapping.a in Frameworks */,
2516F159144A88EC004631A1 /* libRestKitSupport.a in Frameworks */,
2516F15A144A88EC004631A1 /* libRestKitXMLParserLibxml.a in Frameworks */,
2516F0FC144A8577004631A1 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
2516F0EC144A8577004631A1 = {
isa = PBXGroup;
children = (
2516F0FD144A8577004631A1 /* RestKit CLI */,
2516F0FA144A8577004631A1 /* Frameworks */,
2516F0F8144A8577004631A1 /* Products */,
2516F10D144A8841004631A1 /* RestKit.xcodeproj */,
);
sourceTree = "<group>";
};
2516F0F8144A8577004631A1 /* Products */ = {
isa = PBXGroup;
children = (
2516F0F7144A8577004631A1 /* rkkeypath */,
);
name = Products;
sourceTree = "<group>";
};
2516F0FA144A8577004631A1 /* Frameworks */ = {
isa = PBXGroup;
children = (
2516F15F144A895E004631A1 /* libxml2.dylib */,
2516F161144A8AED004631A1 /* CoreServices.framework */,
2516F15D144A8923004631A1 /* SystemConfiguration.framework */,
2516F0FB144A8577004631A1 /* Foundation.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
2516F0FD144A8577004631A1 /* RestKit CLI */ = {
isa = PBXGroup;
children = (
2516F0FE144A8577004631A1 /* main.m */,
2516F102144A8577004631A1 /* RestKit_CLI.1 */,
2516F100144A8577004631A1 /* Supporting Files */,
);
path = "RestKit CLI";
sourceTree = "<group>";
};
2516F100144A8577004631A1 /* Supporting Files */ = {
isa = PBXGroup;
children = (
2516F101144A8577004631A1 /* RestKit CLI-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
2516F10E144A8841004631A1 /* Products */ = {
isa = PBXGroup;
children = (
2516F11D144A8841004631A1 /* libRestKitNetwork.a */,
2516F11F144A8841004631A1 /* libRestKitObjectMapping.a */,
2516F121144A8841004631A1 /* libRestKitSupport.a */,
2516F123144A8841004631A1 /* libRestKitJSONParserNXJSON.a */,
2516F125144A8841004631A1 /* libRestKitJSONParserYAJL.a */,
2516F127144A8841004631A1 /* libRestKitJSONParserSBJSON.a */,
2516F129144A8841004631A1 /* libRestKitJSONParserJSONKit.a */,
2516F12B144A8841004631A1 /* libRestKitXMLParserLibxml.a */,
2516F12D144A8841004631A1 /* libRestKitCoreData.a */,
2516F12F144A8841004631A1 /* libRestKitThree20.a */,
2516F131144A8841004631A1 /* RestKitSpecs.app */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
2516F0F6144A8577004631A1 /* RestKit CLI */ = {
isa = PBXNativeTarget;
buildConfigurationList = 2516F106144A8577004631A1 /* Build configuration list for PBXNativeTarget "RestKit CLI" */;
buildPhases = (
2516F0F3144A8577004631A1 /* Sources */,
2516F0F4144A8577004631A1 /* Frameworks */,
2516F0F5144A8577004631A1 /* CopyFiles */,
2516F28E144AB1F1004631A1 /* Copy to Tools */,
);
buildRules = (
);
dependencies = (
2516F15C144A88F4004631A1 /* PBXTargetDependency */,
);
name = "RestKit CLI";
productName = "RestKit CLI";
productReference = 2516F0F7144A8577004631A1 /* rkkeypath */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
2516F0EE144A8577004631A1 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0420;
};
buildConfigurationList = 2516F0F1144A8577004631A1 /* Build configuration list for PBXProject "RestKit CLI" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 2516F0EC144A8577004631A1;
productRefGroup = 2516F0F8144A8577004631A1 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 2516F10E144A8841004631A1 /* Products */;
ProjectRef = 2516F10D144A8841004631A1 /* RestKit.xcodeproj */;
},
);
projectRoot = "";
targets = (
2516F0F6144A8577004631A1 /* RestKit CLI */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
2516F11D144A8841004631A1 /* libRestKitNetwork.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitNetwork.a;
remoteRef = 2516F11C144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F11F144A8841004631A1 /* libRestKitObjectMapping.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitObjectMapping.a;
remoteRef = 2516F11E144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F121144A8841004631A1 /* libRestKitSupport.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitSupport.a;
remoteRef = 2516F120144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F123144A8841004631A1 /* libRestKitJSONParserNXJSON.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitJSONParserNXJSON.a;
remoteRef = 2516F122144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F125144A8841004631A1 /* libRestKitJSONParserYAJL.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitJSONParserYAJL.a;
remoteRef = 2516F124144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F127144A8841004631A1 /* libRestKitJSONParserSBJSON.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitJSONParserSBJSON.a;
remoteRef = 2516F126144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F129144A8841004631A1 /* libRestKitJSONParserJSONKit.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitJSONParserJSONKit.a;
remoteRef = 2516F128144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F12B144A8841004631A1 /* libRestKitXMLParserLibxml.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitXMLParserLibxml.a;
remoteRef = 2516F12A144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F12D144A8841004631A1 /* libRestKitCoreData.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitCoreData.a;
remoteRef = 2516F12C144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F12F144A8841004631A1 /* libRestKitThree20.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRestKitThree20.a;
remoteRef = 2516F12E144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
2516F131144A8841004631A1 /* RestKitSpecs.app */ = {
isa = PBXReferenceProxy;
fileType = wrapper.application;
path = RestKitSpecs.app;
remoteRef = 2516F130144A8841004631A1 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXShellScriptBuildPhase section */
2516F28E144AB1F1004631A1 /* Copy to Tools */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Copy to Tools";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cp \"${BUILT_PRODUCTS_DIR}/rkkeypath\" \"${SOURCE_ROOT}/../../Tools\"";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
2516F0F3144A8577004631A1 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2516F0FF144A8577004631A1 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
2516F15C144A88F4004631A1 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = RestKit;
targetProxy = 2516F15B144A88F4004631A1 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
2516F104144A8577004631A1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
2516F105144A8577004631A1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;
};
2516F107144A8577004631A1 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RestKit CLI/RestKit CLI-Prefix.pch";
HEADER_SEARCH_PATHS = ../../Build;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = rkkeypath;
};
name = Debug;
};
2516F108144A8577004631A1 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "RestKit CLI/RestKit CLI-Prefix.pch";
HEADER_SEARCH_PATHS = ../../Build;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = rkkeypath;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
2516F0F1144A8577004631A1 /* Build configuration list for PBXProject "RestKit CLI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2516F104144A8577004631A1 /* Debug */,
2516F105144A8577004631A1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
2516F106144A8577004631A1 /* Build configuration list for PBXNativeTarget "RestKit CLI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
2516F107144A8577004631A1 /* Debug */,
2516F108144A8577004631A1 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 2516F0EE144A8577004631A1 /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:RestKit CLI.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,7 @@
//
// Prefix header for all source files of the 'RestKit CLI' target in the 'RestKit CLI' project
//
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif

View File

@@ -0,0 +1,79 @@
.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
.\"See Also:
.\"man mdoc.samples for a complete listing of options
.\"man mdoc for the short list of editing options
.\"/usr/share/misc/mdoc.template
.Dd 10/15/11 \" DATE
.Dt RestKit CLI 1 \" Program name and manual section number
.Os Darwin
.Sh NAME \" Section Header - required - don't modify
.Nm RestKit CLI,
.\" The following lines are read in generating the apropos(man -k) database. Use only key
.\" words here as the database is built based on the words here and in the .ND line.
.Nm Other_name_for_same_program(),
.Nm Yet another name for the same program.
.\" Use .Nm macro to designate other names for the documented program.
.Nd This line parsed for whatis database.
.Sh SYNOPSIS \" Section Header - required - don't modify
.Nm
.Op Fl abcd \" [-abcd]
.Op Fl a Ar path \" [-a path]
.Op Ar file \" [file]
.Op Ar \" [file ...]
.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
arg2 ... \" Arguments
.Sh DESCRIPTION \" Section Header - required - don't modify
Use the .Nm macro to refer to your program throughout the man page like such:
.Nm
Underlining is accomplished with the .Ar macro like this:
.Ar underlined text .
.Pp \" Inserts a space
A list of items with descriptions:
.Bl -tag -width -indent \" Begins a tagged list
.It item a \" Each item preceded by .It macro
Description of item a
.It item b
Description of item b
.El \" Ends the list
.Pp
A list of flags and their descriptions:
.Bl -tag -width -indent \" Differs from above in tag removed
.It Fl a \"-a flag as a list item
Description of -a flag
.It Fl b
Description of -b flag
.El \" Ends the list
.Pp
.\" .Sh ENVIRONMENT \" May not be needed
.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
.\" .It Ev ENV_VAR_1
.\" Description of ENV_VAR_1
.\" .It Ev ENV_VAR_2
.\" Description of ENV_VAR_2
.\" .El
.Sh FILES \" File used or created by the topic of the man page
.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
.It Pa /usr/share/file_name
FILE_1 description
.It Pa /Users/joeuser/Library/really_long_file_name
FILE_2 description
.El \" Ends the list
.\" .Sh DIAGNOSTICS \" May not be needed
.\" .Bl -diag
.\" .It Diagnostic Tag
.\" Diagnostic informtion here.
.\" .It Diagnostic Tag
.\" Diagnostic informtion here.
.\" .El
.Sh SEE ALSO
.\" List links in ascending order by section, alphabetically within a section.
.\" Please do not reference files that do not exist without filing a bug report
.Xr a 1 ,
.Xr b 1 ,
.Xr c 1 ,
.Xr a 2 ,
.Xr b 2 ,
.Xr a 3 ,
.Xr b 3
.\" .Sh BUGS \" Document known, unremedied bugs
.\" .Sh HISTORY \" Document history if command behaves in a unique manner

View File

@@ -0,0 +1,60 @@
//
// main.m
// RestKit CLI
//
// Created by Blake Watters on 10/15/11.
// Copyright (c) 2011 RestKit. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <RestKit/RestKit.h>
int main (int argc, const char * argv[])
{
@autoreleasepool {
RKLogConfigureByName("App", RKLogLevelTrace);
// Validate arguments
if (argc < 2) {
printf("usage: %s path/to/file [keyPath]\n", argv[0]);
printf("Parses the specified file and outputs the payload.\n"
"If keyPath is provided it will be evaluated against the payload and the result printed.\n");
return 0;
}
NSString *filePathOrURL = [NSString stringWithCString:argv[1] encoding:NSUTF8StringEncoding];
NSURL *URL = nil;
NSString *keyPath = nil;
if ([filePathOrURL rangeOfString:@"://"].length == 0) {
// Local file
URL = [NSURL fileURLWithPath:filePathOrURL];
} else {
// Web URL
URL = [NSURL URLWithString:filePathOrURL];
}
if (argc == 3) keyPath = [NSString stringWithCString:argv[2] encoding:NSUTF8StringEncoding];
NSError *error = nil;
NSString *payload = [NSString stringWithContentsOfURL:URL encoding:NSUTF8StringEncoding error:&error];
if (!payload) {
RKLogError(@"Failed to read file at path %@: %@", URL, error);
return 0;
}
NSString *MIMEType = [[URL absoluteString] MIMETypeForPathExtension];
RKLogInfo(@"Parsing %@ using MIME Type: %@", URL, MIMEType);
id<RKParser> parser = [[RKParserRegistry sharedRegistry] parserForMIMEType:MIMEType];
id parsedData = [parser objectFromString:payload error:&error];
if (!parsedData) {
RKLogError(@"Failed to parse file: %@", error);
RKLogError(@"Payload => %@", payload);
return 0;
}
RKLogInfo(@"Parsed data => %@", parsedData);
if (keyPath) RKLogInfo(@"valueForKeyPath:@\"%@\" => %@", keyPath, [parsedData valueForKeyPath:keyPath]);
}
return 0;
}

View File

@@ -1,49 +0,0 @@
#!/usr/bin/ruby
input = ""
ARGV.each do |b|
input = b
end
if input == ""
puts "
This tool parses RestKit logging output and turns it into a curl request so you can see what is going on easier. Simply copy and paste the 'Headers' and 'Sending' lines out of the XCode Console and pass them in to this tool to see the curl request & response.
This is an easy way to see the output from an RKRequest.
USAGE:\n./rkcurl \"2011-01-20 11:40:07.122 DiscussionBoard[25362:40b] Headers: {
Accept = \"application/json\";
\"X-User-Access-Token\" = csitBupAGxaNVVX6XSo;
}
2011-01-20 11:40:07.123 DiscussionBoard[25362:40b] Sending GET request to URL http://discussionboard.heroku.com/topics/4/posts. HTTP Body:
\"
"
exit 0
end
headersString = input.match(/.*Headers: \{(.*)\}/m)[1]
headers = []
headersString.each_line do |line|
next if line.strip.size == 0
headers << line.strip.gsub(";", "").gsub(" = ", ": ")
end
method = input.match(/Sending (.*) request to/m)[1]
url = input.match(/URL (.*)\. HTTP Body/m)[1]
data = nil
dataMatch = input.match(/HTTP Body: (.*)\n/m)
data = dataMatch[1] if dataMatch
command = "curl -i -X #{method} "
command << "-d \"#{data.gsub('"', '\"')}\" " if data
for header in headers
command << "-H \"#{header.gsub('"', '\"')}\" "
end
command << url
puts command
output = `#{command}`
puts output

BIN
Tools/rkkeypath Executable file

Binary file not shown.