Commit 63a39cff authored by Ben Asher's avatar Ben Asher

Removed Dir.chdir's from the push command

parent 03d8362e
...@@ -96,7 +96,7 @@ module Pod ...@@ -96,7 +96,7 @@ module Pod
# specs to the master repo. # specs to the master repo.
# #
def check_if_master_repo def check_if_master_repo
remotes = Dir.chdir(repo_dir) { `git remote -v 2>&1` } remotes = `git -C #{repo_dir} remote -v 2>&1`
master_repo_urls = [ master_repo_urls = [
'git@github.com:CocoaPods/Specs.git', 'git@github.com:CocoaPods/Specs.git',
'https://github.com/CocoaPods/Specs.git', 'https://github.com/CocoaPods/Specs.git',
...@@ -145,7 +145,7 @@ module Pod ...@@ -145,7 +145,7 @@ module Pod
# @return [void] # @return [void]
# #
def check_repo_status def check_repo_status
clean = Dir.chdir(repo_dir) { `git status --porcelain 2>&1` } == '' clean = `git -C #{repo_dir} status --porcelain 2>&1` == ''
raise Informative, "The repo `#{@repo}` at #{UI.path repo_dir} is not clean" unless clean raise Informative, "The repo `#{@repo}` at #{UI.path repo_dir} is not clean" unless clean
end end
...@@ -155,7 +155,7 @@ module Pod ...@@ -155,7 +155,7 @@ module Pod
# #
def update_repo def update_repo
UI.puts "Updating the `#{@repo}' repo\n".yellow UI.puts "Updating the `#{@repo}' repo\n".yellow
Dir.chdir(repo_dir) { UI.puts `git pull 2>&1` } UI.puts `git -C #{repo_dir} pull 2>&1`
end end
# Commits the podspecs to the source, which should be a git repo. # Commits the podspecs to the source, which should be a git repo.
...@@ -189,18 +189,16 @@ module Pod ...@@ -189,18 +189,16 @@ module Pod
FileUtils.cp(spec_file, output_path) FileUtils.cp(spec_file, output_path)
end end
Dir.chdir(repo_dir) do
# only commit if modified # only commit if modified
if git!('status', '--porcelain').include?(spec.name) if repo_git('status', '--porcelain').include?(spec.name)
UI.puts " - #{message}" UI.puts " - #{message}"
git!('add', spec.name) repo_git('add', spec.name)
git!('commit', '--no-verify', '-m', message) repo_git('commit', '--no-verify', '-m', message)
else else
UI.puts " - [No change] #{spec}" UI.puts " - [No change] #{spec}"
end end
end end
end end
end
# Pushes the git repo against the remote. # Pushes the git repo against the remote.
# #
...@@ -208,7 +206,7 @@ module Pod ...@@ -208,7 +206,7 @@ module Pod
# #
def push_repo def push_repo
UI.puts "\nPushing the `#{@repo}' repo\n".yellow UI.puts "\nPushing the `#{@repo}' repo\n".yellow
Dir.chdir(repo_dir) { UI.puts `git push origin master 2>&1` } UI.puts `git -C #{repo_dir} push origin master 2>&1`
end end
#---------------------------------------------------------------------# #---------------------------------------------------------------------#
...@@ -217,6 +215,12 @@ module Pod ...@@ -217,6 +215,12 @@ module Pod
# @!group Private helpers # @!group Private helpers
# @return result of calling the git! with args in repo_dir
#
def repo_git(*args)
git!(["-C", repo_dir] + args)
end
# @return [Pathname] The directory of the repository. # @return [Pathname] The directory of the repository.
# #
def repo_dir def repo_dir
......
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