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.



74
75
76
77
78
# File 'lib/sisu/texinfo.rb', line 74

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

Instance Method Details

#directoriesObject



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

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



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

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

#songObject



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
136
137
# File 'lib/sisu/texinfo.rb', line 100

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