This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -w | |
require 'pathname' | |
require 'fileutils' | |
unless ARGV.size == 2 | |
abort 'Usage: ruby music.rb google_folder_route new_folder' | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prepare_files | |
unless File.exists?('original') && File.file?('original') && File.readable?('original') | |
abort('There is not `original` file in current directory.') | |
end | |
File.delete('yaml') if File.exists?('yaml') | |
[File.open('original'), File.new('yaml', 'w+')] | |
end | |
def translate_to_yml(original, yaml) | |
original.each_line do |line| |