Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
f43e428e
Commit
f43e428e
authored
May 16, 2014
by
Olivier Halligon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing Rakefile's bootstrap
parent
54a496dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
215 additions
and
199 deletions
+215
-199
Rakefile
Rakefile
+215
-199
No files found.
Rakefile
View file @
f43e428e
task
:build
do
title
"Building the gem"
end
require
"bundler/gem_tasks"
# Bootstrap task
# Bootstrap task
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
...
@@ -25,222 +19,241 @@ task :bootstrap, :use_bundle_dir? do |t, args|
...
@@ -25,222 +19,241 @@ task :bootstrap, :use_bundle_dir? do |t, args|
ENV
[
'ARCHFLAGS'
]
=
'-Wno-error=unused-command-line-argument-hard-error-in-future'
ENV
[
'ARCHFLAGS'
]
=
'-Wno-error=unused-command-line-argument-hard-error-in-future'
end
end
puts
"Installing gems"
if
system
(
'which bundle'
)
if
args
[
:use_bundle_dir?
]
puts
"Installing gems"
execute_command
"env XCODEPROJ_BUILD=1 bundle install --path ./travis_bundle_dir"
if
args
[
:use_bundle_dir?
]
else
execute_command
"env XCODEPROJ_BUILD=1 bundle install --path ./travis_bundle_dir"
execute_command
"env XCODEPROJ_BUILD=1 bundle install"
else
end
execute_command
"env XCODEPROJ_BUILD=1 bundle install"
end
# Post release
#-----------------------------------------------------------------------------#
desc
"Updates the last know version of CocoaPods in the specs repo"
task
:post_release
do
title
"Updating last known version in Specs repo"
specs_branch
=
'master'
Dir
.
chdir
(
'../Specs'
)
do
puts
Dir
.
pwd
sh
"git checkout
#{
specs_branch
}
"
sh
"git pull"
yaml_file
=
'CocoaPods-version.yml'
unless
File
.
exist?
(
yaml_file
)
$stderr
.
puts
"[!] Unable to find
#{
yaml_file
}
!"
exit
1
end
end
require
'yaml'
else
cocoapods_version
=
YAML
.
load_file
(
yaml_file
)
$stderr
.
puts
red
(
"[!] Please install the bundler gem manually:
\n
"
\
cocoapods_version
[
'last'
]
=
gem_version
' $ [sudo] gem install bundler'
)
File
.
open
(
yaml_file
,
"w"
)
do
|
f
|
exit
1
f
.
write
(
cocoapods_version
.
to_yaml
)
end
sh
"git commit
#{
yaml_file
}
-m 'CocoaPods release
#{
gem_version
}
'"
sh
"git push"
end
end
end
end
# Spec
begin
#-----------------------------------------------------------------------------#
namespace
:spec
do
def
specs
(
dir
)
FileList
[
"spec/
#{
dir
}
_spec.rb"
].
shuffle
.
join
(
' '
)
end
#--------------------------------------#
desc
"Automatically run specs for updated files"
task
:kick
do
exec
"bundle exec kicker -c"
end
#--------------------------------------#
unit_specs_command
=
"bundle exec bacon
#{
specs
(
'unit/**/*'
)
}
"
desc
"Run the unit specs"
task
:unit
=>
:unpack_fixture_tarballs
do
sh
unit_specs_command
end
desc
"Run the unit specs quietly (fail fast, display only one failure)"
task
:build
do
task
:unit_quiet
=>
:unpack_fixture_tarballs
do
title
"Building the gem"
sh
"
#{
unit_specs_command
}
-q"
end
#--------------------------------------#
desc
"Run the functional specs"
task
:functional
,
[
:spec
]
=>
:unpack_fixture_tarballs
do
|
t
,
args
|
args
.
with_defaults
(
:spec
=>
'**/*'
)
sh
"bundle exec bacon
#{
specs
(
"functional/
#{
args
[
:spec
]
}
"
)
}
"
end
end
#--------------------------------------#
require
"bundler/gem_tasks"
desc
"Run the integration spec"
# Post release
task
:integration
do
#-----------------------------------------------------------------------------#
unless
File
.
exists?
(
'spec/cocoapods-integration-specs'
)
$stderr
.
puts
"Integration files not checked out. Run `rake bootstrap`"
desc
"Updates the last know version of CocoaPods in the specs repo"
exit
1
task
:post_release
do
title
"Updating last known version in Specs repo"
specs_branch
=
'master'
Dir
.
chdir
(
'../Specs'
)
do
puts
Dir
.
pwd
sh
"git checkout
#{
specs_branch
}
"
sh
"git pull"
yaml_file
=
'CocoaPods-version.yml'
unless
File
.
exist?
(
yaml_file
)
$stderr
.
puts
red
(
"[!] Unable to find
#{
yaml_file
}
!"
)
exit
1
end
require
'yaml'
cocoapods_version
=
YAML
.
load_file
(
yaml_file
)
cocoapods_version
[
'last'
]
=
gem_version
File
.
open
(
yaml_file
,
"w"
)
do
|
f
|
f
.
write
(
cocoapods_version
.
to_yaml
)
end
sh
"git commit
#{
yaml_file
}
-m 'CocoaPods release
#{
gem_version
}
'"
sh
"git push"
end
end
sh
"bundle exec bacon spec/integration.rb"
end
end
# Default task
# Spec
#--------------------------------------#
#-----------------------------------------------------------------------------#
#
# The specs helper interfere with the integration 2 specs and thus they need
namespace
:spec
do
# to be run separately.
#
def
specs
(
dir
)
task
:all
=>
:unpack_fixture_tarballs
do
FileList
[
"spec/
#{
dir
}
_spec.rb"
].
shuffle
.
join
(
' '
)
ENV
[
'GENERATE_COVERAGE'
]
=
'true'
puts
"
\033
[0;32mUsing
#{
`ruby --version`
}
\033
[0m"
title
'Running the specs'
sh
"bundle exec bacon
#{
specs
(
'**/*'
)
}
"
title
'Running Integration tests'
sh
"bundle exec bacon spec/integration.rb"
title
'Running examples'
Rake
::
Task
[
'examples:build'
].
invoke
end
desc
"Rebuild all the fixture tarballs"
task
:rebuild_fixture_tarballs
do
tarballs
=
FileList
[
'spec/fixtures/**/*.tar.gz'
]
tarballs
.
each
do
|
tarball
|
basename
=
File
.
basename
(
tarball
)
sh
"cd
#{
File
.
dirname
(
tarball
)
}
&& rm
#{
basename
}
&& env COPYFILE_DISABLE=1 tar -zcf
#{
basename
}
#{
basename
[
0
..-
8
]
}
"
end
end
end
#--------------------------------------#
desc
"Unpacks all the fixture tarballs"
task
:unpack_fixture_tarballs
do
desc
"Automatically run specs for updated files"
tarballs
=
FileList
[
'spec/fixtures/**/*.tar.gz'
]
task
:kick
do
tarballs
.
each
do
|
tarball
|
exec
"bundle exec kicker -c"
basename
=
File
.
basename
(
tarball
)
end
Dir
.
chdir
(
File
.
dirname
(
tarball
))
do
sh
"rm -rf
#{
basename
[
0
..-
8
]
}
&& tar zxf
#{
basename
}
"
#--------------------------------------#
unit_specs_command
=
"bundle exec bacon
#{
specs
(
'unit/**/*'
)
}
"
desc
"Run the unit specs"
task
:unit
=>
:unpack_fixture_tarballs
do
sh
unit_specs_command
end
desc
"Run the unit specs quietly (fail fast, display only one failure)"
task
:unit_quiet
=>
:unpack_fixture_tarballs
do
sh
"
#{
unit_specs_command
}
-q"
end
#--------------------------------------#
desc
"Run the functional specs"
task
:functional
,
[
:spec
]
=>
:unpack_fixture_tarballs
do
|
t
,
args
|
args
.
with_defaults
(
:spec
=>
'**/*'
)
sh
"bundle exec bacon
#{
specs
(
"functional/
#{
args
[
:spec
]
}
"
)
}
"
end
#--------------------------------------#
desc
"Run the integration spec"
task
:integration
do
unless
File
.
exists?
(
'spec/cocoapods-integration-specs'
)
$stderr
.
puts
red
(
"Integration files not checked out. Run `rake bootstrap`"
)
exit
1
end
end
sh
"bundle exec bacon spec/integration.rb"
end
end
end
# Default task
desc
"Removes the stored VCR fixture"
#--------------------------------------#
task
:clean_vcr
do
#
sh
"rm -f spec/fixtures/vcr/tarballs.yml"
# The specs helper interfere with the integration 2 specs and thus they need
end
# to be run separately.
#
desc
"Rebuilds integration fixtures"
task
:all
=>
:unpack_fixture_tarballs
do
task
:rebuild_integration_fixtures
do
ENV
[
'GENERATE_COVERAGE'
]
=
'true'
title
'Running Integration tests'
puts
"
\033
[0;32mUsing
#{
`ruby --version`
}
\033
[0m"
sh
'rm -rf spec/cocoapods-integration-specs/tmp'
Rake
::
Task
[
'spec:integration'
].
invoke
title
'Running the specs'
sh
"bundle exec bacon
#{
specs
(
'**/*'
)
}
"
title
'Storing fixtures'
# Copy the files to the files produced by the specs to the after folders
title
'Running Integration tests'
FileList
[
'tmp/*'
].
each
do
|
source
|
sh
"bundle exec bacon spec/integration.rb"
destination
=
"spec/cocoapods-integration-specs/
#{
source
.
gsub
(
'tmp/'
,
''
)
}
/after"
if
File
.
exists?
(
destination
)
title
'Running examples'
sh
"rm -rf
#{
destination
}
"
Rake
::
Task
[
'examples:build'
].
invoke
sh
"mv
#{
source
}
#{
destination
}
"
end
desc
"Rebuild all the fixture tarballs"
task
:rebuild_fixture_tarballs
do
tarballs
=
FileList
[
'spec/fixtures/**/*.tar.gz'
]
tarballs
.
each
do
|
tarball
|
basename
=
File
.
basename
(
tarball
)
sh
"cd
#{
File
.
dirname
(
tarball
)
}
&& rm
#{
basename
}
&& env COPYFILE_DISABLE=1 tar -zcf
#{
basename
}
#{
basename
[
0
..-
8
]
}
"
end
end
end
end
# Remove files not used for the comparison
desc
"Unpacks all the fixture tarballs"
# To keep the git diff clean
task
:unpack_fixture_tarballs
do
files_to_delete
=
FileList
[
'spec/cocoapods-integration-specs/*/after/{Podfile,*.podspec,**/*.xcodeproj,PodTest-hg-source}'
]
tarballs
=
FileList
[
'spec/fixtures/**/*.tar.gz'
]
files_to_delete
.
exclude
(
'/spec/cocoapods-integration-specs/init_single_platform/**/*.*'
)
tarballs
.
each
do
|
tarball
|
files_to_delete
.
each
do
|
file_to_delete
|
basename
=
File
.
basename
(
tarball
)
sh
"rm -rf
#{
file_to_delete
}
"
Dir
.
chdir
(
File
.
dirname
(
tarball
))
do
sh
"rm -rf
#{
basename
[
0
..-
8
]
}
&& tar zxf
#{
basename
}
"
end
end
end
end
puts
desc
"Removes the stored VCR fixture"
puts
"Integration fixtures updated, commit and push in the `spec/cocoapods-integration-specs` submodule"
task
:clean_vcr
do
end
sh
"rm -f spec/fixtures/vcr/tarballs.yml"
end
task
:clean_env
=>
[
:clean_vcr
,
:unpack_fixture_tarballs
,
"ext:cleanbuild"
]
end
desc
"Rebuilds integration fixtures"
task
:rebuild_integration_fixtures
do
# Examples
title
'Running Integration tests'
#-----------------------------------------------------------------------------#
sh
'rm -rf spec/cocoapods-integration-specs/tmp'
Rake
::
Task
[
'spec:integration'
].
invoke
task
:examples
=>
"examples:build"
namespace
:examples
do
title
'Storing fixtures'
# Copy the files to the files produced by the specs to the after folders
desc
"Open all example workspaces in Xcode, which recreates the schemes."
FileList
[
'tmp/*'
].
each
do
|
source
|
task
:recreate_workspace_schemes
do
destination
=
"spec/cocoapods-integration-specs/
#{
source
.
gsub
(
'tmp/'
,
''
)
}
/after"
examples
.
each
do
|
example
|
if
File
.
exists?
(
destination
)
Dir
.
chdir
(
example
.
to_s
)
do
sh
"rm -rf
#{
destination
}
"
# TODO we need to open the workspace in Xcode at least once, otherwise it might not contain schemes.
sh
"mv
#{
source
}
#{
destination
}
"
# The schemes do not seem to survive a SCM round-trip.
end
sh
"open '
#{
example
.
basename
}
.xcworkspace'"
end
sleep
5
# Remove files not used for the comparison
# To keep the git diff clean
files_to_delete
=
FileList
[
'spec/cocoapods-integration-specs/*/after/{Podfile,*.podspec,**/*.xcodeproj,PodTest-hg-source}'
]
files_to_delete
.
exclude
(
'/spec/cocoapods-integration-specs/init_single_platform/**/*.*'
)
files_to_delete
.
each
do
|
file_to_delete
|
sh
"rm -rf
#{
file_to_delete
}
"
end
end
puts
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"
]
end
end
desc
"Build all examples"
# Examples
task
:build
do
#-----------------------------------------------------------------------------#
Dir
.
chdir
(
"examples/AFNetworking Example"
)
do
puts
"Installing Pods"
task
:examples
=>
"examples:build"
# pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod'
namespace
:examples
do
# TODO: The sandbox is blocking local git repos making bundler crash
pod_command
=
ENV
[
'FROM_GEM'
]
?
'sandbox-pod'
:
'bundle exec ../../bin/pod'
desc
"Open all example workspaces in Xcode, which recreates the schemes."
task
:recreate_workspace_schemes
do
execute_command
"rm -rf Pods"
examples
.
each
do
|
example
|
execute_command
"
#{
pod_command
}
install --verbose --no-repo-update"
Dir
.
chdir
(
example
.
to_s
)
do
# TODO we need to open the workspace in Xcode at least once, otherwise it might not contain schemes.
puts
"Building example: AFNetworking Mac Example'"
# The schemes do not seem to survive a SCM round-trip.
execute_command
"xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking Example' clean install"
sh
"open '
#{
example
.
basename
}
.xcworkspace'"
sleep
5
puts
"Building example: AFNetworking iOS Example'"
end
xcode_version
=
`xcodebuild -version`
.
scan
(
/Xcode (.*)\n/
).
first
.
first
end
major_version
=
xcode_version
.
split
(
'.'
).
first
.
to_i
end
# Specifically build against the simulator SDK so we don't have to deal with code signing.
if
major_version
>
4
desc
"Build all examples"
execute_command
"xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean install ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch)'"
task
:build
do
else
Dir
.
chdir
(
"examples/AFNetworking Example"
)
do
sdk
=
Dir
.
glob
(
"
#{
`xcode-select -print-path`
.
chomp
}
/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk"
).
last
puts
"Installing Pods"
execute_command
"xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean install ONLY_ACTIVE_ARCH=NO -sdk
#{
sdk
}
"
# pod_command = ENV['FROM_GEM'] ? 'sandbox-pod' : 'bundle exec ../../bin/sandbox-pod'
# TODO: The sandbox is blocking local git repos making bundler crash
pod_command
=
ENV
[
'FROM_GEM'
]
?
'sandbox-pod'
:
'bundle exec ../../bin/pod'
execute_command
"rm -rf Pods"
execute_command
"
#{
pod_command
}
install --verbose --no-repo-update"
puts
"Building example: AFNetworking Mac Example'"
execute_command
"xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking Example' clean install"
puts
"Building example: AFNetworking iOS Example'"
xcode_version
=
`xcodebuild -version`
.
scan
(
/Xcode (.*)\n/
).
first
.
first
major_version
=
xcode_version
.
split
(
'.'
).
first
.
to_i
# Specifically build against the simulator SDK so we don't have to deal with code signing.
if
major_version
>
4
execute_command
"xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean install ONLY_ACTIVE_ARCH=NO -destination 'platform=iOS Simulator,name=iPhone Retina (4-inch)'"
else
sdk
=
Dir
.
glob
(
"
#{
`xcode-select -print-path`
.
chomp
}
/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk"
).
last
execute_command
"xcodebuild -workspace 'AFNetworking Examples.xcworkspace' -scheme 'AFNetworking iOS Example' clean install ONLY_ACTIVE_ARCH=NO -sdk
#{
sdk
}
"
end
end
end
end
end
end
end
#-----------------------------------------------------------------------------#
desc
"Run all specs"
task
:spec
=>
'spec:all'
task
:default
=>
:spec
rescue
LoadError
$stderr
.
puts
red
(
'[!] Some Rake tasks haven been disabled because the '
\
'environment couldn’t be loaded. Be sure to run `rake bootstrap` first.'
)
end
end
#-----------------------------------------------------------------------------#
desc
"Run all specs"
task
:spec
=>
'spec:all'
task
:default
=>
:spec
# Helpers
# Helpers
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
...
@@ -267,3 +280,6 @@ def title(title)
...
@@ -267,3 +280,6 @@ def title(title)
puts
puts
end
end
def
red
(
string
)
"
\033
[0;31m
#{
string
}
\e
[0m"
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment