Commit 9616bc24 authored by Fabio Pelosin's avatar Fabio Pelosin

Merge branch 'master' into b0.15.0

* master:
  [Executable] Added environment variable to force STDOUT sync.
  [Command] Don't run setup if needed for `pod setup`.
  Specs for updating a cached repo if the specified branch is missing.
  Update a pod's cached git repo if the specified branch isn't found.

Conflicts:
	lib/cocoapods/downloader/git.rb
parents a8ee5c10 818f3901
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.14.0...master) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.14.0...master)
###### Bug fixes
- In certain conditions pod setup would execute twice.
- The git cache now is updated if a branch is not found
[#514](https://github.com/CocoaPods/CocoaPods/issues/514)
## 0.14.0 ## 0.14.0
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.14.0.rc2...0.14.0)[Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.3.2...0.3.3) [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.14.0.rc2...0.14.0)[Xcodeproj](https://github.com/CocoaPods/Xcodeproj/compare/0.3.2...0.3.3)
......
...@@ -7,6 +7,10 @@ if $0 == __FILE__ ...@@ -7,6 +7,10 @@ if $0 == __FILE__
$:.unshift File.expand_path('../../lib', __FILE__) $:.unshift File.expand_path('../../lib', __FILE__)
end end
if (ENV['CP_STDOUT_SYNC'] == 'TRUE')
STDOUT.sync = true
end
require 'cocoapods' require 'cocoapods'
Pod::Command.run(*ARGV) Pod::Command.run(*ARGV)
...@@ -70,7 +70,7 @@ module Pod ...@@ -70,7 +70,7 @@ module Pod
def self.run(*argv) def self.run(*argv)
sub_command = parse(*argv) sub_command = parse(*argv)
unless ENV['SKIP_SETUP'] unless sub_command.is_a?(Setup) || ENV['SKIP_SETUP']
Setup.new(ARGV.new).run_if_needed Setup.new(ARGV.new).run_if_needed
end end
sub_command.run sub_command.run
......
...@@ -100,10 +100,15 @@ module Pod ...@@ -100,10 +100,15 @@ module Pod
raise Informative, "[!] Cache unable to find git reference `#{ref}' for `#{url}'.".red unless ref_exists?(ref) raise Informative, "[!] Cache unable to find git reference `#{ref}' for `#{url}'.".red unless ref_exists?(ref)
end end
def ensure_remote_branch_exists(branch) def branch_exists?(branch)
Dir.chdir(cache_path) { git "branch -r | grep #{branch}$" } # check for remote branch and do suffix matching ($ anchor) Dir.chdir(cache_path) { git "branch -r | grep #{branch}$" } # check for remote branch and do suffix matching ($ anchor)
return if $? == 0 $? == 0
raise Informative, "[!] Cache unable to find git reference `#{branch}' for `#{url}' (#{$?}).".red end
def ensure_remote_branch_exists(branch)
return if branch_exists?(branch)
update_cache
raise Informative, "[!] Cache unable to find git reference `#{branch}' for `#{url}' (#{$?}).".red unless branch_exists?(branch)
end end
def download_head def download_head
......
...@@ -197,6 +197,47 @@ module Pod ...@@ -197,6 +197,47 @@ module Pod
downloader.expects(:update_cache).never downloader.expects(:update_cache).never
downloader.download downloader.download
end end
it "updates the cache if the branch is not available" do
# create the origin repo and the cache
tmp_repo_path = temporary_directory + 'banana-lib-source'
`git clone #{fixture('banana-lib')} #{tmp_repo_path}`
@pod.top_specification.stubs(:source).returns(
:git => tmp_repo_path, :branch => 'master'
)
downloader = Downloader.for_pod(@pod)
downloader.download
# make a new branch in the origin
branch = 'test'
Dir.chdir(tmp_repo_path) do
`touch test.txt`
`git checkout -b #{branch} >/dev/null 2>&1`
`git add test.txt`
`git commit -m 'test'`
end
# require the new branch
pod = LocalPod.new(fixture_spec('banana-lib/BananaLib.podspec'), temporary_sandbox, Platform.ios)
pod.top_specification.stubs(:source).returns(
:git => tmp_repo_path, :branch => branch
)
downloader = Downloader.for_pod(pod)
downloader.download
(pod.root + 'test.txt').should.exist?
end
it "doesn't update the cache if the branch is available" do
@pod.top_specification.stubs(:source).returns(
:git => fixture('banana-lib'), :branch => 'master'
)
downloader = Downloader.for_pod(@pod)
downloader.download
@pod.root.rmtree
downloader.expects(:update_cache).never
downloader.download
end
end end
......
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