Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' into develop

  • Loading branch information...
commit 3627938803532f91efbd173a5d02c5bbcb95b4b9 2 parents 7eded48 + fd5c704
Eloy Durán alloy authored

Showing 1 changed file with 57 additions and 20 deletions. Show diff stats Hide diff stats

  1. +57 20 Rakefile
77 Rakefile
@@ -63,39 +63,76 @@ namespace :gem do
63 63
64 64 desc "Install a gem version of the current code"
65 65 task :install => :build do
66   - sh "sudo gem install #{gem_filename}"
  66 + sh "gem install #{gem_filename}"
67 67 end
68 68
69   - desc "Run all specs, build and install gem, commit version change, tag version change, and push everything"
70   - task :release do
71   - if `git symbolic-ref HEAD 2>/dev/null`.strip.split('/').last != 'master'
72   - $stderr.puts "You need to be on the `master' branch in order to be able to do a release."
  69 + def silent_sh(command)
  70 + #output = `/bin/sh -c '#{command}' 2>&1`
  71 + output = `#{command} 2>&1`
  72 + unless $?.success?
  73 + puts output
73 74 exit 1
74 75 end
  76 + output
  77 + end
75 78
76   - if `git tag`.strip.split("\n").include?(gem_version)
77   - $stderr.puts "A tag for version `#{gem_version}' already exists. Change the version in lib/cocoapods.rb"
78   - exit 1
79   - end
  79 + desc "Run all specs, build and install gem, commit version change, tag version change, and push everything"
  80 + task :release do
  81 + unless ENV['SKIP_CHECKS']
  82 + if `git symbolic-ref HEAD 2>/dev/null`.strip.split('/').last != 'master'
  83 + $stderr.puts "[!] You need to be on the `master' branch in order to be able to do a release."
  84 + exit 1
  85 + end
  86 +
  87 + if `git tag`.strip.split("\n").include?(gem_version)
  88 + $stderr.puts "[!] A tag for version `#{gem_version}' already exists. Change the version in lib/cocoapods.rb"
  89 + exit 1
  90 + end
80 91
81   - puts "You are about to release `#{gem_version}', is that correct? [y/n]"
82   - exit if $stdin.gets.strip.downcase != 'y'
  92 + puts "You are about to release `#{gem_version}', is that correct? [y/n]"
  93 + exit if $stdin.gets.strip.downcase != 'y'
83 94
84   - diff_lines = `git diff --numstat`.strip.split("\n")
  95 + diff_lines = `git diff --numstat`.strip.split("\n")
85 96
86   - if diff_lines.size == 0 || !diff_lines.first.include?('lib/cocoapods.rb')
87   - $stderr.puts "Change the version number yourself in lib/cocoapods.rb"
88   - exit 1
  97 + if diff_lines.size == 0 || !diff_lines.first.include?('lib/cocoapods.rb')
  98 + $stderr.puts "[!] Change the version number yourself in lib/cocoapods.rb"
  99 + exit 1
  100 + end
  101 +
  102 + if diff_lines.size > 1 || !diff_lines.first.include?('lib/cocoapods.rb')
  103 + $stderr.puts "[!] Only change the version number in a release commit!"
  104 + exit 1
  105 + end
89 106 end
90 107
91   - if diff_lines.size > 1 || !diff_lines.first.include?('lib/cocoapods.rb')
92   - $stderr.puts "Only change the version number in a release commit!"
  108 + # First check if the required Xcodeproj gem has ben pushed
  109 + gem_spec = eval(File.read(File.expand_path('../cocoapods.gemspec', __FILE__)))
  110 + xcodeproj = gem_spec.dependencies.find { |d| d.name == 'xcodeproj' }
  111 + xcodeproj_version = xcodeproj.requirement.requirements.first.last.to_s
  112 +
  113 + puts "* Checking if xcodeproj #{xcodeproj_version} exists on the gem host"
  114 + unless silent_sh("gem search --remote xcodeproj --version #{xcodeproj_version}").include?(xcodeproj_version)
  115 + $stderr.puts "[!] The Xcodeproj version `#{xcodeproj_version}' required by " \
  116 + "this version of CocoaPods does not exist on the gem host. " \
  117 + "Either push that first, or fix the version requirement."
93 118 exit 1
94 119 end
95 120
96   - # First see if the specs pass and gem builds and installs
97   - Rake::Task['spec:all'].invoke
98   - Rake::Task['gem:install'].invoke
  121 + puts "* Running specs"
  122 + silent_sh('rake spec:all')
  123 +
  124 + tmp = File.expand_path('../tmp', __FILE__)
  125 + tmp_gems = File.join(tmp, 'gems')
  126 +
  127 + puts "* Testing gem installation (tmp/gems)"
  128 + silent_sh "rm -rf '#{tmp}'"
  129 + silent_sh "gem install --install-dir='#{tmp_gems}' #{gem_filename}"
  130 +
  131 + puts "* Building examples from gem (tmp/gems)"
  132 + ENV['GEM_HOME'] = ENV['GEM_PATH'] = tmp_gems
  133 + ENV['PATH'] = "#{tmp_gems}/bin:#{ENV['PATH']}"
  134 + ENV['FROM_GEM'] = '1'
  135 + silent_sh "rake examples:build"
99 136
100 137 # Then release
101 138 sh "git commit lib/cocoapods.rb -m 'Release #{gem_version}'"

0 comments on commit 3627938

Please sign in to comment.
Something went wrong with that request. Please try again.