Last active
February 16, 2025 09:42
-
-
Save blazingpair/4541144 to your computer and use it in GitHub Desktop.
Kiwi integrated with OCHamcrest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pod::Spec.new do |s| | |
s.name = 'Kiwi' | |
s.version = '2.0.3.dev' | |
s.summary = 'A Behavior Driven Development library for iOS and OS X.' | |
s.homepage = 'https://github.com/allending/Kiwi' | |
s.authors = { 'Allen Ding' => '[email protected]', 'Luke Redpath' => '[email protected]' } | |
s.license = { :type => 'MIT', :file => 'License.txt' } | |
s.source = { :git => 'https://github.com/allending/Kiwi.git', :commit => 'b5b4223884a60fa9842986421ace13ec576b54e1'} | |
s.source_files = FileList['Classes/*.{h,m}'].exclude(/KWStringPrefixMatcher/).exclude(/KWStringContainsMatcher/) | |
s.framework = 'SenTestingKit' | |
# HC_SHORTHAND is defined for project test target for naming convenience | |
s.xcconfig = { | |
'FRAMEWORK_SEARCH_PATHS' => '"$(SDKROOT)/Developer/Library/Frameworks" "$(DEVELOPER_LIBRARY_DIR)/Frameworks"', | |
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) HC_SHORTHAND' | |
} | |
# Cocoapods use above xcconfig to compile this Pod as well as project test target that uses this Pod | |
# we need to undefine HC_SHORTHAND to avoid compiler warnings when building Pod static library | |
s.prefix_header_contents = '#undef HC_SHORTHAND' | |
s.dependency 'OCHamcrest' | |
def s.post_install(target) | |
# Fix an Hamcrest integration by using Hamcrest matcher, instead of the minimal version of matcher protocol | |
header = (pod_destroot + 'Classes/KWHCMatcher.h') | |
header_contents = File.read(header) | |
header_contents.gsub!(/@protocol.+@end/m,'#import <HCMatcher.h>') | |
File.write(header, header_contents) | |
# Remove uses of minimal version of matcher protocol | |
header = (pod_destroot + 'Classes/Kiwi.h') | |
header_contents = File.read(header) | |
header_contents.gsub!(/#import "KWStringPrefixMatcher.h"/,'') | |
header_contents.gsub!(/#import "KWStringContainsMatcher.h"/,'') | |
File.write(header, header_contents) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This pod helps to solve conflict in integrating Kiwi with Hamcrest. See https://github.com/allending/Kiwi/pull/151
It also enables use of shorthand names for Hamcrest matchers within Kiwi specs.