diff --git a/Rakefile b/Rakefile index 14271295..4917a7da 100644 --- a/Rakefile +++ b/Rakefile @@ -23,7 +23,7 @@ end # Helper Functions ############################################################################### -$ensure_dir_exists = ->(dir) { if !Dir.exists?(dir) then Dir.mkdir(dir) end } +$ensure_dir_exists = ->(dir) { if !Dir.exist?(dir) then Dir.mkdir(dir) end } def prompt_user_for_confirmation message response = nil @@ -105,7 +105,7 @@ task :generate_derivatives, [:thumbs_size, :small_size, :density, :missing, :im_ if !file_type access_filename=File.join([objects_dir, "#{base_filename}#{extname}"]) puts "Skipping conversion of file with unsupported extension: #{extname}." - if args.missing == 'false' or !File.exists?(access_filename) + if args.missing == 'false' or !File.exist?(access_filename) puts "Copying #{filename} to objects dir for access as #{access_filename}." system("cp #{filename} #{access_filename}") end @@ -122,7 +122,7 @@ task :generate_derivatives, [:thumbs_size, :small_size, :density, :missing, :im_ # Generate or copy the access image. if extname == ".tif" || extname == ".tiff" access_filename=File.join([objects_dir, "#{base_filename}.jpg"]) - if args.missing == 'false' or !File.exists?(access_filename) + if args.missing == 'false' or !File.exist?(access_filename) puts "Creating #{access_filename}" system("#{cmd_prefix} -flatten #{access_filename}") else @@ -131,7 +131,7 @@ task :generate_derivatives, [:thumbs_size, :small_size, :density, :missing, :im_ elsif extname == ".pdf" access_imagefilename=File.join([objects_dir, "#{base_filename}.jpg"]) access_filename=File.join([objects_dir, "#{base_filename}#{extname}"]) - if args.missing == 'false' or !File.exists?(access_filename) + if args.missing == 'false' or !File.exist?(access_filename) puts "Creating #{access_imagefilename}" system("#{cmd_prefix} -flatten #{access_imagefilename}") puts "Copying #{filename} to objects dir for access as #{access_filename}." @@ -141,7 +141,7 @@ task :generate_derivatives, [:thumbs_size, :small_size, :density, :missing, :im_ end else access_filename=File.join([objects_dir, "#{base_filename}#{extname}"]) - if args.missing == 'false' or !File.exists?(access_filename) + if args.missing == 'false' or !File.exist?(access_filename) puts "Copying #{filename} to objects dir for access as #{access_filename}." system("cp #{filename} #{access_filename}") else @@ -151,14 +151,14 @@ task :generate_derivatives, [:thumbs_size, :small_size, :density, :missing, :im_ # Generate the thumb image. thumb_filename=File.join([thumb_image_dir, "#{base_filename}_th.jpg"]) - if args.missing == 'false' or !File.exists?(thumb_filename) + if args.missing == 'false' or !File.exist?(thumb_filename) puts "Creating: #{thumb_filename}"; system("#{cmd_prefix} -resize #{args.thumbs_size} -flatten #{thumb_filename}") end # Generate the small image. small_filename = File.join([small_image_dir, "#{base_filename}_sm.jpg"]) - if args.missing == 'false' or !File.exists?(small_filename) + if args.missing == 'false' or !File.exist?(small_filename) puts "Creating: #{small_filename}"; system("#{cmd_prefix} -resize #{args.small_size} -flatten #{small_filename}") end @@ -206,13 +206,13 @@ task :new_post do end # check dir - if !Dir.exists?(post_dir) + if !Dir.exist?(post_dir) puts "Creating #{post_dir}." Dir.mkdir(post_dir) end # make sure file doesn't exist - if File.exists?(output_name) + if File.exist?(output_name) puts "The file #{output_name} already exists! New post not created." else # write file