method
copy_to
v2_6_3 -
Show latest stable
-
0 notes -
Class: GitProxy
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3 (0)
- What's this?
copy_to(destination, submodules = false)
public
Hide source
# File lib/bundler/source/git/git_proxy.rb, line 112 def copy_to(destination, submodules = false) # method 1 unless File.exist?(destination.join(".git")) begin SharedHelpers.filesystem_access(destination.dirname) do |p| FileUtils.mkdir_p(p) end SharedHelpers.filesystem_access(destination) do |p| FileUtils.rm_rf(p) end git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}") File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination) rescue Errno::EEXIST => e file_path = e.message[%{.*?(/.*)}, 1] raise GitError, "Bundler could not install a gem because it needs to " "create a directory, but a file exists - #{file_path}. Please delete " "this file and try again." end end # method 2 SharedHelpers.chdir(destination) do git_retry %(fetch --force --quiet --tags "#{path}") begin git "reset --hard #{@revision}" rescue GitCommandError raise MissingGitRevisionError.new(@revision, URICredentialsFilter.credential_filtered_uri(uri)) end if submodules git_retry "submodule update --init --recursive" elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0") git_retry "submodule deinit --all --force" end end end