Skip to content

Instantly share code, notes, and snippets.

@mironov
Created May 15, 2013 19:03
Show Gist options
  • Save mironov/5586428 to your computer and use it in GitHub Desktop.
Save mironov/5586428 to your computer and use it in GitHub Desktop.
Import tasks from trello to kanbanery
require "json"
require "csv"
json = File.read("qa.json")
parsed_json = JSON.parse(json)
lists = {}
parsed_json["lists"].each do |list|
lists[list["id"]] = list["name"]
end
tasks = []
parsed_json["cards"].each do |card|
next if card["closed"]
title = card["name"]
type = "Feature"
description = card["url"]
description += "\n\n" + card["desc"] if card["desc"].to_s != ""
column = case lists[card["idList"]]
when "Icebox"
"Icebox"
when "Analysis"
"Analysis"
when "Development: To Do"
"To Do"
when "Development: Wait", "Development: In Progress"
"Programming"
when "Done"
"Done"
end
creator = "[email protected]"
tasks << [title, type, nil, nil, description, column, creator].to_csv
end
File.open("qa.csv", "w") do |file|
file.write tasks.reverse.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment