From f21f48a215bbc2776a362395cde2d361a90abda4 Mon Sep 17 00:00:00 2001 From: Andrew Nesbitt Date: Mon, 11 Jul 2011 11:11:07 +0100 Subject: [PATCH] Default wheneverize directory to '.' --- bin/wheneverize | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/bin/wheneverize b/bin/wheneverize index 9274772..b208594 100755 --- a/bin/wheneverize +++ b/bin/wheneverize @@ -17,17 +17,16 @@ OptionParser.new do |opts| end end -if ARGV.empty? - abort "Please specify the directory to wheneverize, e.g. `#{File.basename($0)} .'" -elsif !File.exists?(ARGV.first) - abort "`#{ARGV.first}' does not exist." -elsif !File.directory?(ARGV.first) - abort "`#{ARGV.first}' is not a directory." -elsif ARGV.length > 1 - abort "Too many arguments; please specify only the directory to wheneverize." +unless ARGV.empty? + if !File.exists?(ARGV.first) + abort "`#{ARGV.first}' does not exist." + elsif !File.directory?(ARGV.first) + abort "`#{ARGV.first}' is not a directory." + elsif ARGV.length > 1 + abort "Too many arguments; please specify only the directory to wheneverize." + end end - content = <<-FILE # Use this file to easily define all of your cron jobs. # @@ -52,7 +51,7 @@ content = <<-FILE FILE file = 'config/schedule.rb' -base = ARGV.shift +base = ARGV.empty? ? '.' : ARGV.shift file = File.join(base, file) if File.exists?(file)