mirror of
https://github.com/zhigang1992/CocoaPods.git
synced 2026-04-29 01:45:36 +08:00
Add a rake task to open all example workspaces in Xcode. For some reason workspace schemes don’t seem to survive a SCM roundtrip.
This commit is contained in:
65
Rakefile
65
Rakefile
@@ -76,30 +76,55 @@ namespace :spec do
|
||||
end
|
||||
end
|
||||
|
||||
desc "Build all examples"
|
||||
task :build_examples do
|
||||
require 'pathname'
|
||||
examples = Pathname.new(File.expand_path('../examples', __FILE__))
|
||||
examples.entries.each do |example|
|
||||
next if %w{ . .. }.include?(example.basename.to_s)
|
||||
example = examples + example
|
||||
next unless example.directory?
|
||||
puts "Building example: #{example}"
|
||||
puts
|
||||
Dir.chdir(example.to_s) do
|
||||
sh "rm -rf Pods DerivedData"
|
||||
sh "#{'../../bin/' unless ENV['FROM_GEM']}pod install --verbose"
|
||||
command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
|
||||
if (example + 'Podfile').read.include?('platform :ios')
|
||||
# Specifically build against the simulator SDK so we don't have to deal with code signing.
|
||||
command << " -sdk /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk"
|
||||
end
|
||||
sh command
|
||||
namespace :examples do
|
||||
def examples
|
||||
require 'pathname'
|
||||
result = []
|
||||
examples = Pathname.new(File.expand_path('../examples', __FILE__))
|
||||
examples.entries.each do |example|
|
||||
next if %w{ . .. }.include?(example.basename.to_s)
|
||||
example = examples + example
|
||||
next unless example.directory?
|
||||
result << example
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
desc "Open all example workspaced in Xcode, which recreates the schemes."
|
||||
task :recreate_workspace_schemes do
|
||||
examples.each do |example|
|
||||
Dir.chdir(example.to_s) do
|
||||
# TODO we need to open the workspace in Xcode at least once, otherwise it might not contain schemes.
|
||||
# The schemes do not seem to survive a SCM round-trip.
|
||||
sh "open '#{example.basename}.xcworkspace'"
|
||||
sleep 5
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Build all examples"
|
||||
task :build do
|
||||
examples.entries.each do |example|
|
||||
puts "Building example: #{example}"
|
||||
puts
|
||||
Dir.chdir(example.to_s) do
|
||||
sh "rm -rf Pods DerivedData"
|
||||
sh "#{'../../bin/' unless ENV['FROM_GEM']}pod install --verbose"
|
||||
command = "xcodebuild -workspace '#{example.basename}.xcworkspace' -scheme '#{example.basename}'"
|
||||
if (example + 'Podfile').read.include?('platform :ios')
|
||||
# Specifically build against the simulator SDK so we don't have to deal with code signing.
|
||||
command << " -sdk /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk"
|
||||
end
|
||||
sh command
|
||||
end
|
||||
puts
|
||||
end
|
||||
puts
|
||||
end
|
||||
end
|
||||
|
||||
desc "Build all examples"
|
||||
task :build_examples => 'examples:build'
|
||||
|
||||
desc "Dumps a Xcode project as YAML, meant for diffing"
|
||||
task :dump_xcodeproj do
|
||||
require 'yaml'
|
||||
|
||||
@@ -373,7 +373,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Other Sources/SSCatalog_Prefix.pch";
|
||||
INFOPLIST_FILE = "Resources/SSCatalog-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
|
||||
PRODUCT_NAME = SSCatalog;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -388,7 +388,7 @@
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "Other Sources/SSCatalog_Prefix.pch";
|
||||
INFOPLIST_FILE = "Resources/SSCatalog-Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 3.1.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
|
||||
PRODUCT_NAME = SSCatalog;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
||||
Reference in New Issue
Block a user