From 7ae4b45528a6ed30aa320f9cfa8584d12b3aebbf Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 6 Apr 2015 22:41:31 -0400 Subject: c&d: sort image path when run from project dir (not installed) --- lib/sisu/current/se_info_env.rb | 30 ++++++++++++++++++++---------- lib/sisu/develop/se_info_env.rb | 28 +++++++++++++++++++--------- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/lib/sisu/current/se_info_env.rb b/lib/sisu/current/se_info_env.rb index 0ddac47e..268323d2 100644 --- a/lib/sisu/current/se_info_env.rb +++ b/lib/sisu/current/se_info_env.rb @@ -1210,19 +1210,28 @@ WOK def output_tell url.webserv_map_pwd end - def image_source #image repository source directory + def image_source_sisu_includes(md=nil) + if md \ + and (md.opt.sisu_install_type? == \ + :full_path_to_sisu_bin_in_sisu_dir_tree) \ + and FileTest.directory?( + "#{md.opt.sisu_data_dir?}/image" + )==true + "#{md.opt.sisu_data_dir?}/image" + else + "#{share}/image" + end + end + def image_source(md=nil) #image repository source directory if defined? @rc['image']['path'] \ and defined? @rc['image']['public'] pth="#{@rc['image']['path']}" "#{pth}/#{@rc['image']['public']}" else - "#{share}/image" + image_source_sisu_includes(md) end end - def image_source_sisu_includes - "#{share}/image" - end - def image_source_include #image repository source directory + def image_source_include(md=nil) #image repository source directory if defined? @rc['image']['path'] \ and defined? @rc['image']['public'] \ and FileTest.directory?( @@ -1236,7 +1245,7 @@ WOK )==true "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" else - "#{share}/image" + image_source_sisu_includes(md) end end def image_external @@ -1248,7 +1257,8 @@ WOK end end def image_source_include_remote - if FileTest.directory?(image_external); image_external + if FileTest.directory?(image_external) + image_external end end self @@ -1283,7 +1293,7 @@ WOK end v=SiSU_Env::InfoVersion.instance.get_version v_dev=(DEVELOPER[:maintenance]==:true) \ - ? "_#{v[:version]}" + ? "_#{v.version}" : '' path=if proposed_path_base \ and FileTest.directory?(proposed_path_base) \ @@ -1473,7 +1483,7 @@ WOK def epub_cp_images(md) pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image" FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) - src="#{path.share}/image" + src="#{md.opt.sisu_data_dir?}/image" images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] images.each do |i| #move to avoid repeated tests if FileTest.file?("#{src}/#{i}") diff --git a/lib/sisu/develop/se_info_env.rb b/lib/sisu/develop/se_info_env.rb index 97e81e77..d22602d4 100644 --- a/lib/sisu/develop/se_info_env.rb +++ b/lib/sisu/develop/se_info_env.rb @@ -1216,19 +1216,28 @@ WOK def output_tell url.webserv_map_pwd end - def image_source #image repository source directory + def image_source_sisu_includes(md=nil) + if md \ + and (md.opt.sisu_install_type? == \ + :full_path_to_sisu_bin_in_sisu_dir_tree) \ + and FileTest.directory?( + "#{md.opt.sisu_data_dir?}/image" + )==true + "#{md.opt.sisu_data_dir?}/image" + else + "#{share}/image" + end + end + def image_source(md=nil) #image repository source directory if defined? @rc['image']['path'] \ and defined? @rc['image']['public'] pth="#{@rc['image']['path']}" "#{pth}/#{@rc['image']['public']}" else - "#{share}/image" + image_source_sisu_includes(md) end end - def image_source_sisu_includes - "#{share}/image" - end - def image_source_include #image repository source directory + def image_source_include(md=nil) #image repository source directory if defined? @rc['image']['path'] \ and defined? @rc['image']['public'] \ and FileTest.directory?( @@ -1242,7 +1251,7 @@ WOK )==true "#{SiSU_Utils::Path.new.base_markup}/#{defaults[:image_stub]}" else - "#{share}/image" + image_source_sisu_includes(md) end end def image_external @@ -1254,7 +1263,8 @@ WOK end end def image_source_include_remote - if FileTest.directory?(image_external); image_external + if FileTest.directory?(image_external) + image_external end end self @@ -1479,7 +1489,7 @@ WOK def epub_cp_images(md) pth="#{processing_path.epub}/#{Ep[:d_oebps]}/image" FileUtils::mkdir_p(pth) unless FileTest.directory?(pth) - src="#{path.share}/image" + src="#{md.opt.sisu_data_dir?}/image" images=%W[bullet_09.png arrow_next_red.png arrow_prev_red.png arrow_up_red.png] images.each do |i| #move to avoid repeated tests if FileTest.file?("#{src}/#{i}") -- cgit v1.2.3