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
a34be322
Commit
a34be322
authored
Mar 29, 2014
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Rakefile] Adopt Rainforest & streamline
parent
502f6b35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
162 deletions
+39
-162
Rakefile
Rakefile
+39
-162
No files found.
Rakefile
View file @
a34be322
def
execute_command
(
command
)
task
:build
do
if
ENV
[
'VERBOSE'
]
title
"Building the gem"
sh
(
command
)
else
output
=
`
#{
command
}
2>&1`
raise
output
unless
$?
.
success?
end
end
end
require
"bundler/gem_tasks"
# Bootstrap task
# Bootstrap task
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
...
@@ -34,151 +31,36 @@ task :bootstrap, :use_bundle_dir? do |t, args|
...
@@ -34,151 +31,36 @@ task :bootstrap, :use_bundle_dir? do |t, args|
end
end
end
end
# Post release
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
namespace
:gem
do
desc
"Updates the last know version of CocoaPods in the specs repo"
task
:post_release
do
def
gem_version
title
"Updating last known version in Specs repo"
require
File
.
expand_path
(
'../lib/cocoapods/gem_version.rb'
,
__FILE__
)
specs_branch
=
'master'
Pod
::
VERSION
Dir
.
chdir
(
'../Specs'
)
do
end
puts
Dir
.
pwd
sh
"git checkout
#{
specs_branch
}
"
def
gem_filename
sh
"git pull"
"cocoapods-
#{
gem_version
}
.gem"
end
#--------------------------------------#
desc
"Build a gem for the current version"
task
:build
do
sh
"gem build cocoapods.gemspec"
end
#--------------------------------------#
desc
"Install a gem version of the current code"
task
:install
=>
:build
do
sh
"gem install
#{
gem_filename
}
"
end
#--------------------------------------#
def
silent_sh
(
command
)
yaml_file
=
'CocoaPods-version.yml'
output
=
`
#{
command
}
2>&1`
unless
File
.
exist?
(
yaml_file
)
unless
$?
.
success?
$stderr
.
puts
"[!] Unable to find
#{
yaml_file
}
!"
puts
output
exit
1
exit
1
end
end
output
require
'yaml'
end
cocoapods_version
=
YAML
.
load_file
(
yaml_file
)
cocoapods_version
[
'last'
]
=
gem_version
desc
"Run all specs, build and install gem, commit version change, tag version change, and push everything"
File
.
open
(
yaml_file
,
"w"
)
do
|
f
|
task
:release
do
f
.
write
(
cocoapods_version
.
to_yaml
)
unless
ENV
[
'SKIP_CHECKS'
]
if
`git symbolic-ref HEAD 2>/dev/null`
.
strip
.
split
(
'/'
).
last
!=
'master'
$stderr
.
puts
"[!] You need to be on the `master' branch in order to be able to do a release."
exit
1
end
if
`git tag`
.
strip
.
split
(
"
\n
"
).
include?
(
gem_version
)
$stderr
.
puts
"[!] A tag for version `
#{
gem_version
}
' already exists. Change the version in lib/cocoapods/gem_version.rb"
silent_sh
"open lib/cocoapods/gem_version.rb"
exit
1
end
diff_lines
=
`git diff --name-only`
.
strip
.
split
(
"
\n
"
)
diff_lines
.
delete
(
'CHANGELOG.md'
)
diff_lines
.
delete
(
'Gemfile.lock'
)
if
diff_lines
.
size
==
0
$stderr
.
puts
"[!] Change the version number yourself in lib/cocoapods/gem_version.rb"
exit
1
end
if
diff_lines
!=
[
'lib/cocoapods/gem_version.rb'
]
$stderr
.
puts
"[!] Only change the version number in a release commit!"
exit
1
end
puts
"You are about to release `
#{
gem_version
}
', is that correct? [y/n]"
exit
if
$stdin
.
gets
.
strip
.
downcase
!=
'y'
end
require
'date'
# First check if the required gems have been pushed
gem_spec
=
eval
(
File
.
read
(
File
.
expand_path
(
'../cocoapods.gemspec'
,
__FILE__
)))
gem_names
=
[
'xcodeproj'
,
'cocoapods-core'
,
'cocoapods-downloader'
,
'claide'
]
gem_names
.
each
do
|
gem_name
|
gem
=
gem_spec
.
dependencies
.
find
{
|
d
|
d
.
name
==
gem_name
}
required_version
=
gem
.
requirement
.
requirements
.
first
.
last
.
to_s
puts
"* Checking if
#{
gem_name
}
#{
required_version
}
exists on the gem host"
search_result
=
silent_sh
(
"gem search --all --pre --remote
#{
gem_name
}
"
)
remote_versions
=
search_result
.
match
(
/
#{
gem_name
}
\((.*)\)/m
)[
1
].
split
(
', '
)
unless
remote_versions
.
include?
(
required_version
)
$stderr
.
puts
"[!] The
#{
gem_name
}
version `
#{
required_version
}
' required by "
\
"this version of CocoaPods does not exist on the gem host. "
\
"Either push that first, or fix the version requirement."
exit
1
end
end
# Ensure that the branches are up to date with the remote
sh
"git pull"
puts
"* Updating Bundle"
silent_sh
(
'bundle update'
)
unless
ENV
[
'SKIP_SPECS'
]
puts
"* Running specs"
silent_sh
(
'rake spec:all'
)
end
end
tmp
=
File
.
expand_path
(
'../tmp'
,
__FILE__
)
sh
"git commit
#{
yaml_file
}
-m 'CocoaPods release
#{
gem_version
}
'"
tmp_gems
=
File
.
join
(
tmp
,
'gems'
)
sh
"git push"
Rake
::
Task
[
'gem:build'
].
invoke
puts
"* Testing gem installation (tmp/gems)"
silent_sh
"rm -rf '
#{
tmp
}
'"
silent_sh
"gem install --install-dir='
#{
tmp_gems
}
'
#{
gem_filename
}
"
# Then release
sh
"git commit lib/cocoapods/gem_version.rb CHANGELOG.md Gemfile.lock -m 'Release
#{
gem_version
}
'"
sh
"git tag -a
#{
gem_version
}
-m 'Release
#{
gem_version
}
'"
sh
"git push origin master"
sh
"git push origin --tags"
sh
"gem push
#{
gem_filename
}
"
# Update the last version in CocoaPods-version.yml
puts
"* 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
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
end
end
end
# Spec
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
namespace
:spec
do
namespace
:spec
do
...
@@ -246,9 +128,6 @@ namespace :spec do
...
@@ -246,9 +128,6 @@ namespace :spec do
Rake
::
Task
[
'examples:build'
].
invoke
Rake
::
Task
[
'examples:build'
].
invoke
end
end
# Travis
#--------------------------------------#
#
# The integration 2 tests and the examples use the normal CocoaPods setup.
# 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"
...
@@ -269,8 +148,6 @@ namespace :spec do
...
@@ -269,8 +148,6 @@ namespace :spec do
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'
]
...
@@ -280,8 +157,6 @@ namespace :spec do
...
@@ -280,8 +157,6 @@ 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'
]
...
@@ -293,15 +168,11 @@ namespace :spec do
...
@@ -293,15 +168,11 @@ 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
"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'
...
@@ -329,11 +200,10 @@ namespace :spec do
...
@@ -329,11 +200,10 @@ namespace :spec do
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
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
task
:examples
=>
"examples:build"
task
:examples
=>
"examples:build"
...
@@ -351,8 +221,6 @@ namespace :examples do
...
@@ -351,8 +221,6 @@ namespace :examples do
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
...
@@ -377,12 +245,8 @@ namespace :examples do
...
@@ -377,12 +245,8 @@ namespace :examples do
sdk
=
Dir
.
glob
(
"
#{
`xcode-select -print-path`
.
chomp
}
/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator*.sdk"
).
last
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
}
"
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
end
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
...
@@ -392,9 +256,22 @@ task :spec => 'spec:all'
...
@@ -392,9 +256,22 @@ task :spec => 'spec:all'
task
:default
=>
:spec
task
:default
=>
:spec
# Helpers
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
# group helpers
def
execute_command
(
command
)
if
ENV
[
'VERBOSE'
]
sh
(
command
)
else
output
=
`
#{
command
}
2>&1`
raise
output
unless
$?
.
success?
end
end
def
gem_version
require
File
.
expand_path
(
'../lib/cocoapods/gem_version.rb'
,
__FILE__
)
Pod
::
VERSION
end
def
title
(
title
)
def
title
(
title
)
cyan_title
=
"
\033
[0;36m
#{
title
}
\033
[0m"
cyan_title
=
"
\033
[0;36m
#{
title
}
\033
[0m"
...
...
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