Last active
February 16, 2016 18:11
-
-
Save mose/2502cac5a0ae34e79684 to your computer and use it in GitHub Desktop.
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
require 'json' | |
file = ARGV[0] | |
unless file | |
puts "Usage: ruby #{$0} <json filename of the export>" | |
exit | |
end | |
unless File.exist? file | |
puts "File #{file} not found." | |
exit | |
end | |
content = JSON.parse(File.read(file)) | |
lists = content['lists'].reduce({}) do |a, c| | |
a[c['id']] = c['name'] | |
a | |
end | |
parsed = content['cards'].reduce('') do |a, c| | |
labels = c['labels'].reduce([]) do |x, l| | |
x << l['name'] | |
x | |
end | |
a << "\"#{lists[c['idList']]}\";\"#{c['name']}\";\"#{labels.join(', ')}\"\n" | |
a | |
end | |
puts "\"Month\";\"Topic\";\"Labels\"\n" | |
puts parsed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment