tractive 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/README.adoc +5 -0
- data/db/trac-test.db +0 -0
- data/exe/tractive +2 -0
- data/lib/tractive/migrator/converter/trac_to_github.rb +13 -1
- data/lib/tractive/migrator/engine.rb +1 -1
- data/lib/tractive/models/ticket.rb +12 -8
- data/lib/tractive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ebcddc1621be979b25f4041cc4eac2429e6a6a08b05611154c230d49d9de86c
|
4
|
+
data.tar.gz: f61bd5af4741266ae56d81c277c7aaec723a49358f81dcb6eebdc3dbaae2e37c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b29d97cc67c43cc4d9ee72d88563e01dc6d7cdc7b988ed3b987c73a3cbc9a2fc8746597c3d3b1e175ebca83073fd6e4b19f8b51f60c9792849893a6816483f5d
|
7
|
+
data.tar.gz: d07192c1b845a3a4ca266e881ead6a7583ba5575313d68372ffa9df6785c0f4e8856be09cafdf736bb279e5e651a4d3eb1e6f294b0754b0dd4c3a5dfded9ac03
|
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -682,6 +682,7 @@ The following options are allowed (at least one necessary):
|
|
682
682
|
* `column-name`
|
683
683
|
* `operator`
|
684
684
|
* `column-value`
|
685
|
+
* `include-null`
|
685
686
|
|
686
687
|
| Boolean
|
687
688
|
|
@@ -697,6 +698,10 @@ The following options are allowed (at least one necessary):
|
|
697
698
|
| Value of the column to filter.
|
698
699
|
| String
|
699
700
|
|
701
|
+
| `--include-null`
|
702
|
+
| Include rows having null value in filtered column.
|
703
|
+
| Boolean
|
704
|
+
|
700
705
|
| `-h`, `help`
|
701
706
|
| Display the Tractive help message, or you can provide a command to know more
|
702
707
|
about a single command via `tractive help {command}`.
|
data/db/trac-test.db
CHANGED
Binary file
|
data/exe/tractive
CHANGED
@@ -30,6 +30,8 @@ class TractiveCommand < Thor
|
|
30
30
|
desc: "Operator for filter."
|
31
31
|
method_option "columnvalue", type: :string, aliases: ["--column-value"],
|
32
32
|
desc: "Value of the column to filter."
|
33
|
+
method_option "includenull", type: :boolean, aliases: ["--include-null"],
|
34
|
+
desc: "Flag for including null values in the filter result."
|
33
35
|
|
34
36
|
method_option "importfromfile", type: :string, aliases: ["-I", "--import-from-file"],
|
35
37
|
desc: "Import issues from a json file"
|
@@ -16,6 +16,7 @@ module Migrator
|
|
16
16
|
@client = GithubApi::Client.new(access_token: args[:cfg]["github"]["token"])
|
17
17
|
@wiki_attachments_url = args[:cfg]["trac"]["wiki_attachments_url"]
|
18
18
|
@revmap_file_path = args[:opts][:revmapfile] || args[:cfg]["revmap_path"]
|
19
|
+
@attachment_options = { hashed: args[:cfg].dig("attachments", "hashed") }
|
19
20
|
|
20
21
|
load_milestone_map
|
21
22
|
create_labels_on_github(@labels_cfg["severity"].values)
|
@@ -287,7 +288,7 @@ module Migrator
|
|
287
288
|
name = meta[:filename]
|
288
289
|
body = meta[:description]
|
289
290
|
if @attachurl
|
290
|
-
url = @uri_parser.escape("#{@attachurl}/#{meta[:id]
|
291
|
+
url = @uri_parser.escape("#{@attachurl}/#{attachment_path(meta[:id], name, @attachment_options)}")
|
291
292
|
text += "[`#{name}`](#{url})"
|
292
293
|
body += "\n" if [".png", ".jpg", ".gif"].include? File.extname(name).downcase
|
293
294
|
else
|
@@ -339,6 +340,17 @@ module Migrator
|
|
339
340
|
|
340
341
|
"[trac:#{ticket[:id]}](#{@tracticketbaseurl}/#{ticket[:id]})"
|
341
342
|
end
|
343
|
+
|
344
|
+
def attachment_path(id, filename, options = {})
|
345
|
+
return "#{id}/#{filename}" unless options[:hashed]
|
346
|
+
|
347
|
+
folder_name = Digest::SHA1.hexdigest(id)
|
348
|
+
parent_folder_name = folder_name[0..2]
|
349
|
+
hashed_filename = Digest::SHA1.hexdigest(filename)
|
350
|
+
file_extension = File.extname(filename)
|
351
|
+
|
352
|
+
"#{parent_folder_name}/#{folder_name}/#{hashed_filename}#{file_extension}"
|
353
|
+
end
|
342
354
|
end
|
343
355
|
end
|
344
356
|
end
|
@@ -27,7 +27,7 @@ module Migrator
|
|
27
27
|
input_file_name = args[:opts][:importfromfile]
|
28
28
|
|
29
29
|
@filter_applied = args[:opts][:filter]
|
30
|
-
@filter_options = { column_name: args[:opts][:columnname], operator: args[:opts][:operator], column_value: args[:opts][:columnvalue] }
|
30
|
+
@filter_options = { column_name: args[:opts][:columnname], operator: args[:opts][:operator], column_value: args[:opts][:columnvalue], include_null: args[:opts][:includenull] }
|
31
31
|
|
32
32
|
@trac = Tractive::Trac.new(db)
|
33
33
|
@repo = github["repo"]
|
@@ -19,14 +19,18 @@ module Tractive
|
|
19
19
|
def filter_column(options)
|
20
20
|
return self if options.nil? || options.values.compact.empty?
|
21
21
|
|
22
|
-
case options[:operator].downcase
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
query = case options[:operator].downcase
|
23
|
+
when "like"
|
24
|
+
Sequel.like(options[:column_name].to_sym, options[:column_value])
|
25
|
+
when "not like"
|
26
|
+
~Sequel.like(options[:column_name].to_sym, options[:column_value])
|
27
|
+
else
|
28
|
+
Sequel.lit("#{options[:column_name]} #{options[:operator]} '#{options[:column_value]}'")
|
29
|
+
end
|
30
|
+
|
31
|
+
query = Sequel.|(query, { options[:column_name].to_sym => nil }) if options[:include_null]
|
32
|
+
|
33
|
+
where { query }
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
data/lib/tractive/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|