tractive 1.0.22 → 1.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/exe/command_base.rb +0 -0
- data/exe/generate.rb +0 -0
- data/lib/tractive/github_api/graph_ql_client.rb +2 -0
- data/lib/tractive/main.rb +15 -1
- data/lib/tractive/migrator/converter/trac_to_github.rb +13 -8
- data/lib/tractive/migrator/engine.rb +4 -1
- data/lib/tractive/version.rb +1 -1
- data/tractive.gemspec +0 -2
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a7508c99649ff11344e9456302900a4aa7fbadbb69eeadd722b55051bd22986
|
4
|
+
data.tar.gz: d6b909e3870a8078dedd18f5ee07f47464661ee2eec12638d1ae48b877246b75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daf2cfe63bba64235429e51e53e4b1bb89e67fd13aff56794c89104f049fe4465173bc2519ee99198443730036f8112e22cf8e2a09a805019a070595404f2300
|
7
|
+
data.tar.gz: b43eb5f2fed5b47397052936027b7a0de60b5cde6dfe4ad685969291aa88c26a03c22a99e6c209840c1f746565640a37a7f2d939640463dd7e464c3225955e70
|
data/Gemfile
CHANGED
data/exe/command_base.rb
CHANGED
File without changes
|
data/exe/generate.rb
CHANGED
File without changes
|
@@ -26,6 +26,8 @@ module GithubApi
|
|
26
26
|
GithubApi::GraphQlClient.const_set("Schema", GraphQL::Client.load_schema(HttpAdapter))
|
27
27
|
GithubApi::GraphQlClient.const_set("Client", GraphQL::Client.new(schema: Schema, execute: HttpAdapter))
|
28
28
|
GithubApi::GraphQlClient.const_set("DeleteIssueQuery", Client.parse(DELETE_ISSUE_QUERY))
|
29
|
+
rescue KeyError
|
30
|
+
raise ::StandardError, "Github access token is incorrect or does not have sufficent permissions to access the Github API"
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
data/lib/tractive/main.rb
CHANGED
@@ -8,16 +8,21 @@ module Tractive
|
|
8
8
|
@opts = opts
|
9
9
|
@cfg = YAML.load_file(@opts[:config])
|
10
10
|
|
11
|
+
Tractive::Utilities.setup_logger(output_stream: @opts[:logfile] || $stderr, verbose: @opts[:verbose])
|
12
|
+
|
13
|
+
verify_config!(@cfg, @opts)
|
14
|
+
|
11
15
|
@cfg["github"] ||= {}
|
12
16
|
@cfg["github"]["token"] = @opts["git-token"] if @opts["git-token"]
|
13
17
|
|
14
18
|
GithubApi::GraphQlClient.add_constants(@cfg["github"]["token"]) unless @opts[:info]
|
15
19
|
|
16
|
-
Tractive::Utilities.setup_logger(output_stream: @opts[:logfile] || $stderr, verbose: @opts[:verbose])
|
17
20
|
@db = Tractive::Utilities.setup_db!(@opts["trac-database-path"] || @cfg["trac"]["database"])
|
18
21
|
rescue Sequel::DatabaseConnectionError, Sequel::AdapterNotFound, URI::InvalidURIError, Sequel::DatabaseError => e
|
19
22
|
$logger.error e.message
|
20
23
|
exit 1
|
24
|
+
rescue StandardError => e
|
25
|
+
warn_and_exit(e.message, 1)
|
21
26
|
end
|
22
27
|
|
23
28
|
def run
|
@@ -56,6 +61,15 @@ module Tractive
|
|
56
61
|
|
57
62
|
private
|
58
63
|
|
64
|
+
def verify_config!(config, options)
|
65
|
+
database_path_missing_error = <<~DATABASE_PATH_MISSING_ERROR
|
66
|
+
Missing path for trac database which can be set using `--trac-database-path` or can
|
67
|
+
be set in config file (see https://github.com/ietf-ribose/tractive#trac-configuration)
|
68
|
+
DATABASE_PATH_MISSING_ERROR
|
69
|
+
|
70
|
+
warn_and_exit(database_path_missing_error, 1) if !options["trac-database-path"] && !(config["trac"] && config["trac"]["database"])
|
71
|
+
end
|
72
|
+
|
59
73
|
def verify_options!(options)
|
60
74
|
verify_config_options!(options)
|
61
75
|
verify_filter_options!(options)
|
@@ -176,7 +176,7 @@ module Migrator
|
|
176
176
|
|
177
177
|
if @users.key?(ticket[:owner])
|
178
178
|
owner = trac_mail(ticket[:owner])
|
179
|
-
github_owner =
|
179
|
+
github_owner = extract_github_owner_username(owner)
|
180
180
|
$logger.debug("..owner in trac: #{owner}")
|
181
181
|
$logger.debug("..assignee in GitHub: #{github_owner}")
|
182
182
|
issue["assignee"] = github_owner
|
@@ -189,13 +189,7 @@ module Migrator
|
|
189
189
|
# issue["updated_at"] = format_time(ticket[:changetime])
|
190
190
|
end
|
191
191
|
|
192
|
-
if issue["closed"]
|
193
|
-
issue["closed_at"] = if closed_time
|
194
|
-
format_time(closed_time)
|
195
|
-
else
|
196
|
-
format_time(ticket[:closed_at].to_i)
|
197
|
-
end
|
198
|
-
end
|
192
|
+
issue["closed_at"] = format_time(closed_time || ticket[:closed_at].to_i) if issue["closed"]
|
199
193
|
|
200
194
|
{
|
201
195
|
"issue" => issue,
|
@@ -383,6 +377,17 @@ module Migrator
|
|
383
377
|
|
384
378
|
"[trac:#{ticket[:id]}](#{@trac_ticket_base_url}/#{ticket[:id]})"
|
385
379
|
end
|
380
|
+
|
381
|
+
def extract_github_owner_username(owner)
|
382
|
+
if !owner || !@users[owner]
|
383
|
+
raise(
|
384
|
+
StandardError,
|
385
|
+
"Unable to find Github username for #{owner}, this can be set in the config file."
|
386
|
+
)
|
387
|
+
end
|
388
|
+
|
389
|
+
@users[owner]["username"]
|
390
|
+
end
|
386
391
|
end
|
387
392
|
end
|
388
393
|
end
|
@@ -63,7 +63,7 @@ module Migrator
|
|
63
63
|
@safetychecks = safetychecks
|
64
64
|
@start_ticket = (start_ticket || (@last_created_issue + 1)).to_i
|
65
65
|
@filter_closed = filter_closed
|
66
|
-
@delete_mocked_tickets = args[:cfg]["ticket"]["delete_mocked"]
|
66
|
+
@delete_mocked_tickets = args[:cfg]["ticket"]["delete_mocked"] if args[:cfg]["ticket"]
|
67
67
|
end
|
68
68
|
|
69
69
|
def migrate
|
@@ -74,6 +74,9 @@ module Migrator
|
|
74
74
|
else
|
75
75
|
migrate_from_db
|
76
76
|
end
|
77
|
+
rescue StandardError => e
|
78
|
+
$logger.error e.message
|
79
|
+
exit 1
|
77
80
|
end
|
78
81
|
|
79
82
|
private
|
data/lib/tractive/version.rb
CHANGED
data/tractive.gemspec
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.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -122,20 +122,6 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: pry
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
125
|
description:
|
140
126
|
email:
|
141
127
|
- open.source@ribose.com
|
@@ -225,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
211
|
- !ruby/object:Gem::Version
|
226
212
|
version: '0'
|
227
213
|
requirements: []
|
228
|
-
rubygems_version: 3.
|
214
|
+
rubygems_version: 3.3.7
|
229
215
|
signing_key:
|
230
216
|
specification_version: 4
|
231
217
|
summary: Exporting tool for Trac
|