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