Class: SiSU_Info_File::InfoFile

Inherits:
SiSU_Info_Env::InfoEnv show all
Defined in:
lib/sisu/se_file_op.rb

Overview

se_info_env.rb

Direct Known Subclasses

SiSU_Env::InfoFile, SiSU_File_Op::FileOp

Instance Attribute Summary

Attributes inherited from SiSU_Info_Env::InfoEnv

#base_markup_dir_stub, #env, #etc, #filename, #flv, #fnb, #fnn, #fnt, #home, #hostname, #processing_git, #rc, #stub_pwd, #stub_src, #sys, #user, #webserv_host_cgi, #webserv_path, #webserv_port_cgi, #www, #yamlrc_dir

Attributes inherited from SiSU_Env_Call::EnvCall

#ad, #fnb, #fnn, #fnt, #fnv, #fnz, #rc

Instance Method Summary collapse

Methods inherited from SiSU_Info_Env::InfoEnv

#arch, #asciidoc_ocn?, #bin, #build, #cgi, #cgi_sample_search_form_name, #cjk, #cjk_ja, #cjk_ko, #cjk_zh, #composite_file, #concord_max, #console_web_browser, #console_www_browser, #current_document, #defaults, #digest, #digest_conf?, #dir_url, #docbook_viewer, #encoding, #epub, #epub_bld, #epub_cp_images, #epub_viewer, #feed, #feed_home, #fictionbook_viewer, #file_encoding, #font, #git, #host, #html, #html_minitoc?, #html_navigation?, #html_navigation_bar?, #html_quick_ref?, #html_right_pane?, #html_scroll_1, #html_scroll_2, #html_search_form?, #html_seg_1, #html_seg_2, #html_seg_title_banner?, #html_top_band?, #i18n, #image_external, #image_source, #image_source_include, #image_source_include_local, #image_source_include_remote, #image_source_sisu_includes, #images, #images_epub, #images_external, #images_local, #landscape, #lang_filename, #language, #language_default_set, #length, #links_to_manifest?, #listed?, #local, #locale, #localhost, #lout, #main, #make, #man, #manifest?, #manifest_minitoc?, #manpage, #manpage_generator, #manpage_viewer, #markdown_ocn?, #markup_emphasis, #metadata?, #minitoc?, #mono, #ocn?, #odf, #odf_pth, #odf_viewer, #odt, #odt_bld, #odt_ocn?, #omit_list, #orgmode_ocn?, #output, #output_tell, #papersize, #path, #path_rel_links, #paths, #pattern, #pdf, #pdf_viewer, #pdflatex, #php, #plaintext_ocn?, #plaintext_wrap, #po, #port, #portrait, #postgresql, #pot, #processing_base_tmp, #processing_path, #processing_sisupod, #program, #promo?, #pwd, #rbver, #read_source_file, #read_source_file_array, #read_source_file_string, #remote, #rexml, #rmagick, #root, #root_dir, #rst_ocn?, #sample_data, #sample_search_form_title, #sans, #scripts, #search?, #search_action, #search_fixed?, #search_form, #search_form?, #search_form_static, #segsubtoc?, #serif, #share, #sisupod_gen, #sisupod_gen_v2, #sisupod_gen_v3, #sisupod_v2, #sisupod_v3, #sisupod_v4, #sisurc_path, #sitearch, #size, #source_file_path, #source_file_processing_array, #source_file_with_path, #sql, #sqlite, #src_pod, #src_txt, #stub_dir, #stub_dir_orig, #stub_epub, #stub_md_harvest, #stub_pod, #style, #tex, #texi, #texinfo, #texpdf, #texpdf_hyperlinks, #text_editor, #textile_ocn?, #tidy, #tmp_root_dir, #toc?, #txt, #type, #url, #usr_dir?, #wc, #web_browser, #webrick, #webrick_port, #webserv, #webserv_base, #webserv_base_cgi, #webserv_cgi, #webserv_dir, #webserv_files_from_db, #webserv_host_base, #webserv_image, #webserv_map_pwd, #webserv_stub_ensure, #widget, #widget_static, #www_browser, #xml_docbook_ocn?, #xml_editor, #xml_fictionbook_ocn?, #xml_scaffold_ocn?, #xml_viewer, #yamlrc

Methods inherited from SiSU_Env_Call::EnvCall

#by?, #by_filename?, #by_filetype?, #by_language_code?, #default_language?, #document_language_versions_found, #dump?, #filename, #lang, #mono_multi_lingual?, #multilingual?, #output_dir_structure, #published_manifests?, #redirect?

Constructor Details

#initialize(fns) ⇒ InfoFile

todo unify with FileOp



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# 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

Instance Method Details

#aoObject



157
158
159
160
# 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_contentObject



107
108
109
110
# File 'lib/sisu/se_file_op.rb', line 107

def ao_content
  @env.processing_path.ao + '/' \
    + @fns + '.content.rbm'
end

#ao_idx_htmlObject



119
120
121
122
# 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_relObject

used by tex & odf



115
116
117
118
# 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_segObject



111
112
113
114
# 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_xhtmlObject



123
124
125
126
# File 'lib/sisu/se_file_op.rb', line 123

def ao_idx_xhtml
  @env.processing_path.ao + '/' \
    + @fns + '.idx_xhtml.rbm'
end

#ao_map_nametagsObject



131
132
133
134
# 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_htmlsegObject



135
136
137
138
# 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_metadataObject



127
128
129
130
# File 'lib/sisu/se_file_op.rb', line 127

def 
  @env.processing_path.ao + '/' \
    + @fns + '.metadata.rbm'
end

#basefilenameObject

Remove if possible



81
82
83
84
# File 'lib/sisu/se_file_op.rb', line 81

def basefilename #Remove if possible
  m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m
  @fns[m,1]
end

#html_tuneObject



139
140
141
142
# File 'lib/sisu/se_file_op.rb', line 139

def html_tune
  @env.processing_path.tune + '/' \
    + @fns + '.marshal_tune'
end

#make_file(path, filename) ⇒ Object



85
86
87
88
89
90
91
92
# 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) ⇒ Object



103
104
105
# File 'lib/sisu/se_file_op.rb', line 103

def make_path(path)
  FileUtils::mkdir_p(path) unless FileTest.directory?(path)
end

#marshalObject



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# 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 
    @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

#mkdirObject

check moved from FileOp, existing mkdir



155
156
157
158
159
160
161
162
163
164
165
166
167
# 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

#processingObject



156
157
158
159
160
161
162
163
164
165
166
# 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) ⇒ Object



93
94
95
96
97
98
99
100
101
102
# 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

#tuneObject



161
162
163
164
# 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_processingObject



149
150
151
152
153
154
# 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_tuneObject



143
144
145
146
# File 'lib/sisu/se_file_op.rb', line 143

def xhtml_tune
  @env.processing_path.tune + '/' \
    + @fns + '.marshal_tune'
end