[ditz-talk] PATCH: ditz init crashes when it can't find .ditz/ditz_plugins?

Matthew Wilson matt at tplus1.com
Mon Dec 29 10:33:19 EST 2008


I'm running ditz directly from my git clone, which is up to date
through Dec 22nd.

Here's the crash:

$ ditz --version
ditz 0.5

$ mkdir scratch

$ cd scratch/

$ ditz -v init
# loading plugins from ./.ditz-plugins
/usr/lib/ruby/1.8/yaml.rb:143:in `initialize': No such file or
directory - ./.ditz-plugins (Errno::ENOENT)
	from /usr/lib/ruby/1.8/yaml.rb:143:in `open'
	from /usr/lib/ruby/1.8/yaml.rb:143:in `load_file'
	from /home/matt/checkouts/ditz/lib/ditz.rb:55:in `load_plugins'
	from /home/matt/checkouts/ditz/bin/ditz:92


And here's my patch:

>From c5ff06b70c73a1bb3d1f06017e9f5c85e82675af Mon Sep 17 00:00:00 2001
From: W. Matthew Wilson <matt at tplus1.com>
Date: Mon, 29 Dec 2008 10:30:42 -0500
Subject: [PATCH] Don't blow up if no .ditz/ditz-plugins dir exists

---
 bin/ditz |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/bin/ditz b/bin/ditz
index 04bc7a6..81a5f4c 100755
--- a/bin/ditz
+++ b/bin/ditz
@@ -89,7 +89,9 @@ if $opts[:list_hooks]
 end

 begin
-  Ditz::load_plugins $opts[:plugins_file]
+  if File.exists? $opts[:plugins_file]
+      Ditz::load_plugins $opts[:plugins_file]
+  end
 rescue LoadError => e
   Ditz::debug "can't load plugins file: #{e.message}"
 end
-- 
1.5.4.3



-- 
Matthew Wilson
matt at tplus1.com
http://tplus1.com


More information about the ditz-talk mailing list