aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/sysenv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/sysenv.rb')
-rw-r--r--lib/sisu/v0/sysenv.rb77
1 files changed, 34 insertions, 43 deletions
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 <Info_env
require 'rbconfig'
def get_version
- if RUBY_VERSION < '1.9'
- require 'ftools'
- end
@version={}
@pwd=ENV['PWD']
yst_etc="#{defaults[:sisu_etc]}/version.yml"
@@ -2559,7 +2550,7 @@ WOK
end
def images
unless FileTest.directory?("#{@env.path.output}/_sisu")
- File.mkpath("#{@env.path.output}/_sisu")
+ mkdir_p("#{@env.path.output}/_sisu")
end
unless File.exist?("#{@env.path.output}/_sisu/image_sys") \
or File.symlink?("#{@env.path.output}/_sisu/image_sys")
@@ -2882,23 +2873,23 @@ WOK
end
end
def make_path(path)
- File.mkpath(path) unless FileTest.directory?(path)
+ mkdir_p(path) unless FileTest.directory?(path)
end
def mkdir_initialize # not used but consider using
- File.mkpath(@env.path.output) unless FileTest.directory?(@env.path.output)
- File.mkpath("#{@env.path.output}/#@fnb") unless FileTest.directory?("#{@env.path.output}/#@fnb")
- File.mkpath("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
- File.mkpath(@env.path.dal) unless FileTest.directory?(@env.path.dal)
- File.mkpath(@env.path.tune) unless FileTest.directory?(@env.path.tune)
+ mkdir_p(@env.path.output) unless FileTest.directory?(@env.path.output)
+ mkdir_p("#{@env.path.output}/#@fnb") unless FileTest.directory?("#{@env.path.output}/#@fnb")
+ mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
+ mkdir_p(@env.path.dal) unless FileTest.directory?(@env.path.dal)
+ mkdir_p(@env.path.tune) unless FileTest.directory?(@env.path.tune)
end
def mkdir
dir=@env.path.output
txt_path="#{dir}/#@fnb"
- File.mkpath(dir) unless FileTest.directory?(dir)
- File.mkpath(txt_path) unless FileTest.directory?(txt_path)
- File.mkpath("#{dir}/#{@env.path.style}") unless FileTest.directory?("#{dir}/#{@env.path.style}")
- File.mkpath(@env.path.dal) unless FileTest.directory?(@env.path.dal)
- File.mkpath(@env.path.tune) unless FileTest.directory?(@env.path.tune)
+ mkdir_p(dir) unless FileTest.directory?(dir)
+ mkdir_p(txt_path) unless FileTest.directory?(txt_path)
+ mkdir_p("#{dir}/#{@env.path.style}") unless FileTest.directory?("#{dir}/#{@env.path.style}")
+ mkdir_p(@env.path.dal) unless FileTest.directory?(@env.path.dal)
+ mkdir_p(@env.path.tune) unless FileTest.directory?(@env.path.tune)
end
def mkfile #consider using more
path="#{@env.path.output}/#@fnb"
@@ -3024,7 +3015,7 @@ WOK
break
end
end
- File.mkpath("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}")
+ mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}")
if homepage_path \
and FileTest.file?(homepage_path)
cp(homepage_path,"#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html")
@@ -3049,7 +3040,7 @@ WOK
if FileTest.directory?(src_path)
cd(src_path)
source=Dir.glob("*.{png,jpg,gif,ico}")
- File.mkpath(dest_path) unless FileTest.directory?(dest_path)
+ mkdir_p(dest_path) unless FileTest.directory?(dest_path)
chmod(0755,dest_path)
source.each do |i|
cp_r(i,"#{dest_path}/#{i}")
@@ -3080,7 +3071,7 @@ WOK
cp_images(src,dest)
end
def cp_css
- File.mkpath("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
+ mkdir_p("#{@env.path.output}/#{@env.path.style}") unless FileTest.directory?("#{@env.path.output}/#{@env.path.style}")
css_path=['/etc/sisu/css',"#@home/.sisu/css","#@pwd/_sisu/css"] #BROKEN
if defined? @rc['permission_set']['css_modify'] \
and @rc['permission_set']['css_modify']
@@ -3101,7 +3092,7 @@ WOK
fn_css=SiSU_Env::CSS_default.new
css=SiSU_Style::CSS.new
path_style="#{@env.path.output}/#{@env.path.style}"
- File.mkpath(path_style) unless FileTest.directory?(path_style)
+ mkdir_p(path_style) unless FileTest.directory?(path_style)
style=File.new("#{path_style}/#{fn_css.homepage}",'w')
style << css.homepage
style.close