tractive 1.0.8 → 1.0.12
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 +7 -0
- data/README.adoc +88 -16
- data/db/trac-test.db +0 -0
- data/exe/command_base.rb +11 -0
- data/exe/generate.rb +49 -0
- data/exe/tractive +25 -51
- data/lib/tractive/attachment_exporter.rb +4 -3
- data/lib/tractive/github_api/client/issues.rb +6 -6
- data/lib/tractive/github_api/client/labels.rb +2 -2
- data/lib/tractive/github_api/client/milestones.rb +2 -2
- data/lib/tractive/github_api/client.rb +2 -0
- data/lib/tractive/http/client/request.rb +59 -0
- data/lib/tractive/http/client.rb +3 -0
- data/lib/tractive/main.rb +5 -1
- data/lib/tractive/migrator/converter/trac_to_github.rb +27 -12
- data/lib/tractive/migrator/converter/twf_to_markdown.rb +228 -36
- data/lib/tractive/migrator/engine.rb +4 -3
- data/lib/tractive/migrator/wikis/migrate_from_db.rb +167 -0
- data/lib/tractive/migrator/wikis.rb +3 -0
- data/lib/tractive/migrator.rb +1 -0
- data/lib/tractive/models/attachment.rb +1 -0
- data/lib/tractive/models/ticket.rb +16 -8
- data/lib/tractive/models/wiki.rb +18 -0
- data/lib/tractive/trac.rb +2 -1
- data/lib/tractive/utilities.rb +18 -2
- data/lib/tractive/version.rb +1 -1
- data/lib/tractive.rb +1 -0
- metadata +11 -2
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Tractive
|
4
|
+
class Wiki < Sequel::Model(:wiki)
|
5
|
+
set_primary_key :name
|
6
|
+
one_to_many :attachments, class: Attachment, key: :id, conditions: { type: "wiki" }
|
7
|
+
|
8
|
+
dataset_module do
|
9
|
+
def for_migration
|
10
|
+
select(:name, :version, :author, :comment, Sequel.lit("datetime(time/1000000, 'unixepoch')").as(:fixeddate), :text).order(:name, :version)
|
11
|
+
end
|
12
|
+
|
13
|
+
def latest_versions
|
14
|
+
select(:name, :version, :text).group(:name).having { version =~ MAX(version) }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/tractive/trac.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Tractive
|
4
4
|
class Trac
|
5
|
-
attr_reader :tickets, :changes, :sessions, :attachments
|
5
|
+
attr_reader :tickets, :changes, :sessions, :attachments, :wikis
|
6
6
|
|
7
7
|
def initialize(db)
|
8
8
|
$logger.info("loading tickets")
|
@@ -11,6 +11,7 @@ module Tractive
|
|
11
11
|
@changes = TicketChange
|
12
12
|
@sessions = Session
|
13
13
|
@attachments = Attachment
|
14
|
+
@wikis = Wiki
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
data/lib/tractive/utilities.rb
CHANGED
@@ -22,7 +22,8 @@ module Tractive
|
|
22
22
|
"lib/tractive/models/revision.rb",
|
23
23
|
"lib/tractive/models/session.rb",
|
24
24
|
"lib/tractive/models/ticket_change.rb",
|
25
|
-
"lib/tractive/models/ticket.rb"
|
25
|
+
"lib/tractive/models/ticket.rb",
|
26
|
+
"lib/tractive/models/wiki.rb"
|
26
27
|
]
|
27
28
|
db = Sequel.connect(db_url) if db_url
|
28
29
|
|
@@ -35,6 +36,21 @@ module Tractive
|
|
35
36
|
db
|
36
37
|
end
|
37
38
|
|
39
|
+
def dasharize(str)
|
40
|
+
str.gsub(/([a-z\d])([A-Z])/, '\1-\2').downcase
|
41
|
+
end
|
42
|
+
|
43
|
+
def attachment_path(id, filename, options = {})
|
44
|
+
return "#{id}/#{filename}" unless options[:hashed]
|
45
|
+
|
46
|
+
folder_name = Digest::SHA1.hexdigest(id)
|
47
|
+
parent_folder_name = folder_name[0..2]
|
48
|
+
hashed_filename = Digest::SHA1.hexdigest(filename)
|
49
|
+
file_extension = File.extname(filename)
|
50
|
+
|
51
|
+
"#{parent_folder_name}/#{folder_name}/#{hashed_filename}#{file_extension}"
|
52
|
+
end
|
53
|
+
|
38
54
|
def setup_logger(options = {})
|
39
55
|
$logger = Logger.new(options[:output_stream])
|
40
56
|
$logger.level = options[:verbose] ? Logger::DEBUG : Logger::INFO
|
@@ -46,7 +62,7 @@ module Tractive
|
|
46
62
|
|
47
63
|
# returns the git commit hash for a specified revision (using revmap hash)
|
48
64
|
def map_changeset(str, revmap, changeset_base_url = "")
|
49
|
-
if revmap&.key?(str)
|
65
|
+
if revmap&.key?(str) && !revmap[str].nil?
|
50
66
|
base_url = changeset_base_url
|
51
67
|
base_url += "/" if base_url[-1] && base_url[-1] != "/"
|
52
68
|
"#{base_url}#{revmap[str].strip}"
|
data/lib/tractive/version.rb
CHANGED
data/lib/tractive.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.12
|
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: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mysql2
|
@@ -112,6 +112,8 @@ description:
|
|
112
112
|
email:
|
113
113
|
- open.source@ribose.com
|
114
114
|
executables:
|
115
|
+
- command_base.rb
|
116
|
+
- generate.rb
|
115
117
|
- tractive
|
116
118
|
extensions: []
|
117
119
|
extra_rdoc_files: []
|
@@ -133,6 +135,8 @@ files:
|
|
133
135
|
- db/trac-test.db
|
134
136
|
- docker/Dockerfile
|
135
137
|
- docker/docker-compose.yml
|
138
|
+
- exe/command_base.rb
|
139
|
+
- exe/generate.rb
|
136
140
|
- exe/tractive
|
137
141
|
- lib/tractive.rb
|
138
142
|
- lib/tractive/attachment_exporter.rb
|
@@ -142,6 +146,8 @@ files:
|
|
142
146
|
- lib/tractive/github_api/client/labels.rb
|
143
147
|
- lib/tractive/github_api/client/milestones.rb
|
144
148
|
- lib/tractive/graceful_quit.rb
|
149
|
+
- lib/tractive/http/client.rb
|
150
|
+
- lib/tractive/http/client/request.rb
|
145
151
|
- lib/tractive/info.rb
|
146
152
|
- lib/tractive/main.rb
|
147
153
|
- lib/tractive/migrator.rb
|
@@ -152,6 +158,8 @@ files:
|
|
152
158
|
- lib/tractive/migrator/engine/migrate_from_db.rb
|
153
159
|
- lib/tractive/migrator/engine/migrate_from_file.rb
|
154
160
|
- lib/tractive/migrator/engine/migrate_to_file.rb
|
161
|
+
- lib/tractive/migrator/wikis.rb
|
162
|
+
- lib/tractive/migrator/wikis/migrate_from_db.rb
|
155
163
|
- lib/tractive/models/attachment.rb
|
156
164
|
- lib/tractive/models/milestone.rb
|
157
165
|
- lib/tractive/models/report.rb
|
@@ -159,6 +167,7 @@ files:
|
|
159
167
|
- lib/tractive/models/session.rb
|
160
168
|
- lib/tractive/models/ticket.rb
|
161
169
|
- lib/tractive/models/ticket_change.rb
|
170
|
+
- lib/tractive/models/wiki.rb
|
162
171
|
- lib/tractive/revmap_generator.rb
|
163
172
|
- lib/tractive/trac.rb
|
164
173
|
- lib/tractive/utilities.rb
|