fix breaking change in ruby; exists? -> exist?
This commit is contained in:
parent
257c54ee18
commit
009e2fa561
5 changed files with 12 additions and 12 deletions
|
|
@ -194,7 +194,7 @@ def getenclosure(podcast, item)
|
|||
end
|
||||
end
|
||||
@filelist[filename] = true
|
||||
if ! File.exists?("#{@podcasts[podcast]["savedir"]}/#{filename}")
|
||||
if ! File.exist?("#{@podcasts[podcast]["savedir"]}/#{filename}")
|
||||
puts " getting #{@podcasts[podcast]["savedir"]}/#{filename}"
|
||||
begin
|
||||
response = fetch(cast)
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ def fetch(uri_str, limit = 10)
|
|||
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
|
||||
if URI.parse(uri_str).scheme.to_s == "file"
|
||||
response = ""
|
||||
if FileTest.exists?(URI.parse(uri_str).path)
|
||||
if FileTest.exist?(URI.parse(uri_str).path)
|
||||
File.open(URI.parse(uri_str).path).each_line{|line|
|
||||
response += line
|
||||
}
|
||||
|
|
@ -667,7 +667,7 @@ if options["-H"]
|
|||
# even controleren of er al een .svn dir staat op deze locatie
|
||||
# entries en andere bestanden zijn read-only, dus de rest loopt er op
|
||||
# stuk. Bovendien wil je het zeer waarschijnlijk niet. Echt niet.
|
||||
if FileTest.exists?(".svn")
|
||||
if FileTest.exist?(".svn")
|
||||
STDERR.puts ".svn dir found at current location"
|
||||
STDERR.puts "please use a different location"
|
||||
exit
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ end
|
|||
|
||||
options = cmdline
|
||||
|
||||
if FileTest.exists?(options["-t"])
|
||||
if FileTest.exist?(options["-t"])
|
||||
puts "Target #{options["-t"]} already exists, not overwriting"
|
||||
exit 1
|
||||
end
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ end
|
|||
|
||||
parse_options
|
||||
|
||||
if ARGV[0].nil? or ARGV[0].empty? or ! FileTest.exists?(ARGV[0])
|
||||
if ARGV[0].nil? or ARGV[0].empty? or ! FileTest.exist?(ARGV[0])
|
||||
usage
|
||||
end
|
||||
|
||||
|
|
|
|||
14
pbatch/pb.rb
14
pbatch/pb.rb
|
|
@ -44,7 +44,7 @@ ENDTXT
|
|||
end
|
||||
|
||||
def readconfig
|
||||
if FileTest.exists?("#{@basedir}/#{CONFIG}")
|
||||
if FileTest.exist?("#{@basedir}/#{CONFIG}")
|
||||
File.open("#{@basedir}/#{CONFIG}").each_line {|line|
|
||||
line.sub!(/#.*/, "")
|
||||
line.sub!(/^\s*/, "")
|
||||
|
|
@ -87,7 +87,7 @@ end
|
|||
|
||||
def increasejobscounter
|
||||
jobscounter = 0
|
||||
if FileTest.exists?(COUNTERFILE)
|
||||
if FileTest.exist?(COUNTERFILE)
|
||||
File.new(COUNTERFILE).flock(File::LOCK_EX)
|
||||
File.open(COUNTERFILE, "r+"){|file|
|
||||
jobscounter = file.read
|
||||
|
|
@ -117,7 +117,7 @@ end
|
|||
def addjob
|
||||
jobnumber=sprintf("%06d", increasejobscounter)
|
||||
puts "New job: #{jobnumber}"
|
||||
if FileTest.exists?("#{@basedir}/#{JOBSDIR}/#{jobnumber}")
|
||||
if FileTest.exist?("#{@basedir}/#{JOBSDIR}/#{jobnumber}")
|
||||
puts "Job #{jobnumber} already scheduled. This should not happen."
|
||||
exit
|
||||
end
|
||||
|
|
@ -133,7 +133,7 @@ def addjobfromfile
|
|||
puts "Missing filename"
|
||||
usage
|
||||
else
|
||||
if ! FileTest.exists?(filename)
|
||||
if ! FileTest.exist?(filename)
|
||||
puts "File #{filename} doesn't exist"
|
||||
usage
|
||||
end
|
||||
|
|
@ -145,7 +145,7 @@ def addjobfromfile
|
|||
end
|
||||
|
||||
def createconfig
|
||||
if ! FileTest.exists?("#{@basedir}/#{CONFIG}")
|
||||
if ! FileTest.exist?("#{@basedir}/#{CONFIG}")
|
||||
File.open("#{@basedir}/#{CONFIG}", "w"){|file|
|
||||
file.puts <<EOT
|
||||
# how many parallel processes?
|
||||
|
|
@ -164,7 +164,7 @@ def deljob
|
|||
usage
|
||||
else
|
||||
jobnumber = sprintf("%06d", jobnumber.to_i)
|
||||
if FileTest.exists?("#{@basedir}/#{JOBSDIR}/#{jobnumber}")
|
||||
if FileTest.exist?("#{@basedir}/#{JOBSDIR}/#{jobnumber}")
|
||||
File.unlink("#{@basedir}/#{JOBSDIR}/#{jobnumber}")
|
||||
else
|
||||
puts "Job '#{jobnumber}' not in queue"
|
||||
|
|
@ -198,7 +198,7 @@ def unfail
|
|||
usage
|
||||
else
|
||||
jobnumber = sprintf("%06d", jobnumber.to_i)
|
||||
if FileTest.exists?("#{@basedir}/#{FAILDIR}/#{jobnumber}/job")
|
||||
if FileTest.exist?("#{@basedir}/#{FAILDIR}/#{jobnumber}/job")
|
||||
FileUtils.mv("#{@basedir}/#{FAILDIR}/#{jobnumber}/job", "#{@basedir}/#{JOBSDIR}/#{jobnumber}")
|
||||
# XXX tja, lekker makkelijk even geen recursie implementeren
|
||||
system("rm", "-rf", "#{@basedir}/#{FAILDIR}/#{jobnumber}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue