Commit 0c85276d authored by Fabio Pelosin's avatar Fabio Pelosin

[Rakefile] Update gem:release

parent c1e0b839
...@@ -12,7 +12,7 @@ end ...@@ -12,7 +12,7 @@ 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/gem_version.rb', __FILE__)
Pod::VERSION Pod::VERSION
end end
...@@ -55,7 +55,7 @@ namespace :gem do ...@@ -55,7 +55,7 @@ namespace :gem do
end end
if `git tag`.strip.split("\n").include?(gem_version) 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.rb" $stderr.puts "[!] A tag for version `#{gem_version}' already exists. Change the version in lib/cocoapods/gem_version.rb"
exit 1 exit 1
end end
...@@ -65,13 +65,13 @@ namespace :gem do ...@@ -65,13 +65,13 @@ namespace :gem do
diff_lines = `git diff --name-only`.strip.split("\n") diff_lines = `git diff --name-only`.strip.split("\n")
if diff_lines.size == 0 if diff_lines.size == 0
$stderr.puts "[!] Change the version number yourself in lib/cocoapods.rb" $stderr.puts "[!] Change the version number yourself in lib/cocoapods/gem_version.rb"
exit 1 exit 1
end end
diff_lines.delete('Gemfile.lock') diff_lines.delete('Gemfile.lock')
diff_lines.delete('CHANGELOG.md') diff_lines.delete('CHANGELOG.md')
if diff_lines != ['lib/cocoapods.rb'] if diff_lines != ['lib/cocoapods/gem_version.rb']
$stderr.puts "[!] Only change the version number in a release commit!" $stderr.puts "[!] Only change the version number in a release commit!"
exit 1 exit 1
end end
...@@ -79,20 +79,23 @@ namespace :gem do ...@@ -79,20 +79,23 @@ namespace :gem do
require 'date' require 'date'
# First check if the required Xcodeproj gem has ben pushed # First check if the required Xcodeproj gem has been pushed
gem_spec = eval(File.read(File.expand_path('../cocoapods.gemspec', __FILE__))) gem_spec = eval(File.read(File.expand_path('../cocoapods.gemspec', __FILE__)))
xcodeproj = gem_spec.dependencies.find { |d| d.name == 'xcodeproj' } gem_names = ['xcodeproj', 'cocoapods-core', 'cocoapods-downloader']
required_xcodeproj_version = xcodeproj.requirement.requirements.first.last.to_s gem_names.each do |gem_name|
gem = gem_spec.dependencies.find { |d| d.name == gem_name }
puts "* Checking if xcodeproj #{required_xcodeproj_version} exists on the gem host" required_xcodeproj_version = gem.requirement.requirements.first.last.to_s
search_result = silent_sh("gem search --all --remote xcodeproj")
remote_xcodeproj_versions = search_result.match(/xcodeproj \((.*)\)/m)[1].split(', ') puts "* Checking if #{gem_name} #{required_xcodeproj_version} exists on the gem host"
search_result = silent_sh("gem search --all --remote #{gem_name}")
remote_xcodeproj_versions = search_result.match(/#{gem_name} \((.*)\)/m)[1].split(', ')
unless remote_xcodeproj_versions.include?(required_xcodeproj_version) unless remote_xcodeproj_versions.include?(required_xcodeproj_version)
$stderr.puts "[!] The Xcodeproj version `#{required_xcodeproj_version}' required by " \ $stderr.puts "[!] The #{gem_name} version `#{required_xcodeproj_version}' required by " \
"this version of CocoaPods does not exist on the gem host. " \ "this version of CocoaPods does not exist on the gem host. " \
"Either push that first, or fix the version requirement." "Either push that first, or fix the version requirement."
exit 1 exit 1
end end
end
# Ensure that the branches are up to date with the remote # Ensure that the branches are up to date with the remote
sh "git pull" sh "git pull"
...@@ -109,12 +112,6 @@ namespace :gem do ...@@ -109,12 +112,6 @@ namespace :gem do
silent_sh "rm -rf '#{tmp}'" silent_sh "rm -rf '#{tmp}'"
silent_sh "gem install --install-dir='#{tmp_gems}' #{gem_filename}" silent_sh "gem install --install-dir='#{tmp_gems}' #{gem_filename}"
# puts "* Building examples from gem (tmp/gems)"
# ENV['GEM_HOME'] = ENV['GEM_PATH'] = tmp_gems
# ENV['PATH'] = "#{tmp_gems}/bin:#{ENV['PATH']}"
# ENV['FROM_GEM'] = '1'
# silent_sh "rake examples:build"
# Then release # Then release
sh "git commit lib/cocoapods.rb Gemfile.lock CHANGELOG.md -m 'Release #{gem_version}'" sh "git commit lib/cocoapods.rb Gemfile.lock CHANGELOG.md -m 'Release #{gem_version}'"
sh "git tag -a #{gem_version} -m 'Release #{gem_version}'" sh "git tag -a #{gem_version} -m 'Release #{gem_version}'"
......
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