I'm fixing little problems that my configuration is having with hobix svn trunk. I'll post them here as I go?

Here is the first one ...

hobix blogs was throwing an exception when there were no blogs that looks like this:

/usr/local/lib/ruby/site_ruby/1.8/hobix/commandline.rb:133:in `blogs_weblog': undefined method `-@' for nil:NilClass (NoMethodError)
        from /usr/local/bin/hobix:79

Because although it would respond to sort, there was nothing in the array. So the following prints the no blogs message as expected.

Index: lib/hobix/commandline.rb
===================================================================
--- lib/hobix/commandline.rb    (revision 125)
+++ lib/hobix/commandline.rb    (working copy)
@@ -127,10 +127,10 @@
     def blogs_weblog_explain; "List your weblogs."; end
     def blogs_weblog_args; []; end
     def blogs_weblog
-        if @config['weblogs'].respond_to? :sort
-            blogs = @config['weblogs'].sort
-            name_width = blogs.collect { |b| b[0].length }.max
-            tabular( blogs, [[-name_width, 0, 'weblog-name'], [-40, 1, 'path']] )
+        if ( ( @config['weblogs'].respond_to? :sort ) && ( @config['weblogs'].length != 0 ) )
+          blogs = @config['weblogs'].sort
+          name_width = blogs.collect { |b| b[0].length }.max
+          tabular( blogs, [[-name_width, 0, 'weblog-name'], [-40, 1, 'path']] )
         else
             puts "** You have no blogs set up.  Use `hobix setup_blogs' to get started."
         end


--
Arthur A. Vanderbilt
[EMAIL PROTECTED]
_______________________________________________
Hobix-is-the-way mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/hobix-is-the-way

Reply via email to