class SiSU_Initialize::ConfigSite

Public Class Methods

new(opt) click to toggle source
# File lib/sisu/conf.rb, line 78
def initialize(opt)
  @opt=opt
  @env=SiSU_Env::InfoEnv.new(@opt.fns)
  @suffix={
    rnc: 'rnc',
    rng: 'rng',
    xsd: 'xsd',
  }
  @path={
    xml: @env.path.output + '/_sisu/xml',
    xsd: @env.path.output + '/_sisu/xml/xsd',
    rnc: @env.path.output + '/_sisu/xml/rnc',
    rng: @env.path.output + '/_sisu/xml/rng',
    style: @env.path.output + '/' + @env.path.style,
  }
  @pwd,@home=Dir.pwd,@env.path.home
end

Public Instance Methods

cp_external_images() click to toggle source
# File lib/sisu/conf.rb, line 115
def cp_external_images
  SiSU_Screen::Ansi.new(
    @opt.act[:color_state][:set],
    'invert',
    'Copy external images',
    ''
  ).colorize if @opt.act[:verbose_plus][:set]==:on
  SiSU_Env::CreateSite.new(@opt).cp_external_images
end
cp_local_images() click to toggle source
# File lib/sisu/conf.rb, line 104
def cp_local_images
  SiSU_Screen::Ansi.new(
    @opt.act[:color_state][:set],
    'invert',
    'Copy images',
    ''
  ).colorize unless @opt.act[:quiet][:set]==:on
  SiSU_Env::CreateSite.new(@opt).cp_local_images
  SiSU_Env::CreateSite.new(@opt).cp_webserver_images_local #this should not have been necessary
  SiSU_Env::CreateSite.new(@opt).cp_base_images #base images (nav etc.) used by all html
end
cp_webserver_images() click to toggle source
# File lib/sisu/conf.rb, line 124
def cp_webserver_images
  SiSU_Screen::Ansi.new(
    @opt.act[:color_state][:set],
    'invert',
    'Copy webserver/output file images',
    ''
  ).colorize unless @opt.act[:quiet][:set]==:on
  SiSU_Env::CreateSite.new(@opt).cp_webserver_images
end
css() click to toggle source
# File lib/sisu/conf.rb, line 133
def css
  SiSU_Screen::Ansi.new(
    @opt.act[:color_state][:set],
    'invert',
    'Configuring CSSs',
    ''
  ).colorize unless @opt.act[:quiet][:set]==:on
  SiSU_Env::CreateSite.new(@opt).cp_css
end
dtd() click to toggle source
# File lib/sisu/conf.rb, line 142
def dtd
  SiSU_Screen::Ansi.new(
    @opt.act[:color_state][:set],
    'invert',
    'Configuring DTDs',
    ''
  ).colorize unless @opt.act[:quiet][:set]==:on
  @rxng=SiSU_Relaxng::RelaxNG.new
  @path.each { |d| FileUtils::mkdir_p(d[1]) \
  unless FileTest.directory?(d[1]) }
  #ugly code, sort later
  if @rxng.methods.join =~/[^_]dtd_sax\b/
    if @rxng.dtd_sax.length > 200
      dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_sax}",'w')
      dtd << @rxng.dtd_sax
      dtd.close
    else trang_rnc_model_output_sax
    end
  else trang_rnc_model_output_sax
  end
  if @rxng.methods.join =~/[^_]dtd_dom\b/
    if @rxng.dtd_dom.length > 200
      dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_dom}",'w')
      dtd << @rxng.dtd_dom
      dtd.close
    else trang_rnc_model_output_dom
    end
  else trang_rnc_model_output_dom
  end
  if @rxng.methods.join =~/[^_]dtd_node\b/
    if @rxng.dtd_node.length > 200
      dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.input_node}",'w')
      dtd << @rxng.dtd_node
      dtd.close
    else trang_rnc_model_input_node
    end
  else trang_rnc_model_input_node
  end
  if @rxng.methods.join =~/[^_]dtd_xhtml\b/
    if @rxng.dtd_xhtml.length > 200
      dtd=File.new("#{@path[:style]}/#{@rxng.rng_name.output_xhtml}",'w')
      dtd << @rxng.dtd_xhtml
      dtd.close
    else trang_rnc_model_output_xhtml
    end
  else trang_rnc_model_output_xhtml
  end
