Corrected with rubocop cop 'Lint/DeprecatedClassMethods'.

This commit is contained in:
Thorsten Eckel 2015-04-30 19:26:00 +02:00
parent 88344da11c
commit 4b4f45ddd1
3 changed files with 11 additions and 11 deletions

View file

@ -71,7 +71,7 @@ class Package < ApplicationModel
File.delete( entry )
end
backup_file = entry + '.link_backup'
if File.exists?( backup_file )
if File.exist?( backup_file )
logger.info "Restore backup file of #{backup_file} -> #{entry}."
File.rename( backup_file, entry )
end
@ -114,7 +114,7 @@ class Package < ApplicationModel
end
backup_file = dest.to_s + '.link_backup'
if File.exists?( backup_file )
if File.exist?( backup_file )
logger.info "Restore backup file of #{backup_file} -> #{dest.to_s}."
File.rename( backup_file, dest.to_s )
end
@ -145,7 +145,7 @@ class Package < ApplicationModel
dest = @@root + '/' + file
if File.directory?( entry.to_s )
if !File.exists?( dest.to_s )
if !File.exist?( dest.to_s )
logger.info "Create dir: #{dest.to_s}"
FileUtils.mkdir_p( dest.to_s )
end
@ -153,7 +153,7 @@ class Package < ApplicationModel
if File.file?( entry.to_s ) && ( File.file?( dest.to_s ) && !File.symlink?( dest.to_s ) )
backup_file = dest.to_s + '.link_backup'
if File.exists?( backup_file )
if File.exist?( backup_file )
raise "Can't link #{entry.to_s} -> #{dest.to_s}, destination and .link_backup already exists!"
else
logger.info "Create backup file of #{dest.to_s} -> #{backup_file}."
@ -441,7 +441,7 @@ class Package < ApplicationModel
def self.migrate( package, direction = 'normal' )
location = @@root + '/db/addon/' + package.underscore
return true if !File.exists?( location )
return true if !File.exist?( location )
migrations_done = Package::Migration.where( name: package.underscore )
# get existing migrations

View file

@ -3,4 +3,4 @@ require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])

View file

@ -68,7 +68,7 @@ returns
path = @path + '/'
# just make sure that spool path exists
if !File::exists?( path )
if !File::exist?( path )
FileUtils.mkpath path
end
@ -270,7 +270,7 @@ returns
check = true
count = 0
while check
if File::exists?( path + filename )
if File::exist?( path + filename )
count += 1
filename = filename + '-' + count
else
@ -284,7 +284,7 @@ returns
file.flock( File::LOCK_UN )
file.close
}
return false if !File.exists?( path + 'a-' + filename )
return false if !File.exist?( path + 'a-' + filename )
FileUtils.mv( path + 'a-' + filename, path + filename )
true
end
@ -419,7 +419,7 @@ returns
}
files.sort.each {|entry|
filename = path + '/' + entry
next if !File::exists?( filename )
next if !File::exist?( filename )
File.open( filename, 'rb' ) { |file|
all = file.read
spool = JSON.parse( all )
@ -474,7 +474,7 @@ returns
def self.jobs
# just make sure that spool path exists
if !File::exists?( @path )
if !File::exist?( @path )
FileUtils.mkpath @path
end