18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/sas2yaml/process_sas.rb', line 18
def run
dir = 'ddls'
FileUtils.mkdir(dir) unless File.exist?(dir)
Dir.glob("sas/*").each do |sas_file|
puts "=" * 90
puts sas_file
puts "=" * 90
processed_sas = SasProcessor.new(sas_file).lines.join("\n")
sassy = Sassifier.new(processed_sas)
puts "NUM COLUMNS: #{sassy.hash.keys.length}"
file = File.join(dir, sas_file.gsub(/.+\//, '').gsub(/\..+$/, '.yml'))
File.open(file, 'w') { |f| f.puts sassy.hash.to_yaml }
File.write(File.join(Dir.tmpdir, File.basename(file, '.*') + '.sassy'), processed_sas)
end
end
|