Skip to content

Commit

Permalink
fix rake file
Browse files Browse the repository at this point in the history
  • Loading branch information
kxuidaho committed Oct 19, 2023
1 parent a8cce83 commit 7b3c64a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}."
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7b3c64a

Please sign in to comment.