Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Revert "Don't try to create dirs if they already exists"
Browse files Browse the repository at this point in the history
This reverts commit 8286722.
  • Loading branch information
spastorino committed Aug 13, 2010
1 parent 5895208 commit 0891a38
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/bundler.rb
Expand Up @@ -82,7 +82,7 @@ def bin_path
@bin_path ||= begin
path = settings[:bin] || "bin"
path = Pathname.new(path).expand_path(root)
FileUtils.mkdir_p(path) unless File.exist?(path)
FileUtils.mkdir_p(path)
Pathname.new(path).expand_path
end
end
Expand Down Expand Up @@ -202,7 +202,7 @@ def mkdir_p(path)
sudo "mkdir -p '#{path}'"
else
FileUtils.mkdir_p(path)
end unless File.exist?(path)
end
end

def sudo(str)
Expand Down
4 changes: 2 additions & 2 deletions lib/bundler/runtime.rb
Expand Up @@ -81,7 +81,7 @@ def dependencies_for(*groups)
alias gems specs

def cache
FileUtils.mkdir_p(cache_path) unless File.exist?(cache_path)
FileUtils.mkdir_p(cache_path)

Bundler.ui.info "Updating .gem files in vendor/cache"
specs.each do |spec|
Expand All @@ -92,7 +92,7 @@ def cache
end

def prune_cache
FileUtils.mkdir_p(cache_path) unless File.exist?(cache_path)
FileUtils.mkdir_p(cache_path)

resolve = @definition.resolve
cached = Dir["#{cache_path}/*.gem"]
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/settings.rb
Expand Up @@ -99,7 +99,7 @@ def set_key(key, value, hash, file)
unless hash[key] == value
hash[key] = value
hash.delete(key) if value.nil?
FileUtils.mkdir_p(file.dirname) unless File.exist?(file.dirname)
FileUtils.mkdir_p(file.dirname)
File.open(file, "w") { |f| f.puts hash.to_yaml }
end
value
Expand Down
14 changes: 5 additions & 9 deletions lib/bundler/source.rb
Expand Up @@ -242,7 +242,7 @@ def download_gem_from_uri(spec, uri)
download_path = Bundler.requires_sudo? ? Bundler.tmp : Gem.dir
gem_path = "#{Gem.dir}/cache/#{spec.full_name}.gem"

FileUtils.mkdir_p("#{download_path}/cache") unless File.exist?("#{download_path}/cache")
FileUtils.mkdir_p("#{download_path}/cache")
Gem::RemoteFetcher.fetcher.download(spec, uri, download_path)

if Bundler.requires_sudo?
Expand Down Expand Up @@ -391,14 +391,10 @@ def initialize(spec, options = {})
def generate_bin
return if spec.executables.nil? || spec.executables.empty?

if Bundler.requires_sudo?
FileUtils.mkdir_p("#{Bundler.tmp}/bin") unless File.exist?("#{Bundler.tmp}/bin")
end

FileUtils.mkdir_p("#{Bundler.tmp}/bin") if Bundler.requires_sudo?
super

if Bundler.requires_sudo?
Bundler.mkdir_p("#{Gem.dir}/bin") unless File.exist?("#{Gem.dir}/bin")
Bundler.mkdir_p "#{Gem.dir}/bin"
spec.executables.each do |exe|
Bundler.sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Gem.dir}/bin/"
end
Expand Down Expand Up @@ -618,14 +614,14 @@ def cache
in_cache { git %|fetch --force --quiet "#{uri}" refs/heads/*:refs/heads/*| }
else
Bundler.ui.info "Fetching #{uri}"
FileUtils.mkdir_p(cache_path.dirname) unless File.exist?(cache_path.dirname)
FileUtils.mkdir_p(cache_path.dirname)
git %|clone "#{uri}" "#{cache_path}" --bare --no-hardlinks|
end
end

def checkout
unless File.exist?(path.join(".git"))
FileUtils.mkdir_p(path.dirname) unless File.exist?(path.dirname)
FileUtils.mkdir_p(path.dirname)
git %|clone --no-checkout "#{cache_path}" "#{path}"|
end
Dir.chdir(path) do
Expand Down

0 comments on commit 0891a38

Please sign in to comment.