tractive 1.0.3 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +3 -0
- data/README.adoc +50 -14
- data/config.example.yaml +31 -7
- data/lib/tractive/github_api/client/labels.rb +33 -0
- data/lib/tractive/github_api/client.rb +2 -0
- data/lib/tractive/info.rb +4 -4
- data/lib/tractive/main.rb +1 -3
- data/lib/tractive/migrator/converter/trac_to_github.rb +48 -11
- data/lib/tractive/migrator/converter/twf_to_markdown.rb +24 -4
- data/lib/tractive/migrator/engine.rb +2 -2
- data/lib/tractive/models/ticket.rb +4 -1
- data/lib/tractive/utilities.rb +9 -7
- data/lib/tractive/version.rb +1 -1
- data/tractive.gemspec +1 -0
- metadata +4 -3
- data/Gemfile.lock +0 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55fc3cea20d6e9afb060ab67f70582da9e5940a58b8b5c3a2e8e52612a2f3c8b
|
4
|
+
data.tar.gz: 6b86875665351d16687fdc2c12dfca715fb7ec340c2d4d2e7f9fc98ecd7df460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f584eaf4348c98152368e9dfbd38090b136e52ac334f1755f5fda6b944a374775ef97acab214aa87a8a2228f86a1363e8a7230e6851760517a40449f3424572
|
7
|
+
data.tar.gz: 8fe4530ec8f978e9742c9f7e6f1b06c1b2ea17efc6a25f4c9db497dffb26733b267b6e4a2d3b079f99ea7b7af9e3b39e4c55bc58c7ca763b1e28cbbbcac9560c
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
@@ -297,6 +297,8 @@ trac:
|
|
297
297
|
ticketbaseurl: https://example.org/trac/foobar/ticket
|
298
298
|
----
|
299
299
|
|
300
|
+
`ticketbaseurl:`::: The Trac Url which will be added in Github issues. A link will be added in the footer of Github issue to link it to Trac ticket.
|
301
|
+
|
300
302
|
[[config-github]]
|
301
303
|
==== GitHub configuration
|
302
304
|
|
@@ -385,25 +387,55 @@ The pattern of a mapping is like:
|
|
385
387
|
+
|
386
388
|
[source,yaml]
|
387
389
|
----
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
390
|
+
trivial:
|
391
|
+
name: trivial
|
392
|
+
color: ff0000
|
393
|
+
major:
|
394
|
+
name: major
|
395
|
+
color: b44647
|
396
|
+
minor:
|
397
|
+
name: minor
|
398
|
+
color: f7347a
|
399
|
+
medium:
|
400
|
+
name: medium
|
401
|
+
color: f3c77c
|
396
402
|
----
|
397
403
|
|
398
404
|
`priority:`::: Priority of the Trac ticket.
|
399
405
|
+
|
400
406
|
[source,yaml]
|
401
407
|
----
|
402
|
-
Low:
|
403
|
-
|
408
|
+
Low:
|
409
|
+
name: low
|
410
|
+
color: 22dd00
|
411
|
+
High:
|
412
|
+
name: high
|
413
|
+
color: ff0000
|
404
414
|
----
|
405
415
|
|
406
416
|
|
417
|
+
`tracstate:`::: Status of the Trac ticket.
|
418
|
+
+
|
419
|
+
[source,yaml]
|
420
|
+
----
|
421
|
+
accepted:
|
422
|
+
name: accepted
|
423
|
+
color: 22dd00
|
424
|
+
assigned:
|
425
|
+
name: assigned
|
426
|
+
color: aadd88
|
427
|
+
closed:
|
428
|
+
name: closed
|
429
|
+
color: ee00aa
|
430
|
+
new:
|
431
|
+
name: new
|
432
|
+
color:
|
433
|
+
----
|
434
|
+
|
435
|
+
|
436
|
+
NOTE: As `severity`, `priority` and `tracstate` are converted into `labels` on github so there is an option to specify the `color` for those labels.
|
437
|
+
|
438
|
+
|
407
439
|
==== User mapping
|
408
440
|
|
409
441
|
`users:`:: a one-to-one mapping between Trac usernames or email addresses to
|
@@ -412,7 +444,8 @@ GitHub usernames for users, in the following pattern:
|
|
412
444
|
[source,yaml]
|
413
445
|
----
|
414
446
|
users:
|
415
|
-
|
447
|
+
{Trac email or username}:
|
448
|
+
email: {Github email}
|
416
449
|
name: {name of the person}
|
417
450
|
username: {username on GitHub}
|
418
451
|
...
|
@@ -423,10 +456,12 @@ EXAMPLE:
|
|
423
456
|
[source,yaml]
|
424
457
|
----
|
425
458
|
users:
|
426
|
-
|
459
|
+
matthew@gmail.org:
|
460
|
+
email: matthew@example.org
|
427
461
|
name: Matthew
|
428
462
|
username: example-matt
|
429
|
-
|
463
|
+
valencia:
|
464
|
+
email: valencia
|
430
465
|
name: Valencia
|
431
466
|
username: example-vale
|
432
467
|
----
|
@@ -434,7 +469,8 @@ users:
|
|
434
469
|
If you don't want to map a user, you can just leave the `username` empty like below:
|
435
470
|
----
|
436
471
|
users:
|
437
|
-
|
472
|
+
matthew@gmail.org:
|
473
|
+
email: matthew@example.org
|
438
474
|
name: Matthew
|
439
475
|
username:
|
440
476
|
----
|
data/config.example.yaml
CHANGED
@@ -54,14 +54,38 @@ labels:
|
|
54
54
|
|
55
55
|
# less useful, but also possible:
|
56
56
|
priority:
|
57
|
-
Low:
|
58
|
-
|
57
|
+
Low:
|
58
|
+
name: low
|
59
|
+
color: 22dd00
|
60
|
+
High:
|
61
|
+
name: high
|
62
|
+
color: ff0000
|
59
63
|
severity:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
64
|
+
trivial:
|
65
|
+
name: trivial
|
66
|
+
color: ff0000
|
67
|
+
major:
|
68
|
+
name: major
|
69
|
+
color: b44647
|
70
|
+
minor:
|
71
|
+
name: minor
|
72
|
+
color: f7347a
|
73
|
+
medium:
|
74
|
+
name: medium
|
75
|
+
color: f3c77c
|
76
|
+
tracstate:
|
77
|
+
accepted:
|
78
|
+
name: accepted
|
79
|
+
color: 22dd00
|
80
|
+
assigned:
|
81
|
+
name: assigned
|
82
|
+
color: aadd88
|
83
|
+
closed:
|
84
|
+
name: closed
|
85
|
+
color: ee00aa
|
86
|
+
new:
|
87
|
+
name: new
|
88
|
+
color:
|
65
89
|
version:
|
66
90
|
'1.3': v1.3
|
67
91
|
'1.4': v1.4
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GithubApi
|
4
|
+
class Client
|
5
|
+
module Labels
|
6
|
+
def list_labels(repo, params = {})
|
7
|
+
JSON.parse(
|
8
|
+
RestClient.get(
|
9
|
+
"https://api.github.com/repos/#{repo}/labels",
|
10
|
+
{
|
11
|
+
"Authorization" => "token #{@token}",
|
12
|
+
params: params
|
13
|
+
}
|
14
|
+
)
|
15
|
+
)
|
16
|
+
end
|
17
|
+
alias labels list_labels
|
18
|
+
|
19
|
+
def create_label(repo, params)
|
20
|
+
JSON.parse(
|
21
|
+
RestClient.post(
|
22
|
+
"https://api.github.com/repos/#{repo}/labels",
|
23
|
+
params.to_json,
|
24
|
+
{
|
25
|
+
"Authorization" => "token #{@token}",
|
26
|
+
"Accept" => "application/vnd.github.v3+json"
|
27
|
+
}
|
28
|
+
)
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "client/issues"
|
4
|
+
require_relative "client/labels"
|
4
5
|
require_relative "client/milestones"
|
5
6
|
|
6
7
|
# Service to perform github actions
|
7
8
|
module GithubApi
|
8
9
|
class Client
|
9
10
|
include GithubApi::Client::Issues
|
11
|
+
include GithubApi::Client::Labels
|
10
12
|
include GithubApi::Client::Milestones
|
11
13
|
|
12
14
|
def initialize(options = {})
|
data/lib/tractive/info.rb
CHANGED
@@ -34,11 +34,11 @@ module Tractive
|
|
34
34
|
"milestones" => milestones,
|
35
35
|
"labels" => {
|
36
36
|
"type" => Utilities.make_hash("type_", types),
|
37
|
-
"component" => Utilities.make_hash("component_", components),
|
38
37
|
"resolution" => Utilities.make_hash("resolution_", resolutions),
|
39
|
-
"
|
40
|
-
"
|
41
|
-
"
|
38
|
+
"component" => Utilities.make_each_hash(components, %w[name color], "component: "),
|
39
|
+
"severity" => Utilities.make_each_hash(severity, %w[name color]),
|
40
|
+
"priority" => Utilities.make_each_hash(priorities, %w[name color]),
|
41
|
+
"tracstate" => Utilities.make_each_hash(tracstates, %w[name color])
|
42
42
|
}
|
43
43
|
}
|
44
44
|
end
|
data/lib/tractive/main.rb
CHANGED
@@ -8,9 +8,7 @@ module Tractive
|
|
8
8
|
@opts = opts
|
9
9
|
@cfg = YAML.load_file(@opts[:config])
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
Tractive::Utilities.setup_logger(output_stream: @opts[:log_file] || $stderr, verbose: @opts[:verbose])
|
11
|
+
Tractive::Utilities.setup_logger(output_stream: @opts[:logfile] || $stderr, verbose: @opts[:verbose])
|
14
12
|
@db = Tractive::Utilities.setup_db!(@cfg["trac"]["database"])
|
15
13
|
rescue Sequel::DatabaseConnectionError, Sequel::AdapterNotFound, URI::InvalidURIError, Sequel::DatabaseError => e
|
16
14
|
$logger.error e.message
|
@@ -6,7 +6,7 @@ module Migrator
|
|
6
6
|
def initialize(args)
|
7
7
|
@tracticketbaseurl = args[:cfg]["trac"]["ticketbaseurl"]
|
8
8
|
@attachurl = args[:opts][:attachurl] || args[:cfg].dig("attachments", "url")
|
9
|
-
@changeset_base_url = args[:cfg]["trac"]["changeset_base_url"]
|
9
|
+
@changeset_base_url = args[:cfg]["trac"]["changeset_base_url"] || ""
|
10
10
|
@singlepost = args[:opts][:singlepost]
|
11
11
|
@labels_cfg = args[:cfg]["labels"].transform_values(&:to_h)
|
12
12
|
@milestonesfromtrac = args[:cfg]["milestones"]
|
@@ -15,11 +15,16 @@ module Migrator
|
|
15
15
|
@repo = args[:cfg]["github"]["repo"]
|
16
16
|
@client = GithubApi::Client.new(access_token: args[:cfg]["github"]["token"])
|
17
17
|
@wiki_attachments_url = args[:cfg]["trac"]["wiki_attachments_url"]
|
18
|
+
@revmap_file_path = args[:opts][:revmapfile] || args[:cfg]["revmap_path"]
|
18
19
|
|
19
20
|
load_milestone_map
|
21
|
+
create_labels_on_github(@labels_cfg["severity"].values)
|
22
|
+
create_labels_on_github(@labels_cfg["priority"].values)
|
23
|
+
create_labels_on_github(@labels_cfg["tracstate"].values)
|
24
|
+
create_labels_on_github(@labels_cfg["component"].values)
|
20
25
|
|
21
26
|
@uri_parser = URI::Parser.new
|
22
|
-
@twf_to_markdown = Migrator::Converter::TwfToMarkdown.new(@tracticketbaseurl, @attachurl, @changeset_base_url, @wiki_attachments_url)
|
27
|
+
@twf_to_markdown = Migrator::Converter::TwfToMarkdown.new(@tracticketbaseurl, @attachurl, @changeset_base_url, @wiki_attachments_url, @revmap_file_path)
|
23
28
|
end
|
24
29
|
|
25
30
|
def compose(ticket)
|
@@ -74,7 +79,6 @@ module Migrator
|
|
74
79
|
|
75
80
|
badges = Set[]
|
76
81
|
|
77
|
-
badges.add(@labels_cfg.fetch("component", {})[ticket[:component]])
|
78
82
|
badges.add(@labels_cfg.fetch("type", {})[ticket[:type]])
|
79
83
|
badges.add(@labels_cfg.fetch("resolution", {})[ticket[:resolution]])
|
80
84
|
badges.add(@labels_cfg.fetch("version", {})[ticket[:version]])
|
@@ -82,6 +86,8 @@ module Migrator
|
|
82
86
|
labels.add(@labels_cfg.fetch("severity", {})[ticket[:severity]])
|
83
87
|
labels.add(@labels_cfg.fetch("priority", {})[ticket[:priority]])
|
84
88
|
labels.add(@labels_cfg.fetch("tracstate", {})[ticket[:status]])
|
89
|
+
labels.add(@labels_cfg.fetch("component", {})[ticket[:component]])
|
90
|
+
|
85
91
|
labels.delete(nil)
|
86
92
|
|
87
93
|
keywords = ticket[:keywords]
|
@@ -97,7 +103,7 @@ module Migrator
|
|
97
103
|
milestone = @milestonemap[ticket[:milestone]]
|
98
104
|
|
99
105
|
# compute footer
|
100
|
-
footer = "_Issue migrated from
|
106
|
+
footer = "_Issue migrated from #{trac_ticket_link(ticket)} at #{Time.now}_"
|
101
107
|
|
102
108
|
# compute badgetabe
|
103
109
|
#
|
@@ -116,7 +122,8 @@ module Migrator
|
|
116
122
|
# compose body
|
117
123
|
body = [badgetable, body, footer].join("\n\n___\n")
|
118
124
|
|
119
|
-
labels.add("owner:#{github_assignee}")
|
125
|
+
labels.add("name" => "owner:#{github_assignee}") unless github_assignee.nil? || github_assignee.empty?
|
126
|
+
labels = labels.map { |label| label["name"] }
|
120
127
|
|
121
128
|
issue = {
|
122
129
|
"title" => ticket[:summary],
|
@@ -129,7 +136,7 @@ module Migrator
|
|
129
136
|
|
130
137
|
if @users.key?(ticket[:owner])
|
131
138
|
owner = trac_mail(ticket[:owner])
|
132
|
-
github_owner = @users[owner]
|
139
|
+
github_owner = @users[owner]["username"]
|
133
140
|
$logger.debug("..owner in trac: #{owner}")
|
134
141
|
$logger.debug("..assignee in GitHub: #{github_owner}")
|
135
142
|
issue["assignee"] = github_owner
|
@@ -155,11 +162,11 @@ module Migrator
|
|
155
162
|
private
|
156
163
|
|
157
164
|
def map_user(user)
|
158
|
-
@users[
|
165
|
+
@users.fetch(user, {})["email"] || user
|
159
166
|
end
|
160
167
|
|
161
168
|
def map_assignee(user)
|
162
|
-
@users[
|
169
|
+
@users.fetch(user, {})["email"]
|
163
170
|
end
|
164
171
|
|
165
172
|
def load_milestone_map
|
@@ -168,9 +175,9 @@ module Migrator
|
|
168
175
|
newmilestonekeys = @milestonesfromtrac.keys - @milestonemap.keys
|
169
176
|
|
170
177
|
newmilestonekeys.each do |milestonelabel|
|
171
|
-
milestone
|
178
|
+
milestone = {
|
172
179
|
"title" => milestonelabel.to_s,
|
173
|
-
"state" => @milestonesfromtrac[milestonelabel][:completed].
|
180
|
+
"state" => @milestonesfromtrac[milestonelabel][:completed].to_i.zero? ? "open" : "closed",
|
174
181
|
"description" => @milestonesfromtrac[milestonelabel][:description] || "no description in trac",
|
175
182
|
"due_on" => "2012-10-09T23:39:01Z"
|
176
183
|
}
|
@@ -194,6 +201,30 @@ module Migrator
|
|
194
201
|
nil
|
195
202
|
end
|
196
203
|
|
204
|
+
def create_labels_on_github(labels)
|
205
|
+
return if labels.nil? || labels.empty?
|
206
|
+
|
207
|
+
page = 1
|
208
|
+
existing_labels = []
|
209
|
+
result = @client.labels(@repo, per_page: 100, page: page).map { |label| label["name"] }
|
210
|
+
|
211
|
+
until result.empty?
|
212
|
+
existing_labels += result
|
213
|
+
page += 1
|
214
|
+
result = @client.labels(@repo, per_page: 100, page: page).map { |label| label["name"] }
|
215
|
+
end
|
216
|
+
|
217
|
+
new_labels = labels.reject { |label| existing_labels.include?(label["name"]&.strip) }
|
218
|
+
|
219
|
+
new_labels.each do |label|
|
220
|
+
params = { name: label["name"] }
|
221
|
+
params["color"] = label["color"] unless label["color"].nil?
|
222
|
+
|
223
|
+
@client.create_label(@repo, params)
|
224
|
+
$logger.info("Created label: #{label["name"]}")
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
197
228
|
def ticket_change(append, meta)
|
198
229
|
# kind
|
199
230
|
kind = if meta[:ticket]
|
@@ -243,7 +274,7 @@ module Migrator
|
|
243
274
|
changeset = body.match(/In \[changeset:"(\d+)/).to_a[1]
|
244
275
|
text += if changeset
|
245
276
|
# changesethash = @revmap[changeset]
|
246
|
-
"_committed #{Tractive::Utilities.map_changeset(changeset)}_"
|
277
|
+
"_committed #{Tractive::Utilities.map_changeset(changeset, @revmap, @changeset_base_url)}_"
|
247
278
|
else
|
248
279
|
"_commented_\n\n"
|
249
280
|
end
|
@@ -302,6 +333,12 @@ module Migrator
|
|
302
333
|
!(%w[keywords cc reporter version].include?(kind) ||
|
303
334
|
(kind == "comment" && (newvalue.nil? || newvalue.lstrip.empty?)))
|
304
335
|
end
|
336
|
+
|
337
|
+
def trac_ticket_link(ticket)
|
338
|
+
return "trac:#{ticket[:id]}" unless @tracticketbaseurl
|
339
|
+
|
340
|
+
"[trac:#{ticket[:id]}](#{@tracticketbaseurl}/#{ticket[:id]})"
|
341
|
+
end
|
305
342
|
end
|
306
343
|
end
|
307
344
|
end
|
@@ -4,11 +4,12 @@ module Migrator
|
|
4
4
|
module Converter
|
5
5
|
# twf => Trac wiki format
|
6
6
|
class TwfToMarkdown
|
7
|
-
def initialize(base_url, attach_url, changeset_base_url, wiki_attachments_url)
|
7
|
+
def initialize(base_url, attach_url, changeset_base_url, wiki_attachments_url, revmap_file_path)
|
8
8
|
@base_url = base_url
|
9
9
|
@attach_url = attach_url
|
10
10
|
@changeset_base_url = changeset_base_url
|
11
11
|
@wiki_attachments_url = wiki_attachments_url
|
12
|
+
@revmap = load_revmap_file(revmap_file_path)
|
12
13
|
end
|
13
14
|
|
14
15
|
def convert(str)
|
@@ -26,6 +27,24 @@ module Migrator
|
|
26
27
|
|
27
28
|
private
|
28
29
|
|
30
|
+
def load_revmap_file(revmapfile)
|
31
|
+
# load revision mapping file and convert it to a hash.
|
32
|
+
# This revmap file allows to map between SVN revisions (rXXXX)
|
33
|
+
# and git commit sha1 hashes.
|
34
|
+
revmap = nil
|
35
|
+
if revmapfile
|
36
|
+
File.open(revmapfile, "r:UTF-8") do |f|
|
37
|
+
$logger.info("loading revision map #{revmapfile}")
|
38
|
+
|
39
|
+
revmap = f.each_line
|
40
|
+
.map { |line| line.split(/\s+\|\s+/) }
|
41
|
+
.map { |rev, sha| [rev.gsub(/^r/, ""), sha] }.to_h # remove leading "r" if present
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
revmap
|
46
|
+
end
|
47
|
+
|
29
48
|
# CommitTicketReference
|
30
49
|
def convert_ticket_reference(str)
|
31
50
|
str.gsub!(/\{\{\{\n(#!CommitTicketReference .+?)\}\}\}/m, '\1')
|
@@ -72,9 +91,10 @@ module Migrator
|
|
72
91
|
str.gsub!(%r{#{Regexp.quote(changeset_base_url)}/(\d+)/?}, '[changeset:\1]') if changeset_base_url
|
73
92
|
str.gsub!(/\[changeset:"r(\d+)".*\]/, '[changeset:\1]')
|
74
93
|
str.gsub!(/\[changeset:r(\d+)\]/, '[changeset:\1]')
|
75
|
-
str.gsub!(/\br(\d+)\b/) { Tractive::Utilities.map_changeset(Regexp.last_match[1]) }
|
76
|
-
str.gsub!(/\[changeset:"(\d+)".*\]/) { Tractive::Utilities.map_changeset(Regexp.last_match[1]) }
|
77
|
-
str.gsub!(/\[changeset:
|
94
|
+
str.gsub!(/\br(\d+)\b/) { Tractive::Utilities.map_changeset(Regexp.last_match[1], @revmap, changeset_base_url) }
|
95
|
+
str.gsub!(/\[changeset:"(\d+)".*\]/) { Tractive::Utilities.map_changeset(Regexp.last_match[1], @revmap, changeset_base_url) }
|
96
|
+
str.gsub!(/\[changeset:(\d+).*\]/) { Tractive::Utilities.map_changeset(Regexp.last_match[1], @revmap, changeset_base_url) }
|
97
|
+
str.gsub!(/\[(\d+)\]/) { Tractive::Utilities.map_changeset(Regexp.last_match[1], @revmap, changeset_base_url) }
|
78
98
|
end
|
79
99
|
|
80
100
|
# Font styles
|
@@ -58,7 +58,7 @@ module Migrator
|
|
58
58
|
@dry_run = args[:opts][:dryrun]
|
59
59
|
@output_file = File.new(dry_run_output_file, "w+")
|
60
60
|
@delimiter = "{"
|
61
|
-
@revmap = load_revmap_file(args[:opts][:revmapfile] || args[:cfg]["
|
61
|
+
@revmap = load_revmap_file(args[:opts][:revmapfile] || args[:cfg]["revmap_path"])
|
62
62
|
@safetychecks = safetychecks
|
63
63
|
@start_ticket = (start_ticket || (@last_created_issue + 1)).to_i
|
64
64
|
@filter_closed = filter_closed
|
@@ -87,7 +87,7 @@ module Migrator
|
|
87
87
|
|
88
88
|
revmap = f.each_line
|
89
89
|
.map { |line| line.split(/\s+\|\s+/) }
|
90
|
-
.map { |rev, sha
|
90
|
+
.map { |rev, sha| [rev.gsub(/^r/, ""), sha] }.to_h # remove leading "r" if present
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -19,8 +19,11 @@ module Tractive
|
|
19
19
|
def filter_column(options)
|
20
20
|
return self if options.nil? || options.values.compact.empty?
|
21
21
|
|
22
|
-
|
22
|
+
case options[:operator].downcase
|
23
|
+
when "like"
|
23
24
|
where { Sequel.like(options[:column_name].to_sym, options[:column_value]) }
|
25
|
+
when "not like"
|
26
|
+
where { ~Sequel.like(options[:column_name].to_sym, options[:column_value]) }
|
24
27
|
else
|
25
28
|
where { Sequel.lit("#{options[:column_name]} #{options[:operator]} '#{options[:column_value]}'") }
|
26
29
|
end
|
data/lib/tractive/utilities.rb
CHANGED
@@ -7,11 +7,11 @@ module Tractive
|
|
7
7
|
array.map { |i| [i, "#{prefix}#{i}"] }.to_h
|
8
8
|
end
|
9
9
|
|
10
|
-
def make_each_hash(values, keys)
|
10
|
+
def make_each_hash(values, keys, prefix = "")
|
11
11
|
values.map do |value|
|
12
12
|
value = [value] unless value.is_a?(Array)
|
13
|
-
keys.zip(value).to_h
|
14
|
-
end
|
13
|
+
[value[0], keys.zip(value.map { |v| "#{prefix}#{v}" }).to_h]
|
14
|
+
end.to_h
|
15
15
|
end
|
16
16
|
|
17
17
|
def setup_db!(db_url)
|
@@ -45,11 +45,13 @@ module Tractive
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# returns the git commit hash for a specified revision (using revmap hash)
|
48
|
-
def map_changeset(str)
|
49
|
-
if
|
50
|
-
|
48
|
+
def map_changeset(str, revmap, changeset_base_url = "")
|
49
|
+
if revmap&.key?(str)
|
50
|
+
base_url = changeset_base_url
|
51
|
+
base_url += "/" if base_url[-1] && base_url[-1] != "/"
|
52
|
+
"#{base_url}#{revmap[str].strip}"
|
51
53
|
else
|
52
|
-
str
|
54
|
+
"[#{str}]"
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
data/lib/tractive/version.rb
CHANGED
data/tractive.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = "https://github.com/ietf-ribose/tractive"
|
18
18
|
spec.metadata["changelog_uri"] = "https://github.com/ietf-ribose/tractive"
|
19
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
19
20
|
|
20
21
|
# Specify which files should be added to the gem when it is released.
|
21
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
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.7
|
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-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -124,7 +124,6 @@ files:
|
|
124
124
|
- ".ruby-version"
|
125
125
|
- CODE_OF_CONDUCT.md
|
126
126
|
- Gemfile
|
127
|
-
- Gemfile.lock
|
128
127
|
- LICENSE.md
|
129
128
|
- README.adoc
|
130
129
|
- Rakefile
|
@@ -140,6 +139,7 @@ files:
|
|
140
139
|
- lib/tractive/github_api.rb
|
141
140
|
- lib/tractive/github_api/client.rb
|
142
141
|
- lib/tractive/github_api/client/issues.rb
|
142
|
+
- lib/tractive/github_api/client/labels.rb
|
143
143
|
- lib/tractive/github_api/client/milestones.rb
|
144
144
|
- lib/tractive/graceful_quit.rb
|
145
145
|
- lib/tractive/info.rb
|
@@ -170,6 +170,7 @@ metadata:
|
|
170
170
|
homepage_uri: https://github.com/ietf-ribose/tractive
|
171
171
|
source_code_uri: https://github.com/ietf-ribose/tractive
|
172
172
|
changelog_uri: https://github.com/ietf-ribose/tractive
|
173
|
+
rubygems_mfa_required: 'true'
|
173
174
|
post_install_message:
|
174
175
|
rdoc_options: []
|
175
176
|
require_paths:
|
data/Gemfile.lock
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
tractive (1.0.3)
|
5
|
-
mysql2
|
6
|
-
ox
|
7
|
-
rest-client
|
8
|
-
sequel
|
9
|
-
sqlite3
|
10
|
-
thor
|
11
|
-
|
12
|
-
GEM
|
13
|
-
remote: https://rubygems.org/
|
14
|
-
specs:
|
15
|
-
addressable (2.8.0)
|
16
|
-
public_suffix (>= 2.0.2, < 5.0)
|
17
|
-
ast (2.4.2)
|
18
|
-
coderay (1.1.3)
|
19
|
-
crack (0.4.5)
|
20
|
-
rexml
|
21
|
-
diff-lcs (1.4.4)
|
22
|
-
domain_name (0.5.20190701)
|
23
|
-
unf (>= 0.0.5, < 1.0.0)
|
24
|
-
hashdiff (1.0.1)
|
25
|
-
http-accept (1.7.0)
|
26
|
-
http-cookie (1.0.4)
|
27
|
-
domain_name (~> 0.5)
|
28
|
-
method_source (1.0.0)
|
29
|
-
mime-types (3.3.1)
|
30
|
-
mime-types-data (~> 3.2015)
|
31
|
-
mime-types-data (3.2021.0901)
|
32
|
-
mysql2 (0.5.3)
|
33
|
-
netrc (0.11.0)
|
34
|
-
ox (2.14.5)
|
35
|
-
parallel (1.21.0)
|
36
|
-
parser (3.0.2.0)
|
37
|
-
ast (~> 2.4.1)
|
38
|
-
pry (0.14.1)
|
39
|
-
coderay (~> 1.1)
|
40
|
-
method_source (~> 1.0)
|
41
|
-
public_suffix (4.0.6)
|
42
|
-
rainbow (3.0.0)
|
43
|
-
rake (13.0.6)
|
44
|
-
regexp_parser (2.1.1)
|
45
|
-
rest-client (2.1.0)
|
46
|
-
http-accept (>= 1.7.0, < 2.0)
|
47
|
-
http-cookie (>= 1.0.2, < 2.0)
|
48
|
-
mime-types (>= 1.16, < 4.0)
|
49
|
-
netrc (~> 0.8)
|
50
|
-
rexml (3.2.5)
|
51
|
-
rspec (3.10.0)
|
52
|
-
rspec-core (~> 3.10.0)
|
53
|
-
rspec-expectations (~> 3.10.0)
|
54
|
-
rspec-mocks (~> 3.10.0)
|
55
|
-
rspec-core (3.10.1)
|
56
|
-
rspec-support (~> 3.10.0)
|
57
|
-
rspec-expectations (3.10.1)
|
58
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
-
rspec-support (~> 3.10.0)
|
60
|
-
rspec-mocks (3.10.2)
|
61
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
62
|
-
rspec-support (~> 3.10.0)
|
63
|
-
rspec-support (3.10.2)
|
64
|
-
rubocop (1.22.1)
|
65
|
-
parallel (~> 1.10)
|
66
|
-
parser (>= 3.0.0.0)
|
67
|
-
rainbow (>= 2.2.2, < 4.0)
|
68
|
-
regexp_parser (>= 1.8, < 3.0)
|
69
|
-
rexml
|
70
|
-
rubocop-ast (>= 1.12.0, < 2.0)
|
71
|
-
ruby-progressbar (~> 1.7)
|
72
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
73
|
-
rubocop-ast (1.12.0)
|
74
|
-
parser (>= 3.0.1.1)
|
75
|
-
ruby-progressbar (1.11.0)
|
76
|
-
sequel (5.49.0)
|
77
|
-
sqlite3 (1.4.2)
|
78
|
-
thor (1.1.0)
|
79
|
-
unf (0.1.4)
|
80
|
-
unf_ext
|
81
|
-
unf_ext (0.0.8)
|
82
|
-
unicode-display_width (2.1.0)
|
83
|
-
webmock (3.14.0)
|
84
|
-
addressable (>= 2.8.0)
|
85
|
-
crack (>= 0.3.2)
|
86
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
87
|
-
|
88
|
-
PLATFORMS
|
89
|
-
ruby
|
90
|
-
|
91
|
-
DEPENDENCIES
|
92
|
-
pry
|
93
|
-
rake (~> 13.0)
|
94
|
-
rspec (~> 3.0)
|
95
|
-
rubocop (~> 1.7)
|
96
|
-
tractive!
|
97
|
-
webmock (~> 3.14)
|
98
|
-
|
99
|
-
BUNDLED WITH
|
100
|
-
2.1.2
|