Skip to content

Commit

Permalink
[Lib] Fix $CHILD_STATUS on Ruby 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed Aug 14, 2014
1 parent 298936d commit 012d854
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
[Fabio Pelosin](https://github.com/irrationalfab)
[#12](https://github.com/CocoaPods/cocoapods-downloader/issues/28)

###### Bug Fixes

* Fixed the check for git references on Ruby 1.8.7.
[Fabio Pelosin](https://github.com/irrationalfab)
[#28](https://github.com/CocoaPods/cocoapods-downloader/issues/28)


## 0.6.1

Expand Down
4 changes: 3 additions & 1 deletion lib/cocoapods-downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module Downloader
if RUBY_VERSION >= '1.9.3'
require 'English'
else
alias $CHILD_STATUS $CHILD_STATUS
# rubocop:disable Style/SpecialGlobalVars
alias $CHILD_STATUS $?
# rubocop:enable Style/SpecialGlobalVars
end

require 'cocoapods-downloader/gem_version'
Expand Down
4 changes: 2 additions & 2 deletions lib/cocoapods-downloader/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def shallow_flags
def ref_exists?(ref)
if cache_exists?
Dir.chdir(cache_path) { git "rev-list --max-count=1 #{ref}" }
$CHILD_STATUS == 0
$CHILD_STATUS.to_i == 0
else
false
end
Expand All @@ -160,7 +160,7 @@ def ensure_ref_exists(ref)
#
def branch_exists?(branch)
Dir.chdir(cache_path) { git "branch --all | grep #{branch}$" } # check for remote branch and do suffix matching ($ anchor)
$CHILD_STATUS == 0
$CHILD_STATUS.to_i == 0
end

# @return [void] Checks if a branch exists in the cache and updates
Expand Down

0 comments on commit 012d854

Please sign in to comment.