Hi why,
I'm starting to use hobix instead of textpattern. Will post the
txp-to-hobix conversion script once I write it ;-)
Had to make some changes to commandline.rb to make it work on my windows
machine. Basically seemed like some problem with the tempfile handling in
the interactive post code... I think it's the calling "system" on the temp
file that messes something up (I know open {} is supposed to close it...).
I've re-written the function to use the Tempfile class instead which
allows me to insert an explicit/ugly File.close call...
I've attached the diff. I'm using hobix 0.3b on ruby 1.8.2 (2004-12-25)
[i386-mswin32]
Cheers,
Ernesto.
--- D:\apps\ruby\lib\ruby\site_ruby\1.8\hobix\commandline.old.rb
2005-07-06 10:25:34.000000000 +-0100
+++ D:\apps\ruby\lib\ruby\site_ruby\1.8\hobix\commandline.rb 2005-07-05
16:31:31.000000000 +-0100
@@ -11,12 +11,13 @@
# See COPYING for details.
#
#--
# $Id: commandline.rb,v 1.10 2005/01/18 20:10:20 why Exp $
#++
require 'hobix'
+require "tempfile"
module Hobix
module CommandLine
##
## Locate RC
##
@@ -359,28 +360,30 @@
create_weblog( blogname, blogpath )
end
puts "To create more weblogs later, use: hobix create #{
create_weblog_args.join( ' ' ) }"
puts
end
+
def aorta( obj )
if @config['use editor']
- tempfile =
File.join(ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp',"%10.6f.hobix" %
Time.now())
- File.open( tempfile, 'w' ) { |f| f << obj.to_yaml }
- created = File.mtime( tempfile )
- system( "#{ ENV['EDITOR'] || 'vi' } #{ tempfile }" )
- return nil unless File.exists?( tempfile )
+ tempfile = Tempfile.new("hobix")
+ tempfile << obj.to_yaml
+ created = File.mtime( tempfile.path )
+ tempfile.close
+ system( "#{ ENV['EDITOR'] || 'vi' } #{ tempfile.path }" )
+ return nil unless File.exists?( tempfile.path )
- if created < File.mtime( tempfile )
- obj = YAML::load( File.open( tempfile ) )
+ if created < File.mtime( tempfile.path )
+ tempfile.open
+ obj = YAML::load( tempfile )
else
puts "** Edit aborted"
obj = nil
end
- File.delete( tempfile )
- else
+ else
require 'hobix/util/objedit'
obj = Hobix::Util::ObjEdit( obj )
end
obj
end
_______________________________________________
Hobix-is-the-way mailing list
[EMAIL PROTECTED]
http://rubyforge.org/mailman/listinfo/hobix-is-the-way