mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Replace deprecated File.exists? method
Done with `rubocop --auto-correct --only DeprecatedClassMethods`
This commit is contained in:
parent
ec8b940b2c
commit
698bca3f10
4 changed files with 7 additions and 7 deletions
|
@ -166,7 +166,7 @@ module Fog
|
||||||
@header_method = method(:header_for_signature_auth)
|
@header_method = method(:header_for_signature_auth)
|
||||||
|
|
||||||
if options[:joyent_keyfile]
|
if options[:joyent_keyfile]
|
||||||
if File.exists?(options[:joyent_keyfile])
|
if File.exist?(options[:joyent_keyfile])
|
||||||
@joyent_keyfile = options[:joyent_keyfile]
|
@joyent_keyfile = options[:joyent_keyfile]
|
||||||
@key_manager.add(@joyent_keyfile)
|
@key_manager.add(@joyent_keyfile)
|
||||||
else
|
else
|
||||||
|
|
|
@ -135,7 +135,7 @@ module Fog
|
||||||
@header_method = method(:header_for_signature_auth)
|
@header_method = method(:header_for_signature_auth)
|
||||||
|
|
||||||
if options[:joyent_keyfile]
|
if options[:joyent_keyfile]
|
||||||
if File.exists?(options[:joyent_keyfile])
|
if File.exist?(options[:joyent_keyfile])
|
||||||
@joyent_keyfile = options[:joyent_keyfile]
|
@joyent_keyfile = options[:joyent_keyfile]
|
||||||
@key_manager.add(@joyent_keyfile)
|
@key_manager.add(@joyent_keyfile)
|
||||||
else
|
else
|
||||||
|
|
|
@ -46,7 +46,7 @@ module Fog
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
requires :directory, :key
|
requires :directory, :key
|
||||||
::File.delete(path) if ::File.exists?(path)
|
::File.delete(path) if ::File.exist?(path)
|
||||||
dirs = path.split(::File::SEPARATOR)[0...-1]
|
dirs = path.split(::File::SEPARATOR)[0...-1]
|
||||||
dirs.length.times do |index|
|
dirs.length.times do |index|
|
||||||
dir_path = dirs[0..-index].join(::File::SEPARATOR)
|
dir_path = dirs[0..-index].join(::File::SEPARATOR)
|
||||||
|
@ -58,7 +58,7 @@ module Fog
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
pwd = Dir.pwd
|
pwd = Dir.pwd
|
||||||
if ::File.exists?(dir_path) && ::File.directory?(dir_path)
|
if ::File.exist?(dir_path) && ::File.directory?(dir_path)
|
||||||
Dir.chdir(dir_path)
|
Dir.chdir(dir_path)
|
||||||
if Dir.glob('*').empty?
|
if Dir.glob('*').empty?
|
||||||
Dir.rmdir(dir_path)
|
Dir.rmdir(dir_path)
|
||||||
|
@ -102,7 +102,7 @@ module Fog
|
||||||
file = ::File.new(path, 'wb')
|
file = ::File.new(path, 'wb')
|
||||||
if body.is_a?(String)
|
if body.is_a?(String)
|
||||||
file.write(body)
|
file.write(body)
|
||||||
elsif body.kind_of? ::File and ::File.exists?(body.path)
|
elsif body.kind_of? ::File and ::File.exist?(body.path)
|
||||||
FileUtils.cp(body.path, path)
|
FileUtils.cp(body.path, path)
|
||||||
else
|
else
|
||||||
file.write(body.read)
|
file.write(body.read)
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Fog
|
||||||
def get(key, &block)
|
def get(key, &block)
|
||||||
requires :directory
|
requires :directory
|
||||||
path = file_path(key)
|
path = file_path(key)
|
||||||
if ::File.exists?(path)
|
if ::File.exist?(path)
|
||||||
data = {
|
data = {
|
||||||
:content_length => ::File.size(path),
|
:content_length => ::File.size(path),
|
||||||
:key => key,
|
:key => key,
|
||||||
|
@ -57,7 +57,7 @@ module Fog
|
||||||
def head(key)
|
def head(key)
|
||||||
requires :directory
|
requires :directory
|
||||||
path = file_path(key)
|
path = file_path(key)
|
||||||
if ::File.exists?(path)
|
if ::File.exist?(path)
|
||||||
new({
|
new({
|
||||||
:content_length => ::File.size(path),
|
:content_length => ::File.size(path),
|
||||||
:key => key,
|
:key => key,
|
||||||
|
|
Loading…
Reference in a new issue