From 906e33dd55ad160c6ce4643db76b9bf1ad21c12f Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Thu, 10 Jan 2013 23:13:08 -0500 Subject: [PATCH] Restore execution of Unit Tests via Rake --- Gemfile.lock | 36 +++++----- Rakefile | 62 +++-------------- .../xcschemes/RestKitFrameworkTests.xcscheme | 69 +++++++++++++++++++ .../xcschemes/RestKitTests.xcscheme | 69 +++++++++++++++++++ 4 files changed, 168 insertions(+), 68 deletions(-) create mode 100644 RestKit.xcworkspace/xcshareddata/xcschemes/RestKitFrameworkTests.xcscheme create mode 100644 RestKit.xcworkspace/xcshareddata/xcschemes/RestKitTests.xcscheme diff --git a/Gemfile.lock b/Gemfile.lock index eeddf31b..f30766c6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,9 +6,9 @@ GIT GIT remote: git://github.com/rayh/xcoder.git - revision: ce2b36ed9e2f44513d22d2389576616e72d802b4 + revision: 4071b9f87acdb4fe4e25c3fc862d0ca45eac9b67 specs: - xcoder (0.1.12) + xcoder (0.1.15) builder json nokogiri @@ -17,21 +17,21 @@ GIT GIT remote: git://github.com/sinatra/sinatra.git - revision: 1e0a6472717f6ee5054ddd1e67d1af41b4f80c91 + revision: 9984d0d2b3f1ea12273c6c25f8e102b2329f33e9 specs: sinatra (1.4.0) - rack (~> 1.3, >= 1.3.6) - rack-protection (~> 1.2) + rack (~> 1.4) + rack-protection (~> 1.3) tilt (~> 1.3, >= 1.3.3) GEM remote: http://rubygems.org/ specs: - activesupport (3.2.9) + activesupport (3.2.11) i18n (~> 0.6) multi_json (~> 1.0) addressable (2.3.2) - builder (3.1.3) + builder (3.1.4) cocoapods (0.16.0) activesupport (~> 3.2.6) colored (~> 1.2) @@ -51,7 +51,7 @@ GEM debugger-ruby_core_source (~> 1.1.3) debugger-linecache (1.1.2) debugger-ruby_core_source (>= 1.1.1) - debugger-ruby_core_source (1.1.3) + debugger-ruby_core_source (1.1.6) escape (0.0.4) eventmachine (1.0.0) faker (1.1.2) @@ -62,23 +62,25 @@ GEM faraday (>= 0.7.4, < 0.9) hashie (1.2.0) i18n (0.6.1) - json (1.7.5) + json (1.7.6) mime-types (1.19) - multi_json (1.3.7) + multi_json (1.5.0) multipart-post (1.1.5) - nokogiri (1.5.5) - octokit (1.18.0) + netrc (0.7.7) + nokogiri (1.5.6) + octokit (1.21.0) addressable (~> 2.2) faraday (~> 0.8) - faraday_middleware (~> 0.8) + faraday_middleware (~> 0.9) hashie (~> 1.2) multi_json (~> 1.3) + netrc (~> 0.7.7) open4 (1.3.0) plist (3.1.0) - rack (1.4.1) - rack-protection (1.2.0) + rack (1.4.3) + rack-protection (1.3.2) rack - rake (0.9.5) + rake (0.9.6) rest-client (1.6.7) mime-types (>= 1.16) thin (1.5.0) @@ -87,6 +89,8 @@ GEM rack (>= 1.0.0) tilt (1.3.3) xcodeproj (0.4.0) + activesupport (~> 3.2.6) + colored (~> 1.2) PLATFORMS ruby diff --git a/Rakefile b/Rakefile index 28956fc5..154d30ff 100644 --- a/Rakefile +++ b/Rakefile @@ -2,7 +2,7 @@ require 'rubygems' require 'bundler/setup' require 'xcoder' require 'restkit/rake' -require 'ruby-debug' +require 'debugger' RestKit::Rake::ServerTask.new do |t| t.port = 4567 @@ -23,9 +23,9 @@ namespace :test do namespace :logic do desc "Run the logic tests for iOS" task :ios => :kill_simulator do - config = Xcode.project(:RestKit).target(:RestKitTests).config(:Debug) + config = Xcode.workspace(:RestKit).scheme(:RestKitTests) builder = config.builder - build_dir = File.dirname(config.target.project.path) + '/Build' + build_dir = File.dirname(config.parent.workspace_root) + '/Build' builder.symroot = build_dir + '/Products' builder.objroot = build_dir builder.test(:sdk => 'iphonesimulator') @@ -33,9 +33,9 @@ namespace :test do desc "Run the logic tests for OS X" task :osx do - config = Xcode.project(:RestKit).target(:RestKitFrameworkTests).config(:Debug) + config = Xcode.workspace(:RestKit).scheme(:RestKitFrameworkTests) builder = config.builder - build_dir = File.dirname(config.target.project.path) + '/Build' + build_dir = File.dirname(config.parent.workspace_root) + '/Build' builder.symroot = build_dir + '/Products' builder.objroot = build_dir builder.test(:sdk => 'macosx') @@ -45,31 +45,12 @@ namespace :test do desc "Run the unit tests for iOS and OS X" task :logic => ['logic:ios', 'logic:osx'] - namespace :application do - desc "Run the application tests for iOS" - task :ios => :kill_simulator do - config = Xcode.project(:RKApplicationTests).target('Application Tests').config(:Debug) - builder = config.builder - build_dir = File.dirname(config.target.project.path) + '/Build' - builder.symroot = build_dir + '/Products' - builder.objroot = build_dir - builder.test(:sdk => 'iphonesimulator') - end - end - - desc "Run the application tests for iOS" - task :application => 'application:ios' - desc "Run all tests for iOS and OS X" task :all do Rake.application.invoke_task("test:logic") unit_status = $?.exitstatus - puts "\033[0;33m!! Warning: RestKit application tests are disabled!!" - # Rake.application.invoke_task("test:application") - integration_status = $?.exitstatus puts "\033[0;31m!! Unit Tests failed with exit status of #{unit_status}" if unit_status != 0 - puts "\033[0;31m!! Integration Tests failed with exit status of #{integration_status}" if integration_status != 0 - puts "\033[0;32m** All Tests executed successfully" if unit_status == 0 && integration_status == 0 + puts "\033[0;32m** All Tests executed successfully" if unit_status == 0 #&& integration_status == 0 end end @@ -100,10 +81,9 @@ end desc "Build RestKit for iOS and Mac OS X" task :build do - run("xcodebuild -workspace RestKit.xcodeproj/project.xcworkspace -scheme RestKit -sdk iphonesimulator5.0 clean build") - run("xcodebuild -workspace RestKit.xcodeproj/project.xcworkspace -scheme RestKit -sdk iphoneos clean build") - run("xcodebuild -workspace RestKit.xcodeproj/project.xcworkspace -scheme RestKit -sdk macosx10.6 clean build") - run("xcodebuild -workspace Examples/RKCatalog/RKCatalog.xcodeproj/project.xcworkspace -scheme RKCatalog -sdk iphoneos clean build") + run("xcodebuild -workspace RestKit.xcworkspace -scheme RestKit -sdk iphonesimulator5.0 clean build") + run("xcodebuild -workspace RestKit.xcworkspace -scheme RestKit -sdk iphoneos clean build") + run("xcodebuild -workspace RestKit.xcworkspace -scheme RestKit -sdk macosx10.6 clean build") end desc "Generate documentation via appledoc" @@ -175,7 +155,7 @@ end namespace :build do desc "Build all Example projects to ensure they are building properly" task :examples do - ios_sdks = %w{iphoneos iphonesimulator5.0} + ios_sdks = %w{iphoneos iphonesimulator5.0 iphonesimulator6.0} osx_sdks = %w{macosx} osx_projects = %w{RKMacOSX} @@ -199,25 +179,3 @@ desc "Validate a branch is ready for merging by checking for common issues" task :validate => [:build, 'docs:check', 'uispec:all'] do puts "Project state validated successfully. Proceed with merge." end - -namespace :payload do - task :generate do - require 'json' - require 'faker' - - ids = (1..25).to_a - child_ids = (50..100).to_a - child_counts = (10..25).to_a - hash = ids.inject({'parents' => []}) do |hash, parent_id| - child_count = child_counts.sample - children = (0..child_count).collect do - {'name' => Faker::Name.name, 'childID' => child_ids.sample} - end - parent = {'parentID' => parent_id, 'name' => Faker::Name.name, 'children' => children} - hash['parents'] << parent - hash - end - File.open('payload.json', 'w+') { |f| f << hash.to_json } - puts "Generated payload at: payload.json" - end -end diff --git a/RestKit.xcworkspace/xcshareddata/xcschemes/RestKitFrameworkTests.xcscheme b/RestKit.xcworkspace/xcshareddata/xcschemes/RestKitFrameworkTests.xcscheme new file mode 100644 index 00000000..8321ee23 --- /dev/null +++ b/RestKit.xcworkspace/xcshareddata/xcschemes/RestKitFrameworkTests.xcscheme @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RestKit.xcworkspace/xcshareddata/xcschemes/RestKitTests.xcscheme b/RestKit.xcworkspace/xcshareddata/xcschemes/RestKitTests.xcscheme new file mode 100644 index 00000000..4865b93c --- /dev/null +++ b/RestKit.xcworkspace/xcshareddata/xcschemes/RestKitTests.xcscheme @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +