class SiSU_Info_File::InfoFile

Public Class Methods

new(fns) click to toggle source

todo unify with FileOp

Calls superclass method SiSU_Info_Env::InfoEnv::new
# File lib/sisu/se_file_op.rb, line 67
def initialize(fns)
  begin
    super(fns)
    @fns=fns
    @env=SiSU_Env::InfoEnv.new(@fns)
    m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm)$/
    @fnn,@fnb,@fnt=@fns[m,1],@fns[m,2],@fns[m,3]
  rescue
    SiSU_Screen::Ansi.new('',$!,$@).rescue do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
  end
end

Public Instance Methods

ao() click to toggle source
# File lib/sisu/se_file_op.rb, line 157
def ao
  FileUtils::mkdir_p(@env.processing_path.ao) \
    unless FileTest.directory?(@env.processing_path.ao)
end
ao_content() click to toggle source
# File lib/sisu/se_file_op.rb, line 107
def ao_content
  @env.processing_path.ao + '/' \
    + @fns + '.content.rbm'
end
ao_idx_html() click to toggle source
# File lib/sisu/se_file_op.rb, line 119
def ao_idx_html
  @env.processing_path.ao + '/' \
    + @fns + '.idx_html.rbm'
end
ao_idx_sst_rel() click to toggle source
# File lib/sisu/se_file_op.rb, line 115
def ao_idx_sst_rel #used by tex & odf
  @env.processing_path.ao + '/' \
    + @fns + '.idx_raw.rbm'
end
ao_idx_sst_rel_html_seg() click to toggle source
# File lib/sisu/se_file_op.rb, line 111
def ao_idx_sst_rel_html_seg
  @env.processing_path.ao + '/' \
    + @fns + '.idx_sst.rbm'
end
ao_idx_xhtml() click to toggle source
# File lib/sisu/se_file_op.rb, line 123
def ao_idx_xhtml
  @env.processing_path.ao + '/' \
    + @fns + '.idx_xhtml.rbm'
end
ao_map_nametags() click to toggle source
# File lib/sisu/se_file_op.rb, line 131
def ao_map_nametags
  @env.processing_path.ao + '/' \
    + @fns + '.map_name_tags.rbm'
end
ao_map_ocn_htmlseg() click to toggle source
# File lib/sisu/se_file_op.rb, line 135
def ao_map_ocn_htmlseg
  @env.processing_path.ao + '/' \
    + @fns + '.map_ocn_htmlseg.rbm'
end
ao_metadata() click to toggle source
# File lib/sisu/se_file_op.rb, line 127
def ao_metadata
  @env.processing_path.ao + '/' \
    + @fns + '.metadata.rbm'
end
basefilename() click to toggle source
# File lib/sisu/se_file_op.rb, line 81
def basefilename #Remove if possible
  m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m
  @fns[m,1]
end
html_tune() click to toggle source
# File lib/sisu/se_file_op.rb, line 139
def html_tune
  @env.processing_path.tune + '/' \
    + @fns + '.marshal_tune'
end
make_file(path,filename) click to toggle source
# File lib/sisu/se_file_op.rb, line 85
def make_file(path,filename)
  (File.writable?("#{path}/.")) \
  ? File.new("#{path}/#{filename}",'w+')
  : (SiSU_Screen::Ansi.new(
      '',
      "*WARN* is the file or directory writable?, could not create #{filename}"
    ).warn)
end
make_path(path) click to toggle source
# File lib/sisu/se_file_op.rb, line 103
def make_path(path)
  FileUtils::mkdir_p(path) unless FileTest.directory?(path)
end
marshal() click to toggle source
# File lib/sisu/se_file_op.rb, line 106
def marshal
  def ao_content
    @env.processing_path.ao + '/' \
      + @fns + '.content.rbm'
  end
  def ao_idx_sst_rel_html_seg
    @env.processing_path.ao + '/' \
      + @fns + '.idx_sst.rbm'
  end
  def ao_idx_sst_rel #used by tex & odf
    @env.processing_path.ao + '/' \
      + @fns + '.idx_raw.rbm'
  end
  def ao_idx_html
    @env.processing_path.ao + '/' \
      + @fns + '.idx_html.rbm'
  end
  def ao_idx_xhtml
    @env.processing_path.ao + '/' \
      + @fns + '.idx_xhtml.rbm'
  end
  def ao_metadata
    @env.processing_path.ao + '/' \
      + @fns + '.metadata.rbm'
  end
  def ao_map_nametags
    @env.processing_path.ao + '/' \
      + @fns + '.map_name_tags.rbm'
  end
  def ao_map_ocn_htmlseg
    @env.processing_path.ao + '/' \
      + @fns + '.map_ocn_htmlseg.rbm'
  end
  def html_tune
    @env.processing_path.tune + '/' \
      + @fns + '.marshal_tune'
  end
  def xhtml_tune
    @env.processing_path.tune + '/' \
      + @fns + '.marshal_tune'
  end
  self
end
mkdir() click to toggle source
# File lib/sisu/se_file_op.rb, line 155
def mkdir #check moved from FileOp, existing mkdir
  def processing
    def ao
      FileUtils::mkdir_p(@env.processing_path.ao) \
        unless FileTest.directory?(@env.processing_path.ao)
    end
    def tune
      FileUtils::mkdir_p(@env.processing_path.tune) \
        unless FileTest.directory?(@env.processing_path.tune)
    end
    self
  end
end
processing() click to toggle source
# File lib/sisu/se_file_op.rb, line 156
def processing
  def ao
    FileUtils::mkdir_p(@env.processing_path.ao) \
      unless FileTest.directory?(@env.processing_path.ao)
  end
  def tune
    FileUtils::mkdir_p(@env.processing_path.tune) \
      unless FileTest.directory?(@env.processing_path.tune)
  end
  self
end
touch_file(path,filename) click to toggle source
# File lib/sisu/se_file_op.rb, line 93
def touch_file(path,filename)
  if File.writable?("#{path}/.");
    FileUtils::touch("#{path}/#{filename}")
  else
    SiSU_Screen::Ansi.new(
      '',
      "*WARN* is the file or directory writable?, could not create #{filename}"
    ).warn
  end
end
tune() click to toggle source
# File lib/sisu/se_file_op.rb, line 161
def tune
  FileUtils::mkdir_p(@env.processing_path.tune) \
    unless FileTest.directory?(@env.processing_path.tune)
end
write_file_processing() click to toggle source
# File lib/sisu/se_file_op.rb, line 149
def write_file_processing
  def html_tune
    File.new("#{@env.processing_path.tune}/#{@fns}.tune",'w+')
  end
  self
end
xhtml_tune() click to toggle source
# File lib/sisu/se_file_op.rb, line 143
def xhtml_tune
  @env.processing_path.tune + '/' \
    + @fns + '.marshal_tune'
end