Permalink
Browse files

Added example of installing the EGORefreshTableHeaderView library to …

…a project
  • Loading branch information...
1 parent 9e38f84 commit 54ea37ca61853eba1bf428fd5bf66a42906dc7d7 @burtlo burtlo committed Feb 10, 2012
Showing with 2,343 additions and 0 deletions.
  1. +47 −0 examples/Cedar/groups/Specs/Specs-Info.plist
  2. +14 −0 examples/Cedar/groups/Specs/Specs-Prefix.pch
  3. +2 −0 examples/Cedar/groups/Specs/en.lproj/InfoPlist.strings
  4. +18 −0 examples/Cedar/groups/Specs/main.m
  5. +1 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Cedar-iPhone
  6. +1 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Headers
  7. +1 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Resources
  8. BIN examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Cedar-iPhone
  9. +117 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/ActualValue.h
  10. +51 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/Base.h
  11. +79 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeCloseTo.h
  12. +29 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeEmpty.h
  13. +66 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeGTE.h
  14. +61 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeGreaterThan.h
  15. +64 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeInstanceOf.h
  16. +66 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeLTE.h
  17. +61 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeLessThan.h
  18. +55 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeNil.h
  19. +59 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeSameInstanceAs.h
  20. +31 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/BeTruthy.h
  21. +6 −0 ...s/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRColorizedReporter.h
  22. +44 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRExampleBase.h
  23. +12 −0 ...ups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRExampleDetailsViewController.h
  24. +15 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRExampleParent.h
  25. +9 −0 ...les/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRExampleReporter.h
  26. +7 −0 ...ps/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRExampleReporterViewController.h
  27. +8 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRFunctions.h
  28. +32 −0 ...ar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRSharedExampleGroupPool.h
  29. +62 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRSpec.h
  30. +19 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CDRSpecFailure.h
  31. +7 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/Cedar.h
  32. +22 −0 ...dar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CedarApplicationDelegate.h
  33. +6 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CedarComparators.h
  34. +20 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CedarMatchers.h
  35. +6 −0 ...ples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CedarStringifiers.h
  36. +2 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/ComparatorsBase.h
  37. +90 −0 ...s/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/ComparatorsContainer.h
  38. +50 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CompareEqual.h
  39. +54 −0 ...les/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/CompareGreaterThan.h
  40. +48 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/Contain.h
  41. +72 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/Equal.h
  42. +83 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/RaiseException.h
  43. +30 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/ShouldSyntax.h
  44. +18 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/SpecHelper.h
  45. +32 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/StringifiersBase.h
  46. +41 −0 .../Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/A/Headers/StringifiersContainer.h
  47. +1 −0 examples/Cedar/groups/Vendor/Frameworks/Cedar-iPhone.framework/Versions/Current
  48. +65 −0 examples/EGORefreshTableHeaderView/Vendor/EGORefreshTableHeaderView/EGORefreshTableHeaderView.h
  49. +263 −0 examples/EGORefreshTableHeaderView/Vendor/EGORefreshTableHeaderView/EGORefreshTableHeaderView.m
  50. +9 −0 lib/xcode/group.rb
  51. +22 −0 lib/xcode/project.rb
  52. +65 −0 spec/TestProject/Vendor/EGORefreshTableHeaderView/EGORefreshTableHeaderView.h
  53. +263 −0 spec/TestProject/Vendor/EGORefreshTableHeaderView/EGORefreshTableHeaderView.m
  54. +37 −0 spec/integration/pull_to_refresh_install_spec.rb
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFiles</key>
+ <array/>
+ <key>CFBundleIdentifier</key>
+ <string>company.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'Specs' target in the 'Specs' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_3_0
+#warning "This project uses features only available in iOS SDK 3.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
@@ -0,0 +1,18 @@
+//
+// main.m
+// Specs
+//
+// Created by Franklin Webber on 2/8/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <Cedar-iPhone/Cedar.h>
+
+int main(int argc, char *argv[]) {
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+
+ int retVal = UIApplicationMain(argc, argv, nil, @"CedarApplicationDelegate");
+ [pool release];
+ return retVal;
+}
@@ -0,0 +1,117 @@
+#import <Foundation/Foundation.h>
+#import <iostream>
+
+#import "StringifiersBase.h"
+#import "CDRSpecFailure.h"
+
+namespace Cedar { namespace Matchers {
+
+ void CDR_fail(const char *fileName, int lineNumber, NSString * reason);
+
+ template<typename T> class ActualValue;
+
+#pragma mark class ActualValueMatchProxy
+ template<typename T>
+ class ActualValueMatchProxy {
+ private:
+ template<typename U>
+ ActualValueMatchProxy(const ActualValueMatchProxy<U> &);
+ template<typename U>
+ ActualValueMatchProxy & operator=(const ActualValueMatchProxy<U> &);
+
+ public:
+ explicit ActualValueMatchProxy(const ActualValue<T> &, bool negate = false);
+ ActualValueMatchProxy();
+
+ template<typename MatcherType> void operator()(const MatcherType &) const;
+ ActualValueMatchProxy<T> negate() const;
+
+ private:
+ const ActualValue<T> & actualValue_;
+ bool negate_;
+ };
+
+ template<typename T>
+ ActualValueMatchProxy<T>::ActualValueMatchProxy(const ActualValue<T> & actualValue, bool negate /*= false */)
+ : actualValue_(actualValue), negate_(negate) {}
+
+ template<typename T> template<typename MatcherType>
+ void ActualValueMatchProxy<T>::operator()(const MatcherType & matcher) const {
+ if (negate_) {
+ actualValue_.execute_negative_match(matcher);
+ } else {
+ actualValue_.execute_positive_match(matcher);
+ }
+ }
+
+ template<typename T>
+ ActualValueMatchProxy<T> ActualValueMatchProxy<T>::negate() const {
+ return ActualValueMatchProxy<T>(actualValue_, !negate_);
+ }
+
+#pragma mark class ActualValue
+ template<typename T>
+ class ActualValue {
+ private:
+ template<typename U>
+ ActualValue(const ActualValue<U> &);
+ template<typename U>
+ ActualValue & operator=(const ActualValue<U> &);
+
+ public:
+ explicit ActualValue(const char *, int, const T &);
+ ~ActualValue();
+
+ ActualValueMatchProxy<T> to;
+ ActualValueMatchProxy<T> to_not;
+
+ private:
+ template<typename MatcherType> void execute_positive_match(const MatcherType &) const;
+ template<typename MatcherType> void execute_negative_match(const MatcherType &) const;
+ friend class ActualValueMatchProxy<T>;
+
+ private:
+ const T & value_;
+ std::string fileName_;
+ int lineNumber_;
+ };
+
+ template<typename T>
+ ActualValue<T>::ActualValue(const char *fileName, int lineNumber, const T & value) : fileName_(fileName), lineNumber_(lineNumber), value_(value), to(*this), to_not(*this, true) {
+ }
+
+ template<typename T>
+ ActualValue<T>::~ActualValue() {
+ }
+
+ template<typename T> template<typename MatcherType>
+ void ActualValue<T>::execute_positive_match(const MatcherType & matcher) const {
+ if (!matcher.matches(value_)) {
+ CDR_fail(fileName_.c_str(), lineNumber_, matcher.failure_message_for(value_));
+ }
+ }
+
+ template<typename T> template<typename MatcherType>
+ void ActualValue<T>::execute_negative_match(const MatcherType & matcher) const {
+ if (matcher.matches(value_)) {
+ CDR_fail(fileName_.c_str(), lineNumber_, matcher.negative_failure_message_for(value_));
+ }
+ }
+
+ template<typename T>
+ const ActualValue<T> CDR_expect(const char *fileName, int lineNumber, const T & actualValue) {
+ return ActualValue<T>(fileName, lineNumber, actualValue);
+ }
+
+ inline void CDR_fail(const char *fileName, int lineNumber, NSString * reason) {
+ [[CDRSpecFailure specFailureWithReason:reason
+ fileName:[NSString stringWithUTF8String:fileName]
+ lineNumber:lineNumber] raise];
+ }
+
+}}
+
+#ifndef CEDAR_MATCHERS_COMPATIBILITY_MODE
+ #define expect(x) CDR_expect(__FILE__, __LINE__, (x))
+ #define fail(x) CDR_fail(__FILE__, __LINE__, (x))
+#endif
@@ -0,0 +1,51 @@
+#import <Foundation/Foundation.h>
+#import <sstream>
+
+#import "CedarStringifiers.h"
+
+namespace Cedar { namespace Matchers {
+ struct BaseMessageBuilder {
+ template<typename U>
+ static NSString * string_for_actual_value(const U & value) {
+ return Stringifiers::string_for(value);
+ }
+ };
+
+ /**
+ * Basic functionality for all matchers. Meant to be used as a convenience base class for
+ * matcher classes.
+ */
+ template<typename MessageBuilder_ = BaseMessageBuilder>
+ class Base {
+ private:
+ Base & operator=(const Base &);
+
+ public:
+ Base();
+ virtual ~Base() = 0;
+ // Allow default copy ctor.
+
+ template<typename U>
+ NSString * failure_message_for(const U &) const;
+ template<typename U>
+ NSString * negative_failure_message_for(const U &) const;
+
+ protected:
+ virtual NSString * failure_message_end() const = 0;
+ };
+
+ template<typename MessageBuilder_>
+ Base<MessageBuilder_>::Base() {}
+ template<typename MessageBuilder_>
+ Base<MessageBuilder_>::~Base() {}
+
+ template<typename MessageBuilder_> template<typename U>
+ NSString * Base<MessageBuilder_>::failure_message_for(const U & value) const {
+ return [NSString stringWithFormat:@"Expected <%@> to %@", MessageBuilder_::string_for_actual_value(value), this->failure_message_end()];
+ }
+
+ template<typename MessageBuilder_> template<typename U>
+ NSString * Base<MessageBuilder_>::negative_failure_message_for(const U & value) const {
+ return [NSString stringWithFormat:@"Expected <%@> to not %@", MessageBuilder_::string_for_actual_value(value), this->failure_message_end()];
+ }
+}}
@@ -0,0 +1,79 @@
+#import <Foundation/Foundation.h>
+#import "Base.h"
+
+namespace Cedar { namespace Matchers {
+ template<typename T>
+ class BeCloseTo : public Base<> {
+ private:
+ BeCloseTo<T> & operator=(const BeCloseTo<T> &);
+
+ public:
+ explicit BeCloseTo(const T & expectedValue);
+ ~BeCloseTo();
+ // Allow default copy ctor.
+
+ BeCloseTo<T> & within(float threshold);
+
+ template<typename U>
+ bool matches(const U &) const;
+ bool matches(NSNumber * const &) const;
+
+ protected:
+ virtual NSString * failure_message_end() const;
+
+ private:
+ template<typename U, typename V>
+ bool subtractable_types_match(const U &, const V &) const;
+
+ private:
+ const T & expectedValue_;
+ float threshold_;
+ };
+
+ template<typename T>
+ BeCloseTo<T> be_close_to(const T & expectedValue) {
+ return BeCloseTo<T>(expectedValue);
+ }
+
+ template<typename T>
+ BeCloseTo<T>::BeCloseTo(const T & expectedValue)
+ : Base<>(), expectedValue_(expectedValue), threshold_(0.01) {
+ }
+
+ template<typename T>
+ BeCloseTo<T>::~BeCloseTo() {
+ }
+
+ template<typename T>
+ BeCloseTo<T> & BeCloseTo<T>::within(float threshold) {
+ threshold_ = threshold;
+ return *this;
+ }
+
+ template<typename T>
+ /*virtual*/ NSString * BeCloseTo<T>::failure_message_end() const {
+ return [NSString stringWithFormat:@"be close to <%@> (within %@)", Stringifiers::string_for(expectedValue_), Stringifiers::string_for(threshold_)];
+ }
+
+ template<typename T> template<typename U, typename V>
+ bool BeCloseTo<T>::subtractable_types_match(const U & actualValue, const V & expectedValue) const {
+ return actualValue > expectedValue - threshold_ && actualValue < expectedValue + threshold_;
+ }
+
+#pragma mark Generic
+ template<typename T> template<typename U>
+ bool BeCloseTo<T>::matches(const U & actualValue) const {
+ return this->subtractable_types_match(actualValue, expectedValue_);
+ }
+
+#pragma mark NSNumber
+ template<typename T>
+ bool BeCloseTo<T>::matches(NSNumber * const & actualValue) const {
+ return this->matches([actualValue floatValue]);
+ }
+
+ template<> template<typename U>
+ bool BeCloseTo<NSNumber *>::matches(const U & actualValue) const {
+ return this->subtractable_types_match(actualValue, [expectedValue_ floatValue]);
+ }
+}}
@@ -0,0 +1,29 @@
+#import "Base.h"
+
+namespace Cedar { namespace Matchers {
+ class BeEmpty : public Base<> {
+ private:
+ BeEmpty & operator=(const BeEmpty &);
+
+ public:
+ inline BeEmpty() : Base<>() {}
+ inline ~BeEmpty() {}
+ // Allow default copy ctor.
+
+ inline const BeEmpty & operator()() const { return *this; }
+
+ template<typename U>
+ bool matches(const U &) const;
+
+ protected:
+ inline /*virtual*/ NSString * failure_message_end() const { return @"be empty"; }
+ };
+
+ static const BeEmpty be_empty = BeEmpty();
+
+#pragma mark Generic
+ template<typename U>
+ bool BeEmpty::matches(const U & actualValue) const {
+ return Comparators::compare_empty(actualValue);
+ }
+}}
Oops, something went wrong.

0 comments on commit 54ea37c

Please sign in to comment.