lib/tractive/migrator/wikis/migrate_from_db.rb in tractive-1.0.11 vs lib/tractive/migrator/wikis/migrate_from_db.rb in tractive-1.0.12

- old
+ new

@@ -11,24 +11,39 @@ @config = args[:cfg] @options = args[:opts] @authors_map = @config["users"].to_h @tracticketbaseurl = @config["trac"]["ticketbaseurl"] + @git_repo = @config["github"]["repo"] @changeset_base_url = @config["trac"]["changeset_base_url"] || "" - @wiki_attachments_url = @options["attachment-base-url"] || @config.dig("wiki", "attachments", "url") || "" - @repo_path = @options["repo-path"] || "" @revmap_path = @config["revmap_path"] @attachments_hashed = @config.dig("wiki", "attachments", "hashed") + @wiki_attachments_url = @options["attachment-base-url"] || @config.dig("wiki", "attachments", "url") || "" + @repo_path = @options["repo-path"] || "" + @home_page_name = @options["home-page-name"] + @wiki_extensions = @options["wiki-extensions"] + @source_folders = @options["source-folders"] + @attachment_options = { hashed: @attachments_hashed } verify_options verify_locations - @twf_to_markdown = Migrator::Converter::TwfToMarkdown.new(@tracticketbaseurl, @attachment_options, @changeset_base_url, @wiki_attachments_url, @revmap_path) + @twf_to_markdown = Migrator::Converter::TwfToMarkdown.new( + @tracticketbaseurl, + @attachment_options, + @changeset_base_url, + @wiki_attachments_url, + @revmap_path, + git_repo: @git_repo, + home_page_name: @home_page_name, + wiki_extensions: @wiki_extensions, + source_folders: @source_folders + ) end def migrate_wikis $logger.info("Processing the wiki...") @@ -41,11 +56,12 @@ "Initial load of version #{wiki[:version]} of trac-file #{wiki[:name]}" else wiki[:comment].gsub('"', '\"') end - file_name = "#{cleanse_filename(wiki[:name])}.md" + file_name = filename_for_wiki(wiki) + $logger.info("Working with file [#{file_name}]") $logger.debug("Object: #{wiki}") wiki_markdown_text = @twf_to_markdown.convert(wiki[:text]) wiki_markdown_text += wiki_attachments(wiki) @@ -72,9 +88,15 @@ end end end private + + def filename_for_wiki(wiki) + return "Home.md" if @home_page_name == wiki[:name] + + "#{cleanse_filename(wiki[:name])}.md" + end def verify_options $logger.info("Verifying options...") missing_options = []