diff options
author | Valery Sizov <valery@gitlab.com> | 2015-02-02 17:01:07 -0800 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-02-05 12:50:34 -0800 |
commit | 33349dd54928a0b074b4ae3ebfabf214799fc085 (patch) | |
tree | 593a14d0f6df812410349f353e252e3a58d8cacd /lib/gitlab/gitlab_import/importer.rb | |
parent | 713bc152bde5396bb95a1555907bcd9a2847839d (diff) | |
download | gitlab-ce-33349dd54928a0b074b4ae3ebfabf214799fc085.tar.gz |
GitLab.com integration: refactoring
Diffstat (limited to 'lib/gitlab/gitlab_import/importer.rb')
-rw-r--r-- | lib/gitlab/gitlab_import/importer.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/gitlab_import/importer.rb b/lib/gitlab/gitlab_import/importer.rb index 3e9087a556c..a529483c1e2 100644 --- a/lib/gitlab/gitlab_import/importer.rb +++ b/lib/gitlab/gitlab_import/importer.rb @@ -6,6 +6,7 @@ module Gitlab def initialize(project) @project = project @client = Client.new(project.creator.gitlab_access_token) + @formatter = Gitlab::ImportFormatter.new end def execute @@ -15,15 +16,16 @@ module Gitlab issues = client.issues(project_identifier) issues.each do |issue| - body = "*Created by: #{issue["author"]["name"]}*\n\n#{issue["description"]}" - + body = @formatter.author_line(issue["author"]["name"], issue["description"]) comments = client.issue_comments(project_identifier, issue["id"]) + if comments.any? - body += "\n\n\n**Imported comments:**\n" + body += @formatter.comments_header end + comments.each do |comment| - body += "\n\n*By #{comment["author"]["name"]} on #{comment["created_at"]}*\n\n#{comment["body"]}" + body += @formatter.comment_to_md(comment["author"]["name"], comment["created_at"], comment["body"]) end project.issues.create!( |