Skip to content

Instantly share code, notes, and snippets.

@cblunt
Created February 8, 2013 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cblunt/4738897 to your computer and use it in GitHub Desktop.
Save cblunt/4738897 to your computer and use it in GitHub Desktop.
A simple Ruby script to bulk import a list of tickets into CodeBase (http://codebasehq.com). Depends on the codebase_api gem.
require 'rubygems'
# 1. Without Bundler
# $ gem install activesupport codebase_api
require 'active_support/core_ext/string'
require 'codebase_api'
# 2. With a Bundler Gemfile:
# # ./Gemfile
# gem 'codebase_api'
# gem 'active_support', :require => 'active_support/core_ext/string'
#
# $ bundle install
# require 'bundler'
# Bundler.require
CodebaseApi.account_user = "your_codebase_account_name/your_codebase_username"
CodebaseApi.api_key = "your_codebase_api_key"
tickets = [
"Array of tickets",
"To be imported into",
"Your project"
# ...
]
tickets.each do |msg|
title = msg.truncate(100) # Just use the first 100 chars as the ticket title.
CodebaseApi::Ticket.create("your_project_permalink_name", title, msg)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment