tractive 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07fb75035716d30de8f58206ad93cd0b932d74807646d5577d519d848eb2bfa0
4
- data.tar.gz: c4e50252da3aaf67b919041cdc682e8559abb28163dd847671d30c91808d15e0
3
+ metadata.gz: 6b9a604e9dd1c9d05edc6ebb71730d1c1660c7f5fc478a99ce87597fe48b567e
4
+ data.tar.gz: 6c70e06cd214b9b97d3ec17878774b5417ee3108f95b1ec09642179ca88c5c4a
5
5
  SHA512:
6
- metadata.gz: efc63d0e9e8b08d3780cccd3877554c7a1df4408cd8db3c5bcf4fd11634eab73ac7f29fa300fb9191e77a892ba5d795c80e0d1a5a97283e6c541370372ef5725
7
- data.tar.gz: b1dc726435943c2b0cf70f369c21ffd049d07e13147a5d88f162dc725fb1ad7d62a8a034b2adb05903cc9e393dd421497af457fbaf2ad8cf45684b783b63b5ba
6
+ metadata.gz: 67728d36b54a32045c49a69c873c49a63a87ac6242260f3eefe09c1511b88919af579fcffd4bc08919825606f99cbcdd12284f3c5d3b347adaf8226c6c770f57
7
+ data.tar.gz: 0caa7b60a2620eca00de262cd0d122cfab88a9fe6737800c7a281d9d36dfb0b02368722608cf130fe9c6faf8caf579bc96db111c130866df7fade690f8504bb4
@@ -281,7 +281,7 @@ module Migrator
281
281
  # text += "created the issue\n\n"
282
282
  if body && !body.lstrip.empty?
283
283
  # text += "\n___\n" if not append
284
- text += @twf_to_markdown.convert(body)
284
+ text += @twf_to_markdown.convert(body, id: meta[:ticket])
285
285
  end
286
286
 
287
287
  when "comment"
@@ -295,7 +295,7 @@ module Migrator
295
295
  end
296
296
 
297
297
  text += "\n___\n" unless append
298
- text += @twf_to_markdown.convert(body) if body
298
+ text += @twf_to_markdown.convert(body, id: meta[:ticket]) if body
299
299
 
300
300
  when "attachment"
301
301
  text += "_uploaded file "
@@ -16,11 +16,11 @@ module Migrator
16
16
 
17
17
  @git_repo = options[:git_repo]
18
18
  @home_page_name = options[:home_page_name]
19
- @wiki_extensions = options[:wiki_extensions] # || [".py", "changelog", "expire-ids"]
20
- @source_folders = options[:source_folders] # || %w[personal attic sprint branch/hawk]
19
+ @wiki_extensions = options[:wiki_extensions]
20
+ @source_folders = options[:source_folders]
21
21
  end
22
22
 
23
- def convert(str)
23
+ def convert(str, image_options = {})
24
24
  # Fix 'Windows EOL' to 'Linux EOL'
25
25
  str.gsub!("\r\n", "\n")
26
26
 
@@ -33,7 +33,7 @@ module Migrator
33
33
  convert_links(str, @git_repo)
34
34
  convert_font_styles(str)
35
35
  convert_changeset(str, @changeset_base_url)
36
- convert_image(str, @base_url, @attach_url, @wiki_attachments_url)
36
+ convert_image(str, @base_url, @attach_url, @wiki_attachments_url, image_options)
37
37
  convert_ticket(str, @base_url)
38
38
  revert_intermediate_references(str)
39
39
 
@@ -247,13 +247,13 @@ module Migrator
247
247
  def file?(trac_path)
248
248
  return false unless trac_path
249
249
 
250
- @wiki_extensions.any? { |extension| trac_path.end_with?(extension) }
250
+ @wiki_extensions&.any? { |extension| trac_path.end_with?(extension) }
251
251
  end
252
252
 
253
253
  def wiki_path(path, line_number = "")
254
254
  # TODO: This will not work for folders given in the source_folder parameter and
255
255
  # will not work for subfolders paths like `personal/rjs` unless given in the parameters.
256
- return "branches/all?query=#{path}" if @source_folders.any? { |folder| folder == path }
256
+ return "branches/all?query=#{path}" if @source_folders&.any? { |folder| folder == path }
257
257
  return index_paths[path] if index_paths[path]
258
258
 
259
259
  prefix = if file?(path)
@@ -294,7 +294,7 @@ module Migrator
294
294
  "[#{wiki_name}](https://github.com/#{git_repo}/wiki/#{wiki_name})"
295
295
  end
296
296
 
297
- def convert_image(str, base_url, attach_url, wiki_attachments_url)
297
+ def convert_image(str, base_url, attach_url, wiki_attachments_url, options = {})
298
298
  # https://trac.edgewall.org/wiki/WikiFormatting#Images
299
299
  # [[Image(picture.gif)]] Current page (Ticket, Wiki, Comment)
300
300
  # [[Image(wiki:WikiFormatting:picture.gif)]] (referring to attachment on another page)
@@ -316,7 +316,15 @@ module Migrator
316
316
  # [[Image(http://example.org/s.jpg)]]
317
317
  "!{{#{path}}}(#{path})"
318
318
  else
319
- _, id, file = path.split(":")
319
+ tmp = path.split(":")
320
+ id, file = case tmp.size
321
+ when 3
322
+ [tmp[1], tmp[2]]
323
+ when 2
324
+ tmp
325
+ else
326
+ [options[:id].to_s, tmp[0]]
327
+ end
320
328
  file_path = "#{attach_url}/#{Tractive::Utilities.attachment_path(id, file, hashed: @attach_hashed)}"
321
329
  "!{{#{path}}}(#{file_path})"
322
330
  end
@@ -63,7 +63,7 @@ module Migrator
63
63
  $logger.info("Working with file [#{file_name}]")
64
64
  $logger.debug("Object: #{wiki}")
65
65
 
66
- wiki_markdown_text = @twf_to_markdown.convert(wiki[:text])
66
+ wiki_markdown_text = @twf_to_markdown.convert(wiki[:text], id: wiki[:name])
67
67
  wiki_markdown_text += wiki_attachments(wiki)
68
68
 
69
69
  # Create file with content
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tractive
4
- VERSION = "1.0.12"
4
+ VERSION = "1.0.13"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tractive
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-04 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2