diff options
| -rw-r--r-- | data/doc/sisu/CHANGELOG_v4 | 3 | ||||
| -rw-r--r-- | lib/sisu/v4/hub.rb | 92 | ||||
| -rw-r--r-- | lib/sisu/v4/options.rb | 30 | 
3 files changed, 69 insertions, 56 deletions
| diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 7f519f8f..0ee9ec7f 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -34,6 +34,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.12.orig.tar.xz  * v4: bin/sisu, process remote sisu markup file or sisupod, where url provided +* v4: hub, operations, report if no markup file provided, where required by +    requested action +  %% 4.0.11.orig.tar.xz (2013-03-06:09/3)  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.0.11  http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.0.11-1 diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index e02fa940..dee13bc1 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -256,7 +256,7 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on      attr_accessor :op      def initialize(opt)        @opt=opt -      @@env=SiSU_Env::InfoEnv.new +      @@env=@env=SiSU_Env::InfoEnv.new        @msg,@msgs='',nil        @tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }      end @@ -343,9 +343,7 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on          end          if @opt.act[:pdf][:set]==:on \          or @opt.act[:pdf_p][:set]==:on \ -        or @opt.act[:pdf_l][:set]==:on -                                                       #% --pdf-l -                                                       #% --pdf, -p latex/ texpdf +        or @opt.act[:pdf_l][:set]==:on                 #% --pdf-l --pdf, -p latex/ texpdf            require_relative 'texpdf'                    # -p     texpdf.rb            SiSU_TeX::Source.new(@opt).read          end @@ -640,56 +638,66 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on        if @opt.act[:profile][:set]==:on          require 'profile'        end +      action_on_file_ =(@opt.act[:dal][:set]==:on \ +      || @opt.act[:manpage][:set]==:on \ +      || @opt.act[:texinfo][:set]==:on \ +      || @opt.act[:txt][:set]==:on \ +      || @opt.act[:html][:set]==:on \ +      || @opt.act[:html_scroll][:set]==:on \ +      || @opt.act[:html_seg][:set]==:on \ +      || @opt.act[:concordance][:set]==:on \ +      || @opt.act[:xhtml][:set]==:on \ +      || @opt.act[:epub][:set]==:on \ +      || @opt.act[:odt][:set]==:on \ +      || @opt.act[:xml_sax][:set]==:on \ +      || @opt.act[:xml_dom][:set]==:on \ +      || @opt.act[:pdf][:set]==:on \ +      || @opt.act[:pdf_p][:set]==:on \ +      || @opt.act[:pdf_l][:set]==:on \ +      || @opt.act[:psql][:set]==:on \ +      || @opt.act[:sqlite][:set]==:on \ +      || @opt.act[:sqlite_discrete][:set]==:on \ +      || @opt.act[:share_source][:set]==:on \ +      || @opt.act[:sisupod][:set]==:on \ +      || @opt.act[:qrcode][:set]==:on \ +      || @opt.act[:hash_digests][:set]==:on \ +      || @opt.act[:manifest][:set]==:on \ +      || @opt.act[:rsync][:set]==:on \ +      || @opt.act[:scp][:set]==:on \ +      || @opt.act[:webrick][:set]==:on \ +      || @opt.act[:zap][:set]==:on) \ +      ? (:true) +      : (:false)        if @opt.act[:harvest][:set]==:on          require_relative 'harvest'                     # harvest.rb          SiSU_Harvest::Source.new(@opt).read            # -h -H  html.rb        elsif @opt.mod.inspect =~/--convert|--to|--from/          require_relative 'sst_convert_markup'          # sst_convert_markup.rb -      elsif @opt.act[:dal][:set]==:on \ -      or @opt.act[:manpage][:set]==:on \ -      or @opt.act[:texinfo][:set]==:on \ -      or @opt.act[:txt][:set]==:on \ -      or @opt.act[:html][:set]==:on \ -      or @opt.act[:html_scroll][:set]==:on \ -      or @opt.act[:html_seg][:set]==:on \ -      or @opt.act[:concordance][:set]==:on \ -      or @opt.act[:xhtml][:set]==:on \ -      or @opt.act[:epub][:set]==:on \ -      or @opt.act[:odt][:set]==:on \ -      or @opt.act[:xml_sax][:set]==:on \ -      or @opt.act[:xml_dom][:set]==:on \ -      or @opt.act[:pdf][:set]==:on \ -      or @opt.act[:pdf_p][:set]==:on \ -      or @opt.act[:pdf_l][:set]==:on \ -      or @opt.act[:psql][:set]==:on \ -      or @opt.act[:sqlite][:set]==:on \ -      or @opt.act[:sqlite_discrete][:set]==:on \ -      or @opt.act[:share_source][:set]==:on \ -      or @opt.act[:sisupod][:set]==:on \ -      or @opt.act[:qrcode][:set]==:on \ -      or @opt.act[:hash_digests][:set]==:on \ -      or @opt.act[:manifest][:set]==:on \ -      or @opt.act[:rsync][:set]==:on \ -      or @opt.act[:scp][:set]==:on \ -      or @opt.act[:webrick][:set]==:on \ -      or @opt.act[:zap][:set]==:on \ +      elsif action_on_file_ == :true \        or (          @opt.cmd =~/^-/ \          and @opt.cmd =~/([abCcDdeFGgHhIjikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \          and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ -        or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \ +        or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/        )          do_initialization -        do_loops -        @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.act[:quiet][:set] ==:on -        @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? -        if defined? @@env.processing_path.processing \ -        and @@env.user \ -        and FileTest.directory?(@@env.processing_path.processing) \ -        and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area -          FileUtils::cd(@@env.processing_path.processing_base_tmp) do -            FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on +        if action_on_file_ == :true \ +        and @opt.files.length > 0 +          do_loops +          @msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil unless @opt.act[:quiet][:set] ==:on +          @tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty? +          if defined? @@env.processing_path.processing \ +          and @@env.user \ +          and FileTest.directory?(@@env.processing_path.processing) \ +          and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area +            FileUtils::cd(@@env.processing_path.processing_base_tmp) do +              FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on +            end            end +        elsif action_on_file_ == :true \ +        and @opt.files.length == 0 +          STDERR.puts %{requested action requires valid sisu markup file filename (.sst .ssm) or wildcard (that includes a valid filame)} +          puts SiSU_Utils::CodeMarker.new(__LINE__,__FILE__).set(:fuchsia) if @opt.cmd =~/[MV]/          end        elsif @opt.mod.inspect =~/--query/          require_relative 'sst_identify_markup'          # sst_identify_markup.rb diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb index 724fd9a9..0608df4e 100644 --- a/lib/sisu/v4/options.rb +++ b/lib/sisu/v4/options.rb @@ -1029,36 +1029,38 @@ module SiSU_Commandline        @lng_base      end      def fno -      @fno=fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1] +      @fno=(fns.nil? || fns.empty?) \ +      ? '' \ +      : (fns[/(.+?(?:sst|ssm))(?:\.sst)?/,1])      end      def fng -      @fng=fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1') +      @fng=(fno.nil? || fno.empty?) \ +      ? '' \ +      : (fno.gsub(/(?:~(?:#{Px[:lng_lst_rgx]}))?(\.ss[tm])$/,'\1'))      end      def fns        @fns      end      def fnl -      x=@fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2") +      @fns.gsub(/(\S+?)((?:\.ssm)?\.sst)/,"\\1.#{lng}\\2")      end      def what        @what      end      def fnb -      unless fns.empty? -        fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1] -      end +      (fns.nil? || fns.empty?) \ +      ? '' \ +      : (fns[/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/,1])      end      def fnc -      @fnc=if @fns =~/\.(?:ssm\.sst|ssm)$/ -        fnb + '.ssm.sst' -      else @fns -      end +      @fnc=(@fns =~/\.(?:ssm\.sst|ssm)$/) \ +      ? fnb + '.ssm.sst' +      : @fns      end      def fncb -      @fncb=if @fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/ -        fnb + '.ssm.sst' -      else @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1') -      end +      @fncb=(@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/) \ +      ? fnb + '.ssm.sst' +      : @fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')      end    end  end | 
