c&d: sort image path when run from project dir (not installed)
authorRalph Amissah <ralph@amissah.com>
Tue, 7 Apr 2015 02:41:31 +0000 (22:41 -0400)
committerRalph Amissah <ralph@amissah.com>
Thu, 9 Apr 2015 03:05:39 +0000 (23:05 -0400)
lib/sisu/current/se_info_env.rb
lib/sisu/develop/se_info_env.rb

index 0ddac47e9bc5862a8b7c50dde7248ff2003e0b7a..268323d2dcbb0a11617f69a9e6fa9d0f40a18139 100644 (file)
@@ -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}")
index 97e81e77b7a4d46626ae6f83fe85db86dd0567e7..d22602d4f7b8c2af5a32c1434ee48ed8aea5cec6 100644 (file)
@@ -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}")