Commit c5c0606d authored by Fabio Pelosin's avatar Fabio Pelosin

[Integration] Fix

parent 410b9417
...@@ -45,7 +45,7 @@ begin ...@@ -45,7 +45,7 @@ begin
# Post release # Post release
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
desc "Updates the last know version of CocoaPods in the specs repo" desc "Updates the last know version of CocoaPods in the specs repo"
task :post_release do task :post_release do
title "Updating last known version in Specs repo" title "Updating last known version in Specs repo"
...@@ -54,7 +54,7 @@ begin ...@@ -54,7 +54,7 @@ begin
puts Dir.pwd puts Dir.pwd
sh "git checkout #{specs_branch}" sh "git checkout #{specs_branch}"
sh "git pull" sh "git pull"
yaml_file = 'CocoaPods-version.yml' yaml_file = 'CocoaPods-version.yml'
unless File.exist?(yaml_file) unless File.exist?(yaml_file)
$stderr.puts red("[!] Unable to find #{yaml_file}!") $stderr.puts red("[!] Unable to find #{yaml_file}!")
...@@ -66,62 +66,62 @@ begin ...@@ -66,62 +66,62 @@ begin
File.open(yaml_file, "w") do |f| File.open(yaml_file, "w") do |f|
f.write(cocoapods_version.to_yaml) f.write(cocoapods_version.to_yaml)
end end
sh "git commit #{yaml_file} -m 'CocoaPods release #{gem_version}'" sh "git commit #{yaml_file} -m 'CocoaPods release #{gem_version}'"
sh "git push" sh "git push"
end end
end end
# Spec # Spec
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
namespace :spec do namespace :spec do
def specs(dir) def specs(dir)
FileList["spec/#{dir}_spec.rb"].shuffle.join(' ') FileList["spec/#{dir}_spec.rb"].shuffle.join(' ')
end end
#--------------------------------------# #--------------------------------------#
desc "Automatically run specs for updated files" desc "Automatically run specs for updated files"
task :kick do task :kick do
exec "bundle exec kicker -c" exec "bundle exec kicker -c"
end end
#--------------------------------------# #--------------------------------------#
unit_specs_command = "bundle exec bacon #{specs('unit/**/*')}" unit_specs_command = "bundle exec bacon #{specs('unit/**/*')}"
desc "Run the unit specs" desc "Run the unit specs"
task :unit => :unpack_fixture_tarballs do task :unit => :unpack_fixture_tarballs do
sh unit_specs_command sh unit_specs_command
end end
desc "Run the unit specs quietly (fail fast, display only one failure)" desc "Run the unit specs quietly (fail fast, display only one failure)"
task :unit_quiet => :unpack_fixture_tarballs do task :unit_quiet => :unpack_fixture_tarballs do
sh "#{unit_specs_command} -q" sh "#{unit_specs_command} -q"
end end
#--------------------------------------# #--------------------------------------#
desc "Run the functional specs" desc "Run the functional specs"
task :functional, [:spec] => :unpack_fixture_tarballs do |t, args| task :functional, [:spec] => :unpack_fixture_tarballs do |t, args|
args.with_defaults(:spec => '**/*') args.with_defaults(:spec => '**/*')
sh "bundle exec bacon #{specs("functional/#{args[:spec]}")}" sh "bundle exec bacon #{specs("functional/#{args[:spec]}")}"
end end
#--------------------------------------# #--------------------------------------#
desc "Run the integration spec" desc "Run the integration spec"
task :integration do task :integration do
unless File.exists?('spec/cocoapods-integration-specs') unless File.exists?('spec/cocoapods-integration-specs')
$stderr.puts red("Integration files not checked out. Run `rake bootstrap`") $stderr.puts red("Integration files not checked out. Run `rake bootstrap`")
exit 1 exit 1
end end
sh "bundle exec bacon spec/integration.rb" sh "bundle exec bacon spec/integration.rb"
end end
# Default task # Default task
#--------------------------------------# #--------------------------------------#
# #
...@@ -131,17 +131,17 @@ begin ...@@ -131,17 +131,17 @@ begin
task :all => :unpack_fixture_tarballs do task :all => :unpack_fixture_tarballs do
ENV['GENERATE_COVERAGE'] = 'true' ENV['GENERATE_COVERAGE'] = 'true'
puts "\033[0;32mUsing #{`ruby --version`}\033[0m" puts "\033[0;32mUsing #{`ruby --version`}\033[0m"
title 'Running the specs' title 'Running the specs'
sh "bundle exec bacon #{specs('**/*')}" sh "bundle exec bacon #{specs('**/*')}"
title 'Running Integration tests' title 'Running Integration tests'
sh "bundle exec bacon spec/integration.rb" sh "bundle exec bacon spec/integration.rb"
title 'Running examples' title 'Running examples'
Rake::Task['examples:build'].invoke Rake::Task['examples:build'].invoke
end end
desc "Rebuild all the fixture tarballs" desc "Rebuild all the fixture tarballs"
task :rebuild_fixture_tarballs do task :rebuild_fixture_tarballs do
tarballs = FileList['spec/fixtures/**/*.tar.gz'] tarballs = FileList['spec/fixtures/**/*.tar.gz']
...@@ -150,7 +150,7 @@ begin ...@@ -150,7 +150,7 @@ begin
sh "cd #{File.dirname(tarball)} && rm #{basename} && env COPYFILE_DISABLE=1 tar -zcf #{basename} #{basename[0..-8]}" sh "cd #{File.dirname(tarball)} && rm #{basename} && env COPYFILE_DISABLE=1 tar -zcf #{basename} #{basename[0..-8]}"
end end
end end
desc "Unpacks all the fixture tarballs" desc "Unpacks all the fixture tarballs"
task :unpack_fixture_tarballs do task :unpack_fixture_tarballs do
tarballs = FileList['spec/fixtures/**/*.tar.gz'] tarballs = FileList['spec/fixtures/**/*.tar.gz']
...@@ -161,18 +161,18 @@ begin ...@@ -161,18 +161,18 @@ begin
end end
end end
end end
desc "Removes the stored VCR fixture" desc "Removes the stored VCR fixture"
task :clean_vcr do task :clean_vcr do
sh "rm -f spec/fixtures/vcr/tarballs.yml" sh "rm -f spec/fixtures/vcr/tarballs.yml"
end end
desc "Rebuilds integration fixtures" desc "Rebuilds integration fixtures"
task :rebuild_integration_fixtures do task :rebuild_integration_fixtures do
title 'Running Integration tests' title 'Running Integration tests'
sh 'rm -rf spec/cocoapods-integration-specs/tmp' sh 'rm -rf spec/cocoapods-integration-specs/tmp'
Rake::Task['spec:integration'].invoke puts `bundle exec bacon spec/integration.rb`
title 'Storing fixtures' title 'Storing fixtures'
# Copy the files to the files produced by the specs to the after folders # Copy the files to the files produced by the specs to the after folders
FileList['tmp/*'].each do |source| FileList['tmp/*'].each do |source|
...@@ -182,7 +182,7 @@ begin ...@@ -182,7 +182,7 @@ begin
sh "mv #{source} #{destination}" sh "mv #{source} #{destination}"
end end
end end
# Remove files not used for the comparison # Remove files not used for the comparison
# To keep the git diff clean # To keep the git diff clean
files_to_delete = FileList['spec/cocoapods-integration-specs/*/after/{Podfile,*.podspec,**/*.xcodeproj,PodTest-hg-source}'] files_to_delete = FileList['spec/cocoapods-integration-specs/*/after/{Podfile,*.podspec,**/*.xcodeproj,PodTest-hg-source}']
...@@ -190,20 +190,20 @@ begin ...@@ -190,20 +190,20 @@ begin
files_to_delete.each do |file_to_delete| files_to_delete.each do |file_to_delete|
sh "rm -rf #{file_to_delete}" sh "rm -rf #{file_to_delete}"
end end
puts puts
puts "Integration fixtures updated, commit and push in the `spec/cocoapods-integration-specs` submodule" puts "Integration fixtures updated, commit and push in the `spec/cocoapods-integration-specs` submodule"
end end
task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, "ext:cleanbuild"] task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, "ext:cleanbuild"]
end end
# Examples # Examples
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
task :examples => "examples:build" task :examples => "examples:build"
namespace :examples do namespace :examples do
desc "Open all example workspaces in Xcode, which recreates the schemes." desc "Open all example workspaces in Xcode, which recreates the schemes."
task :recreate_workspace_schemes do task :recreate_workspace_schemes do
examples.each do |example| examples.each do |example|
...@@ -215,7 +215,7 @@ begin ...@@ -215,7 +215,7 @@ begin
end end
end end
end end
desc "Build all examples" desc "Build all examples"
task :build do task :build do
Dir.chdir("examples/AFNetworking Example") do Dir.chdir("examples/AFNetworking Example") do
...@@ -223,13 +223,13 @@ begin ...@@ -223,13 +223,13 @@ begin
# pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod' # pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod'
# TODO: The sandbox is blocking local git repos making bundler crash # TODO: The sandbox is blocking local git repos making bundler crash
pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/pod' pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/pod'
execute_command "rm -rf Pods" execute_command "rm -rf Pods"
execute_command "#{pod_command} install --verbose --no-repo-update" execute_command "#{pod_command} install --verbose --no-repo-update"
puts "Building example: AFNetworking Mac Example'" puts "Building example: AFNetworking Mac Example'"
execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking Example' clean install" execute_command "xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking Example' clean install"
puts "Building example: AFNetworking iOS Example'" puts "Building example: AFNetworking iOS Example'"
xcode_version = `xcodebuild -version`.scan(/Xcode (.*)\n/).first.first xcode_version = `xcodebuild -version`.scan(/Xcode (.*)\n/).first.first
major_version = xcode_version.split('.').first.to_i major_version = xcode_version.split('.').first.to_i
...@@ -243,12 +243,12 @@ begin ...@@ -243,12 +243,12 @@ begin
end end
end end
end end
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
desc "Run all specs" desc "Run all specs"
task :spec => 'spec:all' task :spec => 'spec:all'
task :default => :spec task :default => :spec
rescue LoadError rescue LoadError
......
Subproject commit 0bf04d4f4cc3f544f13e27a85227e0a75862a871 Subproject commit 4222deee201cb3e4ecdc80e3408474bb36843034
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment