13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/lh2gh/cli.rb', line 13
def migrate
Lighthouse.account = options[:lh_account]
Lighthouse.token = options[:lh_token]
project = Lighthouse::Project.find :first
tickets = Lighthouse::Ticket.find :all, :params => { :project_id => project.id }
repo_user, repo_name = options[:gh_repository].split '/'
authenticated do
repo = Octopi::Repository.find :name => repo_name, :user => repo_user
tickets.each do |ticket|
new_body = "Imported from lighthouse. Original ticket at: #{ticket.url}. Created by #{ticket.creator_name} - #{ticket.created_at}\n\n#{ticket.original_body}"
params = {:title => ticket.title, :body => new_body}
issue = Octopi::Issue.open :repo => repo, :params => params
ticket.tags.each { |tag| issue.add_label URI.escape(tag) }
issue.add_label ticket.state
issue.close! if ticket.closed
if ticket.respond_to? :versions
= ticket.versions
.shift
.each do ||
next if .body.blank?
issue. "Imported from Lighthouse. Comment by #{.user_name} - #{.created_at}\n\n#{.body}"
end
end
end
end
end
|