From 1589a06e7a7781cd88bec3826439c862feaf24ea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 19 Jan 2008 03:19:08 +0000 Subject: mkdir_p, and again close running of ruby 1.9 * mkdir_p, [instead of ftools file.mkpath] * running against ruby 1.9 closed for now raise request for use of version 1.8 branch --- lib/sisu/v0/sysenv.rb | 77 +++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 43 deletions(-) (limited to 'lib/sisu/v0/sysenv.rb') diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 4187f6e9..28dc088b 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -869,7 +869,7 @@ module SiSU_Env end paths=[] paths=["#{path.processing}/sisupod/_sisu/skin/doc","#{path.processing}/sisupod/_sisu/skin/dir","#{path.processing}/sisupod/_sisu/skin/site","#{path.processing}/sisupod/_sisu/image"] - paths.each {|x| File.mkpath(x) unless FileTest.directory?(x) } + paths.each {|x| mkdir_p(x) unless FileTest.directory?(x) } end def defaults #multiple default directories @default_dir ||=@sys.default_dir #DEFAULT_DIR @@ -1290,14 +1290,14 @@ WOK defaults[:webserv_path] else #create default directory under home and place output there unless FileTest.directory?(defaults[:output_local]) - File.mkpath(defaults[:output_local]) + mkdir_p(defaults[:output_local]) end defaults[:output_local] end end def webserv_stub_ensure - File.mkpath(path.webserv) unless FileTest.directory?(path.webserv) - File.mkpath("#{path.webserv}/#@stub_pwd") unless FileTest.directory?("#{path.webserv}/#@stub_pwd") + mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) + mkdir_p("#{path.webserv}/#@stub_pwd") unless FileTest.directory?("#{path.webserv}/#@stub_pwd") end def webserv_map_pwd #dir "#{path.webserv}/#{stub_pwd}" @@ -1329,7 +1329,7 @@ WOK end def encoding pth="#{processing}/#{defaults[:processing_encoding]}" - File.mkpath(pth) unless FileTest.directory?(pth) + mkdir_p(pth) unless FileTest.directory?(pth) pth end def processing_base_tmp @@ -1380,15 +1380,15 @@ WOK end def processing #processing directory, used/needed for sisu work files, has sub-directories (dal,tex etc) unless FileTest.directory?(processing_path_root) - File.mkpath(processing_path_root) + mkdir_p(processing_path_root) File.chmod(0777,processing_path_root) end if processing_path_usr? processing_path_usr="#{processing_path_root}/#{user}" - File.mkpath(processing_path_usr) unless FileTest.directory?(processing_path_usr) + mkdir_p(processing_path_usr) unless FileTest.directory?(processing_path_usr) File.chmod(0700,processing_path_usr) end - File.mkpath(processing_path) unless FileTest.directory?(processing_path) + mkdir_p(processing_path) unless FileTest.directory?(processing_path) File.chmod(0700,processing_path) path_processing=[processing_path,defaults[:processing_path],defaults[:processing_path_home]] processing=nil @@ -1396,7 +1396,7 @@ WOK processing=v unless FileTest.directory?(processing) puts "a processing directory (#{processing}) is being created for use by sisu" - File.mkpath(processing) + mkdir_p(processing) File.chmod(0700,processing) end break @@ -1405,21 +1405,21 @@ WOK end def composite_file pth=path.dal #"#{processing}/composite" - File.mkpath(pth) unless FileTest.directory?(pth) + mkdir_p(pth) unless FileTest.directory?(pth) pth end def dal pth=if defined? @rc['processing']['dal']; "#{processing}/#{@rc['processing']['dal']}" else "#{processing}/#{defaults[:processing_dal]}" end - File.mkpath(pth) unless FileTest.directory?(pth) + mkdir_p(pth) unless FileTest.directory?(pth) pth end def tune pth=if defined? @rc['processing']['tune']; "#{processing}/#{@rc['processing']['tune']}" else "#{processing}/#{defaults[:processing_tune]}" end - File.mkpath(pth) unless FileTest.directory?(pth) + mkdir_p(pth) unless FileTest.directory?(pth) pth end def odf @@ -1429,14 +1429,14 @@ WOK pth=if defined? @rc['processing']['latex']; "#{processing}/#{@rc['processing']['latex']}" else "#{processing}/#{defaults[:processing_latex]}" end - File.mkpath(pth) unless FileTest.directory?(pth) + mkdir_p(pth) unless FileTest.directory?(pth) pth end def texi pth=if defined? @rc['processing']['texinfo']; "#{processing}/#{@rc['processing']['texinfo']}" else "#{processing}/#{defaults[:processing_texinfo]}" end - File.mkpath(pth) unless FileTest.directory?(pth) + mkdir_p(pth) unless FileTest.directory?(pth) pth end def texinfo #texinfo webserv, check @@ -1446,7 +1446,7 @@ WOK pth=if defined? @rc['processing']['lout']; "#{processing}/#{@rc['processing']['lout']}" else "#{processing}/#{defaults[:processing_lout]}" end - File.mkpath(pth) unless FileTest.directory?(pth) + mkdir_p(pth) unless FileTest.directory?(pth) pth end def feed @@ -1705,12 +1705,9 @@ WOK def images_local if FileTest.directory?(defaults[:image_local]) if @@image_flag - if RUBY_VERSION < '1.9' - require 'ftools' - end images=Dir.glob("#{defaults[:image_local]}/*.{png,jpg,gif}") pth="#{path.webserv}/#@stub_pwd" - File.mkpath("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image") + mkdir_p("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image") images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 @@image_flag=false end @@ -1733,12 +1730,9 @@ WOK def images_external if FileTest.directory?(image_external) if @@image_flag - if RUBY_VERSION < '1.9' - require 'ftools' - end images=Dir.glob("#{image_external}/*.{png,jpg,gif}") pth="#{path.webserv}/#@stub_pwd" - File.mkpath("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") + mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 @@image_flag=false end @@ -2002,7 +1996,7 @@ WOK rm_rf(sisupod_processing_path) end unless FileTest.directory?(sisupod_processing_path) - File.mkpath(sisupod_processing_path) + mkdir_p(sisupod_processing_path) end if FileTest.file?("#{Dir.pwd}/#{fns_pod}") system("unzip -q #{Dir.pwd}/#{fns_pod} -d #{path.processing}") @@ -2537,9 +2531,6 @@ WOK class Info_version