#!/usr/bin/env ruby # resolve bin path, ignoring symlinks require "pathname" bin_file = Pathname.new(__FILE__).realpath # add self to libpath $:.unshift File.expand_path("../../lib", bin_file) # Fixes https://github.com/rubygems/rubygems/issues/1420 require "rubygems/specification" class Gem::Specification def this self end end require "structured_csv/csv2yaml" csvfile = ARGV.pop raise "first argument must be a .csv file!" unless /\.csv$/.match?(csvfile) outfile = csvfile.gsub(/csv$/, "yaml") IO.write( outfile, StructuredCsv::CsvTo2Yaml.convert(csvfile).to_yaml, ) # pp Csv2Yaml.convert(filename)