Class: SiSU_TexInfo::Source

Inherits:
Object
  • Object
show all
Includes:
SiSU_Param, SiSU_TexInfo
Defined in:
lib/sisu/texinfo.rb

Instance Method Summary collapse

Constructor Details

#initialize(opt) ⇒ Source

Returns a new instance of Source.



72
73
74
75
76
# File 'lib/sisu/texinfo.rb', line 72

def initialize(opt)
  @opt=opt
  @md=SiSU_Param::Parameters.new(@opt).get
  @env=SiSU_Env::InfoEnv.new(@opt.fns)
end

Instance Method Details

#directoriesObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/sisu/texinfo.rb', line 77

def directories
  begin
    case @opt.fns
    when /\.(?:-|ssm\.)?sst$/
      Dir.mkdir(@env.path.output) unless FileTest.directory?("#{@env.path.output}")
      Dir.mkdir(@env.processing_path.texi) unless FileTest.directory?(@env.processing_path.texi)
    end
  rescue
    SiSU_Screen::Ansi.new(opt,$!,$@).rescue do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
  end
end

#readObject



91
92
93
94
95
96
97
# File 'lib/sisu/texinfo.rb', line 91

def read
  begin
    song
  ensure
    Dir.chdir(@opt.f_pth[:pth])
  end
end

#songObject



98
99
100
101
102
103
104
105
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
# File 'lib/sisu/texinfo.rb', line 98

def song
  begin
    tool=(@opt.act[:verbose][:set]==:on \
    || @opt.act[:verbose_plus][:set]==:on \
    || @opt.act[:maintenance][:set]==:on) \
    ? "cd #{@md.file.output_path.texinfo.dir} && #{@env.program.texinfo} #{@md.file.base_filename.info}; cd -"
    : "[#{@opt.f_pth[:lng_is]}] #{@opt.fno}"
    (@opt.act[:verbose][:set]==:on \
    || @opt.act[:verbose_plus][:set]==:on \
    || @opt.act[:maintenance][:set]==:on) \
    && ! @opt.act[:quiet][:set]==:on \
    ? SiSU_Screen::Ansi.new(
        @opt.act[:color_state][:set],
        'TexInfo',
        tool
      ).green_hi_blue
    : SiSU_Screen::Ansi.new(
        @opt.act[:color_state][:set],
        'TexInfo',
        tool
      ).green_title_hi
    @md=SiSU_Param::Parameters.new(@opt).get
    directories
    @marshalfile=SiSU_Env::InfoFile.new(@opt.fns).marshal.ao_content
    if FileTest.file?(@marshalfile)==true
      File.open(@marshalfile) { |f| @@tuned_file=Marshal.load(f)}
      #tell.meta_verse_skipped if @opt.selections.str =~/[vVM]/
    else
      tex_array=IO.readlines(@opt.fns,'')
      SiSU_Metaverse.songsheet(tex_array)
    end
    tex_array=@@tuned_file
    TeXinfoMake.new(@md,tex_array).songsheet
    tex_array=''
  rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],$!,$@).rescue
  ensure
  end
end