aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/hub.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-10-15 19:27:16 +0100
committerRalph Amissah <ralph@amissah.com>2007-10-15 19:27:16 +0100
commite1ec4bd2dad2bd22ad97cea398ae1cfcfae183a2 (patch)
tree6ffe3ae1b2453578a032ce053934a31f980645e9 /lib/sisu/v0/hub.rb
parentregex matching of images, (and rearrangement of conditionals) (diff)
mostly the arrangement of conditionals
Diffstat (limited to 'lib/sisu/v0/hub.rb')
-rw-r--r--lib/sisu/v0/hub.rb72
1 files changed, 48 insertions, 24 deletions
diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb
index 9fe102e7..d7e01606 100644
--- a/lib/sisu/v0/hub.rb
+++ b/lib/sisu/v0/hub.rb
@@ -132,7 +132,9 @@ module SiSU
put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm')
@opt.fns=fns
if @req !~/(?:urls|remote)$/
- if @req=~/^dal$/ and FileTest.file?(@opt.fns) and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
+ if @req=~/^dal$/ \
+ and FileTest.file?(@opt.fns) \
+ and @opt.fns =~ /\.(?:(?:-|ssm\.)?sst|ssm)$/
if fns =~ /\.ssm$/; require "#{SiSU_lib}/composite" #pre-processing
SiSU_Assemble::Composite.new(@opt).read
@opt.fns=fns.gsub(/\.ssm$/,'.ssm.sst')
@@ -297,17 +299,19 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
def actions
if @opt.mod.inspect =~/--convert|--to|--from/; require "#{SiSU_lib}/sst_convert_markup"
end
- if @opt.cmd =~/([abCcDdFfgGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ and
- @opt.cmd =~/^-/ and
- @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ or
- @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ #and
+ if @opt.cmd =~/([abCcDdFfgGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \
+ and @opt.cmd =~/^-/ \
+ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
+ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ #and
@@tell=SiSU_Screen::Ansi.new(@opt.cmd)
@cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
flag=SiSU_Env::Info_processing_flag.new
extra=''
if @opt.cmd !~/[mn]/
- extra+=if @opt.cmd =~/[abghHhIiJjNOoptTwXxz]/ and @opt.cmd !~/[mn]/; 'm' #% add dal
- elsif ((@opt.cmd =~/[Dd]/ or (@opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
+ extra+=if @opt.cmd =~/[abghHhIiJjNOoptTwXxz]/ \
+ and @opt.cmd !~/[mn]/; 'm' #% add dal
+ elsif ((@opt.cmd =~/[Dd]/ \
+ or (@opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
and @opt.mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
and @opt.cmd !~/[mn]/
'm' #% add dal
@@ -315,14 +319,21 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
end
if @opt.cmd !~/y/
- extra+=if @opt.cmd =~/[abehHhIiJjNopsSstwXxz]/ and @opt.cmd !~/y/; 'y' #% add manifest
- elsif (@opt.cmd =~/[Dd]/ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) and @opt.files[0] !~/^remove$/ and @opt.cmd !~/y/; 'y' #% add manifest
+ extra+=if @opt.cmd =~/[abehHhIiJjNopsSstwXxz]/ \
+ and @opt.cmd !~/y/
+ 'y' #% add manifest
+ elsif (@opt.cmd =~/[Dd]/ \
+ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
+ and @opt.files[0] !~/^remove$/ \
+ and @opt.cmd !~/y/
+ 'y' #% add manifest
else ''
end
end
@opt.cmd=@opt.cmd + extra
if @opt.cmd =~/[vVM]/ #% version information
- if @opt.cmd =~/V/ and @opt.files.empty? #% environment
+ if @opt.cmd =~/V/ \
+ and @opt.files.empty? #% environment
SiSU_Help::Help.new('env',@opt).environment
else SiSU_Help::Help.new('env',@opt).sisu_version
end
@@ -339,7 +350,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
#path_dtd="#{@@env.path.output}/_sisu/xml/dtd"
re_p=/(sisupod(?:\.zip)?|[^\/]+?\.ssp)$/
unless @opt.files.join(',') =~ re_p #do not mix pods with source markup files in command line
- unless ( FileTest.directory?(path[:css]) and FileTest.directory?(path[:xsd]) )
+ unless ( FileTest.directory?(path[:css]) \
+ and FileTest.directory?(path[:xsd]) )
@opt.cmd=@opt.cmd +='C' unless @opt.cmd =~/C/ #FIX
end
if @opt.cmd =~/M/; $VERBOSE=false #debug $VERBOSE=true
@@ -350,14 +362,14 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if @opt.cmd =~/C/ #% -C initialize/configure
op('conf','configure site')
if @opt.cmd =~/R/
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ and
- @opt.cmd =~/RZ/
+ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
+ and @opt.cmd =~/RZ/
Operations.new(@opt).remote_put_base_site_rsync_match
else Operations.new(@opt).remote_put_base_site_rsync
end
elsif @opt.cmd =~/r/
- if @opt.mod.inspect =~/--init(?:ialize)?=site/ and
- @opt.cmd =~/CCr/
+ if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
+ and @opt.cmd =~/CCr/
Operations.new(@opt).remote_put_base_site_all
else Operations.new(@opt).remote_put_base_site
end
@@ -464,9 +476,11 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
#end
#if @opt.cmd =~/J/; op('manpage_exp','manpage exp') #% -J manpage
#end
- if @opt.cmd =~/D/ or @opt.mod.inspect =~/--pgsql/; op('dbi','postgresql') #% -D DB postgresql
+ if @opt.cmd =~/D/ \
+ or @opt.mod.inspect =~/--pgsql/; op('dbi','postgresql') #% -D DB postgresql
end
- if @opt.cmd =~/d/ or @opt.mod.inspect =~/--sqlite/; op('dbi','sqlite') #% -d DB sqlite
+ if @opt.cmd =~/d/ \
+ or @opt.mod.inspect =~/--sqlite/; op('dbi','sqlite') #% -d DB sqlite
end
if @opt.cmd =~/G/; Operations.new(@opt).cgi #% -G cgi - used to make dbi intecface
end
@@ -484,7 +498,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
@msg,@msgs="\tsisu -W [to start ruby web-server on output directory]\n",nil
@tell.call.print_brown if @opt.cmd =~/[uUvVM]/ unless @opt.files.join.empty?
- if defined? @@env.path.processing and FileTest.directory?(@@env.path.processing) and @@env.path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area
+ if defined? @@env.path.processing \
+ and FileTest.directory?(@@env.path.processing) \
+ and @@env.path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area
cd(@@env.path.processing_base_tmp) do
rm_rf(@@env.user) unless @opt.cmd =~/M/
end end
@@ -495,7 +511,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
require "#{SiSU_lib}/sst_identify_markup"
markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version?
elsif @opt.mod.inspect =~/--about/ #% help instructions
- if @opt.mod.inspect =~/--about/ and not @opt.what.empty?; SiSU_Help::Help.new(@opt.what,'color_off').help_request
+ if @opt.mod.inspect =~/--about/ \
+ and not @opt.what.empty?
+ SiSU_Help::Help.new(@opt.what,'color_off').help_request
else SiSU_Help::Help.new('list','color_off').help_request
end
elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
@@ -507,7 +525,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
else #% help instructions
unless @opt.mod.inspect =~/--convert|--to|--from/
- if @opt.mod.inspect =~/--help/ and not @opt.what.empty?; SiSU_Help::Help.new(@opt.what).help_request
+ if @opt.mod.inspect =~/--help/ \
+ and not @opt.what.empty?
+ SiSU_Help::Help.new(@opt.what).help_request
elsif @opt.mod.inspect =~/--help/; SiSU_Help::Help.new('list').help_request
else SiSU_Help::Help.new('env',@opt).sisu_version
tell=SiSU_Screen::Ansi.new(''," for HELP type:\n\tsisu --help [help request]\n\tman sisu\n or see the system or online documentation on SiSU:\n #{Config::CONFIG['datadir']}/doc/sisu/\n <http://www.jus.uio.no/sisu/>\n <http://sisudoc.org/>"); tell.puts_grey
@@ -518,13 +538,17 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if FileTest.file?(fns)
@opt.fns=fns
unless @opt.fns =~ /(?:\.(?:(?:-|ssm\.)?sst|ssm|ssp|sx[sdn]\.xml|termsheet.rb)|sisupod(?:\.zip)?)$/
- if @opt.fns=~/\.kdi$/ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/
- elsif @opt.fns=~/\.sx[sdn]\.xml$/ and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/
- elsif @opt.fns=~/\.ssi$/ and @opt.mod.inspect =~/--identify/
+ if @opt.fns=~/\.kdi$/ \
+ and @opt.mod.inspect =~/--(?:convert(?:-from)?|from)[=-]kdi/
+ elsif @opt.fns=~/\.sx[sdn]\.xml$/ \
+ and @opt.mod.inspect =~/--(?:(?:convert(?:-from)?|from)[=-])?(?:xml2sst|sxml)/
+ elsif @opt.fns=~/\.ssi$/ \
+ and @opt.mod.inspect =~/--identify/
else Operations.new(@opt).not_recognised
end
end
- if @opt.fns =~/\.ssm\.sst$/ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
+ if @opt.fns =~/\.ssm\.sst$/ \
+ and @opt.cmd !~/[S_M]/ # rework necessry, revist, the _ flag is a hack, to keep ._sst files
@msg,@msgs='temporary file removed',nil
@tell.call.warn unless @opt.cmd =~/V/
File.unlink(@opt.fns) if File.exist?(@opt.fns) #CONSIDER