diff --git a/.gitignore b/.gitignore index b80fba0..601ea33 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ DerivedData .idea/ Pods +TransitionKit.xcodeproj/xcshareddata/xcschemes \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 00fc396..0185c4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,4 @@ language: objective-c before_install: - brew update - brew install xctool --HEAD - - mkdir -p TransitionKit.xcodeproj/xcshareddata/xcschemes && cp Specs/Schemes/*.xcscheme TransitionKit.xcodeproj/xcshareddata/xcschemes/ script: rake spec diff --git a/Rakefile b/Rakefile index 3bf27be..2b930fc 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,25 @@ +def build_and_run_tests(command, sdk_name) + %w{build-tests test}.each do |action| + sdk = (action == 'test') ? "-test-sdk #{sdk_name}" : "-sdk #{sdk_name}" + cmd = command % { action: action, sdk: sdk } + puts "Executing `#{cmd}`..." + return unless system(cmd) + end +end + namespace :spec do + task :prepare do + system("mkdir -p TransitionKit.xcodeproj/xcshareddata/xcschemes && cp Specs/Schemes/*.xcscheme TransitionKit.xcodeproj/xcshareddata/xcschemes/") + end + desc "Run the TransitionKit Specs for iOS" - task :ios do - $ios_success = system("xctool -workspace TransitionKit.xcworkspace -scheme 'iOS Specs' test -test-sdk iphonesimulator") + task :ios => :prepare do + $ios_success = build_and_run_tests("xctool -workspace TransitionKit.xcworkspace -scheme 'iOS Specs' %{action} %{sdk} ONLY_ACTIVE_ARCH=NO", :iphonesimulator) end desc "Run the TransitionKit Specs for Mac OS X" - task :osx do - $osx_success = system("xctool -workspace TransitionKit.xcworkspace -scheme 'OS X Specs' test -test-sdk macosx -sdk macosx") + task :osx => :prepare do + $osx_success = build_and_run_tests("xctool -workspace TransitionKit.xcworkspace -scheme 'OS X Specs' %{action} %{sdk}", :macosx) end end @@ -21,4 +34,4 @@ task :spec => ['spec:ios', 'spec:osx'] do end end -task :default => 'test' +task :default => 'spec'