Commit 33c5269e authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'integration_take_2' into 0.17

* integration_take_2:
  [Integration] Isolate from spec helper and clean up Rakefile
  [Integration] Update install_subspecs
  [Examples] Updates lockfiles.

Conflicts:
	examples/AFNetworking Mac Example/Podfile.lock
	examples/AFNetworking iOS Example/Podfile.lock
	examples/TargetTest/Podfile.lock
	spec/integration/install_subspecs/after/Podfile.lock
parents 36006365 b40574f2
...@@ -7,7 +7,10 @@ def execute_command(command) ...@@ -7,7 +7,10 @@ def execute_command(command)
end end
end end
#-----------------------------------------------------------------------------#
namespace :gem do namespace :gem do
def gem_version def gem_version
require File.expand_path('../lib/cocoapods', __FILE__) require File.expand_path('../lib/cocoapods', __FILE__)
Pod::VERSION Pod::VERSION
...@@ -17,16 +20,22 @@ namespace :gem do ...@@ -17,16 +20,22 @@ namespace :gem do
"cocoapods-#{gem_version}.gem" "cocoapods-#{gem_version}.gem"
end end
#--------------------------------------#
desc "Build a gem for the current version" desc "Build a gem for the current version"
task :build do task :build do
sh "gem build cocoapods.gemspec" sh "gem build cocoapods.gemspec"
end end
#--------------------------------------#
desc "Install a gem version of the current code" desc "Install a gem version of the current code"
task :install => :build do task :install => :build do
sh "gem install #{gem_filename}" sh "gem install #{gem_filename}"
end end
#--------------------------------------#
def silent_sh(command) def silent_sh(command)
output = `#{command} 2>&1` output = `#{command} 2>&1`
unless $?.success? unless $?.success?
...@@ -139,41 +148,91 @@ namespace :gem do ...@@ -139,41 +148,91 @@ namespace :gem do
end end
end end
#-----------------------------------------------------------------------------#
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
def title(title)
cyan_title = "\033[0;36m#{title}\033[0m"
puts
puts "-" * 80
puts "| #{cyan_title.ljust(87)} |"
puts "-" * 80
puts
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
#--------------------------------------#
desc "Run the unit specs" desc "Run the unit specs"
task :unit => :unpack_fixture_tarballs do task :unit => :unpack_fixture_tarballs do
sh "bundle exec bacon #{specs('unit/**')} -q" sh "bundle exec bacon #{specs('unit/**')} -q"
end end
#--------------------------------------#
desc "Run the functional specs" desc "Run the functional specs"
task :functional => :unpack_fixture_tarballs do task :functional => :unpack_fixture_tarballs do
sh "bundle exec bacon #{specs('functional/**')}" sh "bundle exec bacon #{specs('functional/**')}"
end end
#--------------------------------------#
desc "Run the integration spec" desc "Run the integration spec"
task :integration => :unpack_fixture_tarballs do task :integration => :unpack_fixture_tarballs do
sh "bundle exec bacon spec/integration_spec.rb" sh "bundle exec bacon spec/integration_spec.rb"
sh "bundle exec bacon spec/integration_2.rb"
end end
# Default task
#--------------------------------------#
#
# The specs helper interfere with the integration 2 specs and thus they need
# to be run separately.
#
task :all => :unpack_fixture_tarballs do task :all => :unpack_fixture_tarballs do
sh "bundle exec bacon #{specs('**')}" title 'Running the specs'
sh "bundle exec bacon #{specs('**')}"
title 'Running Integration 2 tests'
sh "bundle exec bacon spec/integration_2.rb"
title 'Running examples'
Rake::Task['examples:build'].invoke
end end
# Travis
#--------------------------------------#
#
# The integration 2 tests and the examples use the normal CocoaPods setup.
#
desc "Run all specs and build all examples" desc "Run all specs and build all examples"
task :ci => :all do task :ci => :unpack_fixture_tarballs do
sh "./bin/pod setup" # ensure the spec repo is up-to-date title 'Running the specs'
sh "bundle exec bacon #{specs('**')}"
title 'Ensuring specs repo is up to date'
sh "./bin/pod setup"
title 'Running Integration 2 tests'
sh "bundle exec bacon spec/integration_2.rb"
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']
...@@ -183,6 +242,8 @@ namespace :spec do ...@@ -183,6 +242,8 @@ namespace :spec do
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']
...@@ -194,11 +255,15 @@ namespace :spec do ...@@ -194,11 +255,15 @@ namespace :spec do
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 "Rebuild integration take 2 after folders" desc "Rebuild integration take 2 after folders"
task :rebuild_integration_after_folders do task :rebuild_integration_after_folders do
# TODO Run the tests manually before calling this for now # TODO Run the tests manually before calling this for now
...@@ -218,13 +283,17 @@ namespace :spec do ...@@ -218,13 +283,17 @@ namespace :spec do
FileList['spec/integration/*/after/{Podfile,**/*.xcodeproj}'].each do |to_delete| FileList['spec/integration/*/after/{Podfile,**/*.xcodeproj}'].each do |to_delete|
sh "rm -rf #{to_delete}" sh "rm -rf #{to_delete}"
end end
end end
#--------------------------------------#
task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, "ext:cleanbuild"] task :clean_env => [:clean_vcr, :unpack_fixture_tarballs, "ext:cleanbuild"]
end end
#-----------------------------------------------------------------------------#
namespace :examples do namespace :examples do
def examples def examples
require 'pathname' require 'pathname'
result = [] result = []
...@@ -239,7 +308,9 @@ namespace :examples do ...@@ -239,7 +308,9 @@ namespace :examples do
result result
end end
desc "Open all example workspaced 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|
Dir.chdir(example.to_s) do Dir.chdir(example.to_s) do
...@@ -251,6 +322,8 @@ namespace :examples do ...@@ -251,6 +322,8 @@ namespace :examples do
end end
end end
#--------------------------------------#
desc "Build all examples" desc "Build all examples"
task :build do task :build do
execute_command "rm -rf ~/Library/Developer/Shared/Documentation/DocSets/org.cocoapods.*" execute_command "rm -rf ~/Library/Developer/Shared/Documentation/DocSets/org.cocoapods.*"
...@@ -269,8 +342,13 @@ namespace :examples do ...@@ -269,8 +342,13 @@ namespace :examples do
end end
end end
end end
#--------------------------------------#
end end
#-----------------------------------------------------------------------------#
desc "Initializes your working copy to run the specs" desc "Initializes your working copy to run the specs"
task :bootstrap do task :bootstrap do
puts "Updating submodules" puts "Updating submodules"
...@@ -280,10 +358,12 @@ task :bootstrap do ...@@ -280,10 +358,12 @@ task :bootstrap do
execute_command "bundle install" execute_command "bundle install"
puts "Installing tools (Homebrew)" puts "Installing tools (Homebrew)"
execute_command "brew install appledoc" if `which appledoc`.strip.empty? execute_command "brew install appledoc" if `which appledoc`.strip.empty?
execute_command "brew install mercurial" if `which hg`.strip.empty? execute_command "brew install mercurial" if `which hg`.strip.empty?
end end
#-----------------------------------------------------------------------------#
desc "Run all specs" desc "Run all specs"
task :spec => 'spec:all' task :spec => 'spec:all'
......
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