ruby - Good Way to Handle Many Different Files? -
i'm building specialized pipeline, , basically, every step in pipeline involves taking 1 file input , creating different file output. not files in same directory, output files of different format, , because i'm using several different programs, different actions have taken appease different programs.
this has led complicated file management in code, , more try organize file directories, more ugly it's getting. every class involves sort of code following:
@filename = file.basename(file) @datapath = "#{$path}/../data/" mzmltoother.new("mgf", "#{@datapath}/spectra/#{@filename}.mzml", 1, false).convert system("wine readw.exe --mzxml #{@file}.raw #{$path}../data/spectra/#{file.basename(@file + ".raw", ".raw")}.mzxml 2>/dev/null") filename = "#{$path}../data/" + parts[0] + parts[1][6..parts[1].length-1].chomp(".pep.xml")
is there sort of design pattern, or ruby gem, or clean up? writing clean code, starting bother me.
you use makefile.
make essential dsl designed handling converting 1 type of file type via running external program. added bonus, handle performing steps necessary incrementally update output if set of source files change.
if want use ruby, try rakefile. rake this, , it's still ruby.
Comments
Post a Comment