end
make_homepage() click to toggle source
# File lib/sisu/conf.rb, line 95
def make_homepage
  SiSU_Screen::Ansi.new(
    @opt.act[:color_state][:set],
    'invert',
    'Make homepage',
    ''
  ).colorize unless @opt.act[:quiet][:set]==:on
  SiSU_Env::CreateSite.new(@opt).homepage
end
trang_rnc_model_input_dom() click to toggle source
# File lib/sisu/conf.rb, line 265
def trang_rnc_model_input_dom
  rnc_file=@env.processing_path.ao + '/dom.rnc'
  dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_dom
  rnc=File.new(rnc_file,'w')
  rnc << @rxng.rnc_model_output_dom
  rnc.close
  schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
  schema.relaxng(@opt.selections.str)
end
trang_rnc_model_input_node() click to toggle source
# File lib/sisu/conf.rb, line 274
def trang_rnc_model_input_node
  rnc_file=@env.processing_path.ao + '/node.rnc'
  dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_node
  rnc=File.new(rnc_file,'w')
  rnc << @rxng.rnc_model_input_node
  rnc.close
  schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
  schema.relaxng(@opt.selections.str)
end
trang_rnc_model_input_sax() click to toggle source
# File lib/sisu/conf.rb, line 256
def trang_rnc_model_input_sax
  rnc_file=@env.processing_path.ao + '/sax.rnc'
  dtd_file=@path[:xsd] + '/' + @rxng.rng_name.input_sax
  rnc=File.new(rnc_file,'w')
  rnc << @rxng.rnc_model_output_sax
  rnc.close
  schema=SiSU_Env::SystemCall.new(rnc_file,dtd_file)
  schema.relaxng(@opt.selections.str)
end
trang_rnc_model_output_dom() click to toggle source
# File lib/sisu/conf.rb, line 212
def trang_rnc_model_output_dom
  s=@suffix
  rnc_src=@env.processing_path.ao + '/dom.' + s[:rnc]
  rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_dom
  rng_file=@path[:rng] + '/' + @rxng.rng_name.output_dom
  xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_dom
  rnc=File.new(rnc_src,'w')
  rnc << @rxng.rnc_model_output_dom
  rnc.close
  #xsd
  schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
  schema.relaxng(@opt.selections.str)
  #rng
  schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
  schema.relaxng(@opt.selections.str)
  #rnc
  if FileTest.file?(rnc_src)
    FileUtils::cp(rnc_src,rnc_file)
    FileUtils::chmod(0644,rnc_file)
  else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]}
  end
end
trang_rnc_model_output_sax() click to toggle source
# File lib/sisu/conf.rb, line 190
def trang_rnc_model_output_sax
  s=@suffix
  rnc_src=@env.processing_path.ao + '/sax.' + s[:rnc]
  rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_sax
  rng_file=@path[:rng] + '/' + @rxng.rng_name.output_sax
  xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_sax
  rnc=File.new(rnc_src,'w')
  rnc << @rxng.rnc_model_output_sax
  rnc.close
  #xsd
  schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
  schema.relaxng(@opt.selections.str)
  #rng
  schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
  schema.relaxng(@opt.selections.str)
  #rnc
  if FileTest.file?(rnc_src)
    FileUtils::cp(rnc_src,rnc_file)
    FileUtils::chmod(0644,rnc_file)
  else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]}
  end
end
trang_rnc_model_output_xhtml() click to toggle source
# File lib/sisu/conf.rb, line 234
def trang_rnc_model_output_xhtml
  s=@suffix
  rnc_src=@env.processing_path.ao + '/xhtml.' + s[:rnc]
  rnc_file=@path[:rnc] + '/' + @rxng.rnc_name.output_xhtml
  rng_file=@path[:rng] + '/' + @rxng.rng_name.output_xhtml
  xsd_file=@path[:xsd] + '/' + @rxng.xsd_name.output_xhtml
  rnc=File.new(rnc_src,'w')
  rnc << @rxng.rnc_model_output_xhtml
  rnc.close
  #xsd
  schema=SiSU_Env::SystemCall.new(rnc_src,xsd_file)
  schema.relaxng(@opt.selections.str)
  #rng
  schema=SiSU_Env::SystemCall.new(rnc_src,rng_file)
  schema.relaxng(@opt.selections.str)
  #rnc
  if FileTest.file?(rnc_src)
    FileUtils::cp(rnc_src,rnc_file)
    FileUtils::chmod(0644,rnc_file)
  else STDERR.puts %{\t*WARN* did not find rnc - "#{rnc_src}" [#{__FILE__}:#{__LINE__}]}
  end
end